Sync docs from master to gh-pages
This commit is contained in:
129
ghpages.sh
129
ghpages.sh
@@ -12,43 +12,118 @@ if ! [ -d docs/target/generated-docs ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Find name of current branch
|
||||
# The script should be executed from the root folder
|
||||
|
||||
ROOT_FOLDER=`pwd`
|
||||
echo "Current folder is ${ROOT_FOLDER}"
|
||||
|
||||
if [[ ! -e "${ROOT_FOLDER}/.git" ]]; then
|
||||
echo "You're not in the root folder of the project!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Retrieve properties
|
||||
###################################################################
|
||||
branch=$TRAVIS_BRANCH
|
||||
[ "$branch" == "" ] && branch=`git rev-parse --abbrev-ref HEAD`
|
||||
target=.
|
||||
if [ "$branch" != "master" ]; then target=./$branch; mkdir -p $target; fi
|
||||
|
||||
# Prop that will let commit the changes
|
||||
COMMIT_CHANGES="no"
|
||||
MAVEN_PATH=${MAVEN_PATH:-}
|
||||
echo "Path to Maven is [${MAVEN_PATH}]"
|
||||
|
||||
# Code getting the name of the current branch. For master we want to publish as we did until now
|
||||
# http://stackoverflow.com/questions/1593051/how-to-programmatically-determine-the-current-checked-out-git-branch
|
||||
# If there is a branch already passed will reuse it - otherwise will try to find it
|
||||
CURRENT_BRANCH=${BRANCH}
|
||||
if [[ -z "${CURRENT_BRANCH}" ]] ; then
|
||||
CURRENT_BRANCH=$(git symbolic-ref -q HEAD)
|
||||
CURRENT_BRANCH=${CURRENT_BRANCH##refs/heads/}
|
||||
CURRENT_BRANCH=${CURRENT_BRANCH:-HEAD}
|
||||
fi
|
||||
echo "Current branch is [${CURRENT_BRANCH}]"
|
||||
git checkout ${CURRENT_BRANCH}
|
||||
|
||||
# Get the name of the `docs.main` property
|
||||
MAIN_ADOC_VALUE=$("${MAVEN_PATH}"mvn -q \
|
||||
-Dexec.executable="echo" \
|
||||
-Dexec.args='${docs.main}' \
|
||||
--non-recursive \
|
||||
org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
|
||||
echo "Extracted 'main.adoc' from Maven build [${MAIN_ADOC_VALUE}]"
|
||||
|
||||
# Get whitelisted branches - assumes that a `docs` module is available under `docs` profile
|
||||
WHITELIST_PROPERTY="docs.whitelisted.branches"
|
||||
WHITELISTED_BRANCHES_VALUE=$("${MAVEN_PATH}"mvn -q \
|
||||
-Dexec.executable="echo" \
|
||||
-Dexec.args="\${${WHITELIST_PROPERTY}}" \
|
||||
org.codehaus.mojo:exec-maven-plugin:1.3.1:exec \
|
||||
-P docs \
|
||||
-pl docs)
|
||||
echo "Extracted '${WHITELIST_PROPERTY}' from Maven build [${WHITELISTED_BRANCHES_VALUE}]"
|
||||
|
||||
# Stash any outstanding changes
|
||||
###################################################################
|
||||
git diff-index --quiet HEAD
|
||||
dirty=$?
|
||||
git diff-index --quiet HEAD && dirty=$? || (echo "Failed to check if the current repo is dirty. Assuming that it is." && dirty="1")
|
||||
if [ "$dirty" != "0" ]; then git stash; fi
|
||||
|
||||
# Switch to gh-pages branch to sync it with current branch
|
||||
# Switch to gh-pages branch to sync it with master
|
||||
###################################################################
|
||||
git checkout gh-pages
|
||||
git pull origin gh-pages
|
||||
|
||||
for f in docs/target/generated-docs/*; do
|
||||
file=${f#docs/target/generated-docs/*}
|
||||
if ! git ls-files -i -o --exclude-standard --directory | grep -q ^$file$; then
|
||||
# Not ignored...
|
||||
cp -rf $f $target
|
||||
git add -A $target/$file
|
||||
fi
|
||||
done
|
||||
|
||||
git add -A README.adoc || echo "No change to README.adoc"
|
||||
git commit -a -m "Sync docs from $branch to gh-pages" || echo "Nothing committed"
|
||||
|
||||
# Uncomment the following push if you want to auto push to
|
||||
# the gh-pages branch whenever you commit to branch locally.
|
||||
# This is a little extreme. Use with care!
|
||||
# Add git branches
|
||||
###################################################################
|
||||
git push origin gh-pages || echo "Cannot push gh-pages"
|
||||
mkdir -p ${ROOT_FOLDER}/${CURRENT_BRANCH}
|
||||
if [[ "${CURRENT_BRANCH}" == "master" ]] ; then
|
||||
echo -e "Current branch is master - will copy the current docs only to the root folder"
|
||||
for f in docs/target/generated-docs/*; do
|
||||
file=${f#docs/target/generated-docs/*}
|
||||
if ! git ls-files -i -o --exclude-standard --directory | grep -q ^$file$; then
|
||||
# Not ignored...
|
||||
cp -rf $f ${ROOT_FOLDER}/
|
||||
git add -A ${ROOT_FOLDER}/$file
|
||||
fi
|
||||
done
|
||||
COMMIT_CHANGES="yes"
|
||||
else
|
||||
echo -e "Current branch is [${CURRENT_BRANCH}]"
|
||||
# http://stackoverflow.com/questions/29300806/a-bash-script-to-check-if-a-string-is-present-in-a-comma-separated-list-of-strin
|
||||
if [[ ",${WHITELISTED_BRANCHES_VALUE}," = *",${CURRENT_BRANCH},"* ]] ; then
|
||||
echo -e "Branch [${CURRENT_BRANCH}] is whitelisted! Will copy the current docs to the [${CURRENT_BRANCH}] folder"
|
||||
for f in docs/target/generated-docs/*; do
|
||||
file=${f#docs/target/generated-docs/*}
|
||||
if ! git ls-files -i -o --exclude-standard --directory | grep -q ^$file$; then
|
||||
# Not ignored...
|
||||
# We want users to access 1.0.0.RELEASE/ instead of 1.0.0.RELEASE/spring-cloud.sleuth.html
|
||||
if [[ "${file}" == "${MAIN_ADOC_VALUE}.html" ]] ; then
|
||||
# We don't want to copy the spring-cloud-sleuth.html
|
||||
# we want it to be converted to index.html
|
||||
cp -rf $f ${ROOT_FOLDER}/${CURRENT_BRANCH}/index.html
|
||||
git add -A ${ROOT_FOLDER}/${CURRENT_BRANCH}/index.html
|
||||
else
|
||||
cp -rf $f ${ROOT_FOLDER}/${CURRENT_BRANCH}
|
||||
git add -A ${ROOT_FOLDER}/${CURRENT_BRANCH}/$file
|
||||
fi
|
||||
fi
|
||||
done
|
||||
COMMIT_CHANGES="yes"
|
||||
else
|
||||
echo -e "Branch [${CURRENT_BRANCH}] is not on the white list! Check out the Maven [${WHITELIST_PROPERTY}] property in
|
||||
[docs] module available under [docs] profile. Won't commit any changes to gh-pages for this branch."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Finally, switch back to the current branch and exit block
|
||||
git checkout $branch
|
||||
if [[ "${COMMIT_CHANGES}" == "yes" ]] ; then
|
||||
git commit -a -m "Sync docs from ${CURRENT_BRANCH} to gh-pages"
|
||||
|
||||
# Uncomment the following push if you want to auto push to
|
||||
# the gh-pages branch whenever you commit to master locally.
|
||||
# This is a little extreme. Use with care!
|
||||
###################################################################
|
||||
git push origin gh-pages
|
||||
fi
|
||||
|
||||
# Finally, switch back to the master branch and exit block
|
||||
git checkout ${CURRENT_BRANCH}
|
||||
if [ "$dirty" != "0" ]; then git stash pop; fi
|
||||
|
||||
exit 0
|
||||
exit 0
|
||||
@@ -1,13 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
| Generated by Apache Maven Doxia Site Renderer 1.6 at 2016-08-03
|
||||
| Generated by Apache Maven Doxia Site Renderer 1.6 at 2016-08-17
|
||||
| Rendered using Apache Maven Fluido Skin 1.5
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="Date-Revision-yyyymmdd" content="20160803" />
|
||||
<meta name="Date-Revision-yyyymmdd" content="20160817" />
|
||||
<meta http-equiv="Content-Language" content="en" />
|
||||
<title>Spring Cloud Contract Verifier Maven Plugin – </title>
|
||||
<link rel="stylesheet" href="./css/apache-maven-fluido-1.5.min.css" />
|
||||
@@ -104,7 +104,7 @@
|
||||
<div id="breadcrumbs">
|
||||
<ul class="breadcrumb">
|
||||
|
||||
<li id="publishDate">Last Published: 2016-08-03
|
||||
<li id="publishDate">Last Published: 2016-08-17
|
||||
<span class="divider">|</span>
|
||||
</li>
|
||||
<li id="projectVersion">Version: 1.0.0.BUILD-SNAPSHOT
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
| Generated by Apache Maven Doxia Site Renderer 1.6 at 2016-08-03
|
||||
| Generated by Apache Maven Doxia Site Renderer 1.6 at 2016-08-17
|
||||
| Rendered using Apache Maven Fluido Skin 1.5
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="Date-Revision-yyyymmdd" content="20160803" />
|
||||
<meta name="Date-Revision-yyyymmdd" content="20160817" />
|
||||
<meta http-equiv="Content-Language" content="en" />
|
||||
<title>Spring Cloud Contract Verifier Maven Plugin – </title>
|
||||
<link rel="stylesheet" href="./css/apache-maven-fluido-1.5.min.css" />
|
||||
@@ -104,7 +104,7 @@
|
||||
<div id="breadcrumbs">
|
||||
<ul class="breadcrumb">
|
||||
|
||||
<li id="publishDate">Last Published: 2016-08-03
|
||||
<li id="publishDate">Last Published: 2016-08-17
|
||||
<span class="divider">|</span>
|
||||
</li>
|
||||
<li id="projectVersion">Version: 1.0.0.BUILD-SNAPSHOT
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
| Generated by Apache Maven Doxia Site Renderer 1.6 at 2016-08-03
|
||||
| Generated by Apache Maven Doxia Site Renderer 1.6 at 2016-08-17
|
||||
| Rendered using Apache Maven Fluido Skin 1.5
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="Date-Revision-yyyymmdd" content="20160803" />
|
||||
<meta name="Date-Revision-yyyymmdd" content="20160817" />
|
||||
<meta http-equiv="Content-Language" content="en" />
|
||||
<title>Spring Cloud Contract Verifier Maven Plugin – </title>
|
||||
<link rel="stylesheet" href="./css/apache-maven-fluido-1.5.min.css" />
|
||||
@@ -104,7 +104,7 @@
|
||||
<div id="breadcrumbs">
|
||||
<ul class="breadcrumb">
|
||||
|
||||
<li id="publishDate">Last Published: 2016-08-03
|
||||
<li id="publishDate">Last Published: 2016-08-17
|
||||
<span class="divider">|</span>
|
||||
</li>
|
||||
<li id="projectVersion">Version: 1.0.0.BUILD-SNAPSHOT
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
| Generated by Apache Maven Doxia Site Renderer 1.6 at 2016-08-03
|
||||
| Generated by Apache Maven Doxia Site Renderer 1.6 at 2016-08-17
|
||||
| Rendered using Apache Maven Fluido Skin 1.5
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="Date-Revision-yyyymmdd" content="20160803" />
|
||||
<meta name="Date-Revision-yyyymmdd" content="20160817" />
|
||||
<meta http-equiv="Content-Language" content="en" />
|
||||
<title>Spring Cloud Contract Verifier Maven Plugin – </title>
|
||||
<link rel="stylesheet" href="./css/apache-maven-fluido-1.5.min.css" />
|
||||
@@ -104,7 +104,7 @@
|
||||
<div id="breadcrumbs">
|
||||
<ul class="breadcrumb">
|
||||
|
||||
<li id="publishDate">Last Published: 2016-08-03
|
||||
<li id="publishDate">Last Published: 2016-08-17
|
||||
<span class="divider">|</span>
|
||||
</li>
|
||||
<li id="projectVersion">Version: 1.0.0.BUILD-SNAPSHOT
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
| Generated by Apache Maven Doxia Site Renderer 1.6 at 2016-08-03
|
||||
| Generated by Apache Maven Doxia Site Renderer 1.6 at 2016-08-17
|
||||
| Rendered using Apache Maven Fluido Skin 1.5
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="Date-Revision-yyyymmdd" content="20160803" />
|
||||
<meta name="Date-Revision-yyyymmdd" content="20160817" />
|
||||
<meta http-equiv="Content-Language" content="en" />
|
||||
<title>Spring Cloud Contract Verifier Maven Plugin – Sitemap</title>
|
||||
<link rel="stylesheet" href="./css/apache-maven-fluido-1.5.min.css" />
|
||||
@@ -104,7 +104,7 @@
|
||||
<div id="breadcrumbs">
|
||||
<ul class="breadcrumb">
|
||||
|
||||
<li id="publishDate">Last Published: 2016-08-03
|
||||
<li id="publishDate">Last Published: 2016-08-17
|
||||
<span class="divider">|</span>
|
||||
</li>
|
||||
<li id="projectVersion">Version: 1.0.0.BUILD-SNAPSHOT
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
| Generated by Apache Maven Doxia Site Renderer 1.6 at 2016-08-03
|
||||
| Generated by Apache Maven Doxia Site Renderer 1.6 at 2016-08-17
|
||||
| Rendered using Apache Maven Fluido Skin 1.5
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="Date-Revision-yyyymmdd" content="20160803" />
|
||||
<meta name="Date-Revision-yyyymmdd" content="20160817" />
|
||||
<meta http-equiv="Content-Language" content="en" />
|
||||
<title>Spring Cloud Contract Verifier Maven Plugin – </title>
|
||||
<link rel="stylesheet" href="./css/apache-maven-fluido-1.5.min.css" />
|
||||
@@ -104,7 +104,7 @@
|
||||
<div id="breadcrumbs">
|
||||
<ul class="breadcrumb">
|
||||
|
||||
<li id="publishDate">Last Published: 2016-08-03
|
||||
<li id="publishDate">Last Published: 2016-08-17
|
||||
<span class="divider">|</span>
|
||||
</li>
|
||||
<li id="projectVersion">Version: 1.0.0.BUILD-SNAPSHOT
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
| Generated by Apache Maven Doxia Site Renderer 1.6 at 2016-08-03
|
||||
| Generated by Apache Maven Doxia Site Renderer 1.6 at 2016-08-17
|
||||
| Rendered using Apache Maven Fluido Skin 1.5
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="Date-Revision-yyyymmdd" content="20160803" />
|
||||
<meta name="Date-Revision-yyyymmdd" content="20160817" />
|
||||
<meta http-equiv="Content-Language" content="en" />
|
||||
<title>Spring Cloud Contract Verifier Maven Plugin – </title>
|
||||
<link rel="stylesheet" href="./css/apache-maven-fluido-1.5.min.css" />
|
||||
@@ -104,7 +104,7 @@
|
||||
<div id="breadcrumbs">
|
||||
<ul class="breadcrumb">
|
||||
|
||||
<li id="publishDate">Last Published: 2016-08-03
|
||||
<li id="publishDate">Last Published: 2016-08-17
|
||||
<span class="divider">|</span>
|
||||
</li>
|
||||
<li id="projectVersion">Version: 1.0.0.BUILD-SNAPSHOT
|
||||
|
||||
@@ -3506,7 +3506,7 @@ publishing {
|
||||
<div class="sect4">
|
||||
<h5 id="_maven_setup">Maven Setup</h5>
|
||||
<div class="paragraph">
|
||||
<p>Example of Maven can be found in the <a href="https://github.com/spring-cloud/spring-cloud-contract/tree/master/samples/standalone/stream-sink/pom.xml">Stream Sink sample</a></p>
|
||||
<p>Example of Maven can be found in the <a href="https://github.com/spring-cloud/spring-cloud-contract/tree/master/samples/standalone/messaging/stream-sink/pom.xml">Stream Sink sample</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -3865,9 +3865,9 @@ public void should_start_wiremock_servers() throws Exception {
|
||||
then(rule.findStubUrl("loanIssuance")).isEqualTo(rule.findStubUrl("org.springframework.cloud.contract.verifier.stubs", "loanIssuance"));
|
||||
then(rule.findStubUrl("org.springframework.cloud.contract.verifier.stubs:fraudDetectionServer")).isNotNull();
|
||||
// and:
|
||||
BDDAssertions.then(rule.findAllRunningStubs().isPresent("loanIssuance")).isTrue();
|
||||
BDDAssertions.then(rule.findAllRunningStubs().isPresent("org.springframework.cloud.contract.verifier.stubs", "fraudDetectionServer")).isTrue();
|
||||
BDDAssertions.then(rule.findAllRunningStubs().isPresent("org.springframework.cloud.contract.verifier.stubs:fraudDetectionServer")).isTrue();
|
||||
then(rule.findAllRunningStubs().isPresent("loanIssuance")).isTrue();
|
||||
then(rule.findAllRunningStubs().isPresent("org.springframework.cloud.contract.verifier.stubs", "fraudDetectionServer")).isTrue();
|
||||
then(rule.findAllRunningStubs().isPresent("org.springframework.cloud.contract.verifier.stubs:fraudDetectionServer")).isTrue();
|
||||
// and: 'Stubs were registered'
|
||||
then(httpGet(rule.findStubUrl("loanIssuance").toString() + "/name")).isEqualTo("loanIssuance");
|
||||
then(httpGet(rule.findStubUrl("fraudDetectionServer").toString() + "/name")).isEqualTo("fraudDetectionServer");
|
||||
@@ -5341,7 +5341,7 @@ number of different ways, including as described above using
|
||||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2016-07-28 02:30:49 PDT
|
||||
Last updated 2016-08-17 10:45:05 UTC
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user