You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2014/12/17 18:24:03 UTC

[29/50] [abbrv] incubator-brooklyn git commit: add `--install` option and updated README, so website is automatically installed to svn staging area

add `--install` option and updated README, so website is automatically installed to svn staging area


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/be3bdd7b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/be3bdd7b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/be3bdd7b

Branch: refs/heads/master
Commit: be3bdd7b6e68e24d269e6a4c87a2bed255c5683e
Parents: d6cfde4
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Tue Dec 16 19:58:14 2014 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Wed Dec 17 02:02:57 2014 +0000

----------------------------------------------------------------------
 docs/README.md       | 24 +++++++-----------------
 docs/_build/build.sh | 44 ++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 47 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/be3bdd7b/docs/README.md
----------------------------------------------------------------------
diff --git a/docs/README.md b/docs/README.md
index 9a0aad4..b7ab49b 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -170,15 +170,15 @@ from the Apache subversion repository. We recommend setting this up as a sibling
 `incubator-brooklyn` git project directory:
 
     # verify we're in the right location and the site does not already exist
-    ls _build/build.sh || { echo "ERROR: you should be in the docs/ directory to run this command" ; exit 1 }
-    ls ../../incubator-brooklyn-site-public && { echo "ERROR: incubator-brooklyn-site-public dir already exists ; exit 1 }
-    pushd ../..
+    ls _build/build.sh || { echo "ERROR: you should be in the docs/ directory to run this command" ; exit 1 ; }
+    ls ../../incubator-brooklyn-site-public > /dev/null && { echo "ERROR: incubator-brooklyn-site-public dir already exists" ; exit 1 ; }
+    pushd `pwd -P`/../..
     
-    svn co https://svn.apache.org/repos/asf/incubator/brooklyn/site incubator-brooklyn-site-public
+    svn --non-interactive --trust-server-cert co https://svn.apache.org/repos/asf/incubator/brooklyn/site incubator-brooklyn-site-public
     
     # verify it
     cd incubator-brooklyn-site-public
-    ls style/css/website.css || { echo "ERROR: checkout is wrong" ; exit 1 }
+    ls style/img/apache-brooklyn-logo-244px-wide.png || { echo "ERROR: checkout is wrong" ; exit 1 ; }
     export BROOKLYN_SITE_DIR=`pwd`
     popd
     echo "SUCCESS: checked out site in $BROOKLYN_SITE_DIR"
@@ -188,10 +188,8 @@ with the `--install` option.  (This assumes the relative structure described abo
 structure, set BROOKLYN_SITE_DIR to point to the directory as above.  Alternatively you can copy files manually,
 using the instructions in `build.sh` as a guide.)
 
-**TODO: the `--install` option below is not yet implemented**
-
 A typical update consists of the following commands (or a subset),
-copied to `${BROOKLYN_SITE_DIR:../../incubator-brooklyn-site-public}`:
+copied to `${BROOKLYN_SITE_DIR-../../incubator-brooklyn-site-public}`:
 
     # main website, relative to / 
     _build/build.sh website-root --install
@@ -205,18 +203,10 @@ copied to `${BROOKLYN_SITE_DIR:../../incubator-brooklyn-site-public}`:
 Next it is recommended to go to the SVN dir and 
 review the changes using the usual `svn` commands -- `status`, `diff`, `add`, `rm`, etc:
 
-    cd ${BROOKLYN_SITE_DIR:../../incubator-brooklyn-site-public}
+    cd ${BROOKLYN_SITE_DIR-../../incubator-brooklyn-site-public}
 
 You must then check in the changes:
 
     svn ci -m 'Update Brooklyn website'
 
 The changes should become live within a few minutes.
-
-
-<!-- OLD notes:
-
-Synchronise the generated site into the Subversion working copy - please amend this command to include the correct paths for your setup:
-
-    rsync -rv --delete --exclude .svn --exclude v ~/incubator-brooklyn-site/_site/ ~/incubator-brooklyn-site-public
--->
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/be3bdd7b/docs/_build/build.sh
----------------------------------------------------------------------
diff --git a/docs/_build/build.sh b/docs/_build/build.sh
index ac10b73..66b50e4 100755
--- a/docs/_build/build.sh
+++ b/docs/_build/build.sh
@@ -23,6 +23,7 @@ function help() {
   echo "and supported ARGS are:"
   echo "* --skip-javadoc : to skip javadoc build"
   echo "* --serve : serve files from _site after building (for testing)"
+  echo "* --install : install files from _site to the appropriate place in "'$'"BROOKLYN_SITE_DIR (or ../../incubator-brooklyn-site-public)"
   echo 'with any remaining ARGS passed to jekyll as `jekyll build --config ... ARGS`.'
 }
 
@@ -36,6 +37,8 @@ function parse_command() {
     DIRS_TO_MOVE[0]=website
     DIRS_TO_MOVE_TARGET[0]=""
     SKIP_JAVADOC=true
+    INSTALL_RSYNC_OPTIONS="--exclude v"
+    INSTALL_RSYNC_SUBDIR=""
     SUMMARY="website files in the root"
     ;;
   guide-latest)
@@ -44,6 +47,8 @@ function parse_command() {
     DIRS_TO_MOVE_TARGET[0]=v/latest
     DIRS_TO_MOVE[1]=style
     DIRS_TO_MOVE_TARGET[1]=v/latest/style
+    INSTALL_RSYNC_OPTIONS=""
+    INSTALL_RSYNC_SUBDIR=${DIRS_TO_MOVE_TARGET[0]}/
     JAVADOC_TARGET=_site/${DIRS_TO_MOVE_TARGET[0]}/use/api/
     SUMMARY="user guide files in /${DIRS_TO_MOVE_TARGET[0]}"
     ;;
@@ -55,6 +60,8 @@ function parse_command() {
     DIRS_TO_MOVE_TARGET[0]=v/0.7.0-SNAPSHOT
     DIRS_TO_MOVE[1]=style
     DIRS_TO_MOVE_TARGET[1]=${DIRS_TO_MOVE_TARGET[0]}/style
+    INSTALL_RSYNC_OPTIONS=""
+    INSTALL_RSYNC_SUBDIR=${DIRS_TO_MOVE_TARGET[0]}/
     JAVADOC_TARGET=_site/${DIRS_TO_MOVE_TARGET[0]}/use/api/
     SUMMARY="user guide files in /${DIRS_TO_MOVE_TARGET[0]}"
     ;;
@@ -96,17 +103,22 @@ function parse_command() {
     echo "ERROR: invalid argument '$1'; try 'help'"
     exit 1 ;;
   esac
+  SUMMARY="$SUMMARY of `pwd`/_site"
 }
 
 function parse_arguments() {
   while (( "$#" )); do
     case $1 in
+    "--skip-javadoc")
+      SKIP_JAVADOC=true
+      shift
+      ;;
     "--serve")
       SERVE_AFTERWARDS=true
       shift
       ;;
-    "--skip-javadoc")
-      SKIP_JAVADOC=true
+    "--install")
+      INSTALL_AFTERWARDS=true
       shift
       ;;
     "--")
