index.html is a normal page

This commit is contained in:
Marcin Grzejszczak
2019-07-22 16:40:37 +02:00
parent 2a25b01f99
commit 1b8e3471c0
3 changed files with 8 additions and 111 deletions

View File

@@ -121,14 +121,6 @@ function retrieve_doc_properties() {
echo "Will not extract any properties for release train"
return
fi
echo "Extracting doc properties"
MAIN_ADOC_VALUE=$("${MAVEN_EXEC}" -q \
-Dexec.executable="echo" \
-Dexec.args='${docs.main}' \
org.codehaus.mojo:exec-maven-plugin:1.3.1:exec \
-P docs \
-pl docs | tail -1 )
echo "Extracted 'main.adoc' from Maven build [${MAIN_ADOC_VALUE}]"
WHITELIST_PROPERTY=${WHITELIST_PROPERTY:-"docs.whitelisted.branches"}
@@ -226,15 +218,8 @@ function copy_docs_for_current_version() {
echo "The file [${file}] shouldn't be ignored"
# 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_BIN}" add -A "${ROOT_FOLDER}/${CURRENT_BRANCH}/index.html"
else
cp -rf "${f}" "${ROOT_FOLDER}/${CURRENT_BRANCH}"
cp -rf "${f}" "${ROOT_FOLDER}/${CURRENT_BRANCH}"
"${GIT_BIN}" add -A "${ROOT_FOLDER}/${CURRENT_BRANCH}/${file}" || echo "Failed to add the file [${file}]"
fi
fi
done
COMMIT_CHANGES="yes"
@@ -268,14 +253,7 @@ function copy_docs_for_branch() {
echo "Copying file [${file}] to destination [${destination}]"
if ! "${GIT_BIN}" 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") || ("${file}" == "${REPO_NAME}.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}" "${destination}"/index.html
else
cp -rf "${f}" "${destination}"
fi
cp -rf "${f}" "${destination}"
"${GIT_BIN}" add -A "${destination}"
fi
}

View File

@@ -88,7 +88,6 @@ export -f stubbed_git
export RELEASER_GIT_OAUTH_TOKEN="mytoken"
cd "${TEMP_DIR}/spring-cloud-stream/"
mkdir -p docs/target/generated-docs/
touch docs/target/generated-docs/${MAIN_ADOC_VALUE}.html
touch docs/target/generated-docs/foo.html
run "${SOURCE_DIR}"/ghpages.sh
@@ -118,7 +117,6 @@ export -f stubbed_git
cd "${TEMP_DIR}/spring-cloud-stream/"
mkdir -p docs/target/generated-docs/
touch docs/target/generated-docs/${MAIN_ADOC_VALUE}.html
touch docs/target/generated-docs/foo.html
run "${SOURCE_DIR}"/ghpages.sh
@@ -130,7 +128,6 @@ export -f stubbed_git
# Previous branch was [master]
assert_output --partial "git checkout master"
assert_output --partial "git checkout v1.0.0.RELEASE"
assert_output --partial "Extracted 'main.adoc' from Maven build [home]"
assert_output --partial "git stash"
assert_output --partial "git checkout gh-pages"
assert_output --partial "git pull origin gh-pages"
@@ -154,7 +151,6 @@ export -f stubbed_git
cd "${TEMP_DIR}/spring-cloud-stream/"
mkdir -p docs/target/generated-docs/
touch docs/target/generated-docs/${MAIN_ADOC_VALUE}.html
touch docs/target/generated-docs/foo.html
run "${SOURCE_DIR}"/ghpages.sh
@@ -308,7 +304,6 @@ export -f stubbed_git
retrieve_doc_properties
assert_success
assert [ "${MAIN_ADOC_VALUE}" == "home" ]
assert [ "${WHITELISTED_BRANCHES_VALUE}" == "0.1.1.RELEASE" ]
}
@@ -341,7 +336,6 @@ export -f stubbed_git
export CURRENT_BRANCH="master"
cd "${TEMP_DIR}/spring-cloud-stream/"
mkdir -p docs/target/generated-docs/
touch docs/target/generated-docs/${MAIN_ADOC_VALUE}.html
touch docs/target/generated-docs/foo.html
source "${SOURCE_DIR}"/ghpages.sh
@@ -356,10 +350,9 @@ export -f stubbed_git
export GIT_BIN="printing_git"
export CURRENT_BRANCH="present"
export WHITELISTED_BRANCHES_VALUE="present"
export MAIN_ADOC_VALUE="my_doc"
cd "${TEMP_DIR}/spring-cloud-stream/"
mkdir -p docs/target/generated-docs/
touch docs/target/generated-docs/${MAIN_ADOC_VALUE}.html
touch docs/target/generated-docs/my_doc.html
touch docs/target/generated-docs/foo.html
source "${SOURCE_DIR}"/ghpages.sh
@@ -372,7 +365,7 @@ export -f stubbed_git
run copy_docs_for_current_version
assert_success
assert_output --partial "add -A ${ROOT_FOLDER}/present/index.html"
assert_output --partial "add -A ${ROOT_FOLDER}/present/my_doc.html"
assert_output --partial "add -A ${ROOT_FOLDER}/present/foo.html"
}
@@ -389,58 +382,6 @@ export -f stubbed_git
assert [ "${COMMIT_CHANGES}" != "yes" ]
}
@test "should reuse main adoc value as new index.html" {
export GIT_BIN="printing_git"
export DESTINATION_REPO_FOLDER="${TEMP_DIR}/spring-cloud-static"
export VERSION="1.0.0.RELEASE"
export MAIN_ADOC_VALUE="my_doc"
cd "${TEMP_DIR}/spring-cloud-stream/"
mkdir -p docs/target/generated-docs/
touch docs/target/generated-docs/${MAIN_ADOC_VALUE}.html
touch docs/target/generated-docs/foo.html
source "${SOURCE_DIR}"/ghpages.sh
copy_docs_for_provided_version
assert_success
assert [ "${COMMIT_CHANGES}" == "yes" ]
assert [ "${CURRENT_BRANCH}" == "v${VERSION}" ]
run copy_docs_for_provided_version
assert_success
assert_output --partial "add -A ${DESTINATION_REPO_FOLDER}/${VERSION}"
assert [ -f "${DESTINATION_REPO_FOLDER}/${VERSION}/index.html" ]
assert [ -f "${DESTINATION_REPO_FOLDER}/${VERSION}/foo.html" ]
}
@test "should reuse repo name as new index.html" {
export GIT_BIN="printing_git"
export DESTINATION_REPO_FOLDER="${TEMP_DIR}/spring-cloud-static"
export VERSION="1.0.0.RELEASE"
export REPO_NAME="spring-cloud-stream"
cd "${TEMP_DIR}/spring-cloud-stream/"
mkdir -p docs/target/generated-docs/
touch docs/target/generated-docs/${REPO_NAME}.html
touch docs/target/generated-docs/foo.html
source "${SOURCE_DIR}"/ghpages.sh
copy_docs_for_provided_version
assert_success
assert [ "${COMMIT_CHANGES}" == "yes" ]
assert [ "${CURRENT_BRANCH}" == "v${VERSION}" ]
run copy_docs_for_provided_version
assert_success
assert_output --partial "add -A ${DESTINATION_REPO_FOLDER}/${VERSION}"
assert [ -f "${DESTINATION_REPO_FOLDER}/${VERSION}/index.html" ]
assert [ -f "${DESTINATION_REPO_FOLDER}/${VERSION}/foo.html" ]
}
@test "should not do anything if commit flag not set" {
export GIT_BIN="printing_git_with_remotes"
export COMMIT_CHANGES="no"

30
pom.xml
View File

@@ -96,6 +96,8 @@
</checkstyle.additional.suppressions.file>
<nohttp-checkstyle.version>0.0.2.RELEASE</nohttp-checkstyle.version>
<disable.nohttp.checks>true</disable.nohttp.checks>
<antelopetasks.version>3.2.10</antelopetasks.version>
<ant-nodeps.version>1.8.1</ant-nodeps.version>
</properties>
<dependencyManagement>
<dependencies>
@@ -1155,12 +1157,12 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
<version>1.8.1</version>
<version>${ant-nodeps.version}</version>
</dependency>
<dependency>
<groupId>org.tigris.antelope</groupId>
<artifactId>antelopetasks</artifactId>
<version>3.2.10</version>
<version>${antelopetasks.version}</version>
</dependency>
<dependency>
<groupId>org.jruby</groupId>
@@ -1265,13 +1267,6 @@
<equals arg1="${git.branch}" arg2="master"/>
</and>
</condition>
<condition property="index-link"
value="${docs.main}/">
<and>
<equals arg1="${version-type}" arg2="SNAPSHOT"/>
<equals arg1="${git.branch}" arg2="master"/>
</and>
</condition>
<condition property="docs-url"
value="https://cloud.spring.io/${docs.main}/${git.branch}/">
<and>
@@ -1281,15 +1276,6 @@
</not>
</and>
</condition>
<condition property="index-link"
value="index.html">
<and>
<equals arg1="${version-type}" arg2="SNAPSHOT"/>
<not>
<equals arg1="${git.branch}" arg2="master"/>
</not>
</and>
</condition>
<condition property="docs-url"
value="https://cloud.spring.io/spring-cloud-static/${docs.main}/${project.version}">
<and>
@@ -1298,14 +1284,6 @@
</not>
</and>
</condition>
<condition property="index-link"
value="index.html">
<and>
<not>
<equals arg1="${version-type}" arg2="SNAPSHOT"/>
</not>
</and>
</condition>
<propertyregex property="raw-docs-url" override="true"
input="${docs-url}" regexp="https://cloud.spring.io/(.*)"
replace="https://raw.githubusercontent.com/\1"/>