diff --git dev-support/publish_hbase_website.sh dev-support/publish_hbase_website.sh new file mode 100755 index 0000000..f87cb7f --- /dev/null +++ dev-support/publish_hbase_website.sh @@ -0,0 +1,190 @@ +#!/bin/bash + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +USAGE="Usage: $0 [-i | -a] [-g ] [-s ]\n \ +-h Show this message\n \ +-i Prompts the user for input\n \ +-a Does not prompt the user. Potentially dangerous.\n \ +-g The local location of the HBase git repository\n \ +-s The local location of the HBase svn checkout\n \ +Either -i or -a is required. \n \ +Edit the script to set default Git and SVN directories." + +if [ "$#" == "0" ]; then + echo -e "$USAGE" + exit 1 +fi + +# Process args +INTERACTIVE= +AUTO= +GIT_DIR= +SVN_DIR= +while getopts "hiag:s:" OPTION +do + case $OPTION in + h) + echo -e "$USAGE" + exit + ;; + i) + INTERACTIVE=1 + ;; + a) + # We don't actually use this variable but require it to be + # set explicitly because it will commit changes without asking + AUTO=1 + ;; + g) + GIT_DIR=$OPTARG + ;; + s) + SVN_DIR=$OPTARG + ;; + esac +done + +if [ $INTERACTIVE ] && [ $AUTO ]; then + echo "Only one of -i or -a can be used." + echo -e $USAGE + exit 1 +fi + +# Set GIT_DIR and SVN_DIR to defaults if not given +if [ ! $GIT_DIR ]; then + GIT_DIR=~/git/hbase +fi +if [ ! $SVN_DIR ]; then + SVN_DIR=~/svn/hbase.apache.org/trunk +fi + +# Check that GIT_DIR and SVN_DIR exist +if [ ! -d $GIT_DIR -o ! -d $SVN_DIR ]; then + echo "Both the GIT and SVN directories must exist." + echo -e $USAGE + exit 1 +fi + +cd $GIT_DIR + +# Get the latest +echo "Updating Git" +git checkout master +git pull + +# Generate the site to ~/git/hbase/target/stage +if [ $INTERACTIVE ]; then + read -p "Build the site? (y/n)" yn + case $yn in + [Yy]* ) + mvn clean javadoc:aggregate site site:stage -DskipTests + ;; + [Nn]* ) + echo "Not building the site." + ;; + esac +else + echo "Building the site in auto mode." + mvn clean javadoc:aggregate site site:stage -DskipTests +fi + + +# Refresh the local copy of the live website +echo "Updating Subversion..." +cd $SVN_DIR +# Be aware that this will restore all the files deleted a few lines down +# if you are debugging this script +# and need to run it multiple times without svn committing +svn update > /dev/null + +# Make a list of things that are in SVN but not the generated site +# and not auto-generated +# -- we might need to delete these +echo "The following directories might be stale:" +find . -type d ! -path '*0.94*' ! -path '*apidocs*' \ + ! -path '*xref*' ! -path '*book*' \ + -exec ls $GIT_DIR/target/staging/{} \; |grep 'No such' +echo "The following files might be stale:" +find . -type f ! -path '*0.94*' ! -path '*apidocs*' \ + ! -path '*xref*' ! -path '*book*' ! -name '*.svg' \ + -exec ls $GIT_DIR/target/staging/{} \; |grep 'No such' + +if [ $INTERACTIVE ]; then + read -p "Exit to take care of them? (y/n)" yn + case $yn in + [Yy]* ) + exit + ;; + [Nn]* ) + ;; + * ) echo "Please answer yes or no.";; + esac +else + echo "Not taking care of stale directories and files in auto mode." +fi + +# Delete known auto-generated content from trunk +echo "Deleting known auto-generated content from SVN" +rm -rf apidocs devapidocs xref xref-test book book.html java.html + +# Copy generated site to svn -- change to cp -au if on GNU +echo "Copying the generated site to SVN" +cp -r $GIT_DIR/target/site/* . + +# Look for things we need to fix up in svn + +echo "Untracked files: svn add" +svn status |grep '?' |sed -e "s/[[:space:]]//g"|cut -d '?' -f 2|while read i + do svn add $i +done + +echo "Locally deleted files: svn del" +svn status |grep '!' |sed -e "s/[[:space:]]//g"|cut -d '!' -f 2|while read i + do svn del $i +done + +# Display the proposed changes. I filtered out +# modified because there are so many. +if [ $INTERACTIVE ]; then + svn status |grep -v '^M'|less -P "Enter 'q' to exit the list." +else + echo "The following changes will be made to SVN." + svn status +fi + +if [ $INTERACTIVE ]; then + read -p "Commit changes? This will publish the website. (y/n)" yn + case $yn in + [Yy]* ) + svn commit -m "Published website" + exit + ;; + [Nn]* ) + read -p "Revert SVN changes? (y/n)" revert + case $revert in + [Yy]* ) + svn revert -R . + svn update + exit + ;; + [Nn]* ) + exit + ;; + esac + ;; + esac +else + svn commit -m "Published website using script in auto mode." +fi + diff --git src/main/docbkx/developer.xml src/main/docbkx/developer.xml index baf91a6..157ee7d 100644 --- src/main/docbkx/developer.xml +++ src/main/docbkx/developer.xml @@ -808,30 +808,24 @@ $ rsync -av 0.96.0RC0 people.apache.org:public_html >hbase.apache.org As of INFRA-5680 Migrate apache hbase website, to publish the website, build - it, and then deploy it over a checkout of - https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk. - Finally, check it in. For example, if trunk is checked out out at - /Users/stack/checkouts/trunk and the hbase website, - hbase.apache.org, is checked out at - /Users/stack/checkouts/hbase.apache.org/trunk, to update - the site, do the following: - -# Build the site and deploy it to the checked out directory -# Getting the javadoc into site is a little tricky. You have to build it before you invoke 'site'. -$ mvn clean install -DskipTests javadoc:aggregate site \ - site:stage -DstagingDirectory=/Users/stack/checkouts/hbase.apache.org/trunk - - Now check the deployed site by viewing in a brower, browse to - file:////Users/stack/checkouts/hbase.apache.org/trunk/index.html and check all is - good. If all checks out, commit it and your new build will show up immediately at - http://hbase.apache.org. - -$ cd /Users/stack/checkouts/hbase.apache.org/trunk -$ svn status -# Do an svn add of any new content... -$ svn add .... -$ svn commit -m 'Committing latest version of website...' - + it using Maven, and then deploy it over a checkout of + https://svn.apache.org/repos/asf/hbase/hbase.apache.org/trunk + and check in your changes. The script + dev-scripts/publish_hbase_website.sh is provided to + automate this process and to be sure that stale files are removed from SVN. Review + the script even if you decide to publish the website manually. Use the script as + follows: + $ publish_hbase_website.sh -h +] [-s ]]]> + -h Show this message + -i Prompts the user for input + -a Does not prompt the user. Potentially dangerous. + -g The local location of the HBase git repository + -s The local location of the HBase svn checkout + Either --interactive or --silent is required. + Edit the script to set default Git and SVN directories. + + The SVN commit takes a long time.