@@ -151,6 +163,24 @@ function make_javadoc() {
   fi
 }
 
+function make_install() {
+  if [ "$INSTALL_AFTERWARDS" != "true" ]; then
+    return
+  fi
+  SITE_DIR=${BROOKLYN_SITE_DIR-../../incubator-brooklyn-site-public}
+  ls $SITE_DIR/style/img/apache-brooklyn-logo-244px-wide.png > /dev/null || { echo "ERROR: cannot find incubator-brooklyn-site-public; set BROOKLYN_SITE_DIR" ; return 1 ; }
+  if [ -z ${INSTALL_RSYNC_OPTIONS+SET} ]; then echo "ERROR: --install not supported for this build" ; return 1 ; fi
+  if [ -z ${INSTALL_RSYNC_SUBDIR+SET} ]; then echo "ERROR: --install not supported for this build" ; return 1 ; fi
+  
+  RSYNC_COMMAND_BASE="rsync -rvi --delete --exclude .svn"
+  RSYNC_COMMAND="$RSYNC_COMMAND_BASE $INSTALL_RSYNC_OPTIONS ./_site/$INSTALL_RSYNC_SUBDIR $SITE_DIR/$INSTALL_RSYNC_SUBDIR"
+  echo INSTALLING to local site svn repo with: $RSYNC_COMMAND
+  $RSYNC_COMMAND || return 1
+  
+  SUMMARY="$SUMMARY, installed to $SITE_DIR"
+}
+
+
 rm -rf _site
 
 parse_command $@
@@ -163,8 +193,14 @@ make_javadoc || { echo ERROR: failed javadoc build ; exit 1 ; }
 
 # TODO build catalog
 
-echo FINISHED: $SUMMARY of `pwd`/_site 
+# TODO install
+
+if [ "$INSTALL_AFTERWARDS" == "true" ]; then
+  make_install || { echo ERROR: failed to install ; exit 1 ; }
+fi
+
+echo FINISHED: $SUMMARY 
 
-if [ $SERVE_AFTERWARDS == "true" ]; then
+if [ "$SERVE_AFTERWARDS" == "true" ]; then
   _build/serve-site.sh
 fi