You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by zr...@apache.org on 2021/12/15 17:11:18 UTC

[camel-website] 02/03: chore: fetch .htaccess from git

This is an automated email from the ASF dual-hosted git repository.

zregvart pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-website.git

commit 197b77ecb1a9b20a106afcab16c1b60dffaa3850
Author: Zoran Regvart <zo...@regvart.com>
AuthorDate: Wed Dec 15 11:56:31 2021 +0100

    chore: fetch .htaccess from git
    
    If the website wasn't built we can still run the redirect checks by
    loading the live `.htaccess` file from the `asf-site` branch in git.
    This way we can run the redirect checks independent of the build if we
    need to.
---
 tests/redirect.sh | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/tests/redirect.sh b/tests/redirect.sh
index 96752ea..a3098c5 100755
--- a/tests/redirect.sh
+++ b/tests/redirect.sh
@@ -130,12 +130,18 @@ function test {
   fi
 }
 
+HTACCESS_FILE="$GIT_ROOT/documentation/.htaccess"
+if [ ! -f "$HTACCESS_FILE" ]; then
+  echo "No $HTACCESS_FILE found, using last published version. If you have made changes to the Antora playbook make sure to build the site first to test those."
+  $CURL_CMD -s -o "$HTACCESS_FILE" 'https://gitbox.apache.org/repos/asf?p=camel-website.git;a=blob_plain;f=.htaccess;hb=refs/heads/asf-site'
+fi
+
 # determine current _latest_ versions
-COMPONENTS_VERSION="$(grep 'components/latest' "$GIT_ROOT/documentation/.htaccess" | grep -Z -o '[^/]*$')"
-CAMEL_K_VERSION="$(grep 'camel-k/latest' "$GIT_ROOT/documentation/.htaccess" | grep -Z -o '[^/]*$')"
-CAMEL_KAFKA_CONNECTOR_VERSION="$(grep 'camel-kafka-connector/latest' "$GIT_ROOT/documentation/.htaccess" | grep -Z -o '[^/]*$')"
-CAMEL_QUARKUS_VERSION="$(grep 'camel-quarkus/latest' "$GIT_ROOT/documentation/.htaccess" | grep -Z -o '[^/]*$')"
-CAMEL_KAMELETS_VERSION="$(grep 'camel-kamelets/latest' "$GIT_ROOT/documentation/.htaccess" | grep -Z -o '[^/]*$')"
+COMPONENTS_VERSION="$(grep '^Redirect 302 /components/latest' "$HTACCESS_FILE" | grep -Z -o '[^/]*$')"
+CAMEL_K_VERSION="$(grep '^Redirect 302 /camel-k/latest' "$HTACCESS_FILE" | grep -Z -o '[^/]*$')"
+CAMEL_KAFKA_CONNECTOR_VERSION="$(grep '^Redirect 302 /camel-kafka-connector/latest' "$HTACCESS_FILE" | grep -Z -o '[^/]*$')"
+CAMEL_QUARKUS_VERSION="$(grep '^Redirect 302 /camel-quarkus/latest' "$HTACCESS_FILE" | grep -Z -o '[^/]*$')"
+CAMEL_KAMELETS_VERSION="$(grep '^Redirect 302 /camel-kamelets/latest' "$HTACCESS_FILE" | grep -Z -o '[^/]*$')"
 
 #
 # TESTS