diff --git a/init b/init index 82a909e..d9b1f48 100755 --- a/init +++ b/init @@ -17,19 +17,19 @@ # You should have received a copy of the GNU Public License along with # this source code; if not, write to: # Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -DIR=`dirname $0` -CMD=`basename $0` -{ test -r $DIR } || { - echo "error: launch webnomad commands from your project directory" - echo "i.e: ./$DIR/$CMD" - return 1 -} +SYS=`dirname $0` +source $SYS/utils -source $DIR/utils +act "Initializing $B $DIR $r" +pushd $DIR + +act "Below is the log of files copied into this directory." +act "Init does not rewrite any existing file" +act + mkdir -p views/js mkdir -p views/css { test -r views/index.html } || { @@ -49,24 +49,24 @@ EOF mkdir -p tmpl { test -r tmpl/header.html } || { - cp -v ${DIR}/tmpl/header.html tmpl } + cp -v ${SYS}/tmpl/header.html tmpl } { test -r tmpl/footer.html } || { - cp -v ${DIR}/tmpl/footer.html tmpl } + cp -v ${SYS}/tmpl/footer.html tmpl } { test -r tmpl/navbar.html } || { - cp -v ${DIR}/tmpl/navbar.html tmpl } + cp -v ${SYS}/tmpl/navbar.html tmpl } { test -r views/js/html5.js } || { - cp -v ${DIR}/js/html5.js views/js } + cp -v ${SYS}/js/html5.js views/js } { test -r views/css/bootstrap.css } || { - cp -v ${DIR}/js/bootstrap* views/js - cp -v ${DIR}/css/bootstrap* views/css } + cp -v ${SYS}/js/bootstrap* views/js + cp -v ${SYS}/css/bootstrap* views/css } { test -r views/css/blueimp-gallery.css } || { - cp -v ${DIR}/js/*blueimp* views/js - cp -v ${DIR}/css/*blueimp* views/css } + cp -v ${SYS}/js/*blueimp* views/js + cp -v ${SYS}/css/*blueimp* views/css } { test -r config.zsh } || { cat < config.zsh @@ -78,7 +78,12 @@ EOF } -notice "Website initialized" -act "Now customize config.zsh and files in tmpl/" -act "then create your pages in views/" +popd +act +notice "Initialization completed" +act "Look in your new WebNomad project: $B $DIR $r" +act "Customize $B config.zsh $r and then files in the $B tmpl/ $r folder" +act "Create new HTML pages in $B views/ $r" + +{ test "$DIR" = "." } || { sleep 10 } \ No newline at end of file diff --git a/render b/render index d8ee3ae..4c40553 100755 --- a/render +++ b/render @@ -18,18 +18,13 @@ # this source code; if not, write to: # Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -DIR=`dirname $0` -CMD=`basename $0` -{ test -r $DIR } || { - echo "error: launch webnomad commands from your project directory" - echo "i.e: ./$DIR/$CMD" - return 1 -} +SYS=`dirname $0` +source $SYS/utils + -source ${DIR}/utils { test -r config.zsh } || { - error "Directory not configured for WebNomad. First use ./webnomad/init" + error "Directory not configured for WebNomad. First use /webnomad/init" exit 1 } @@ -37,8 +32,8 @@ source ${DIR}/utils source config.zsh -notice "Rendering $BRAND website" -act "Title: $TITLE" +notice "Rendering $B $BRAND $r website" +act "Title: $B $TITLE $r" typeset -a includejs @@ -116,10 +111,11 @@ render_html() { # first pass marks the markdown parts and saves them separate mds=(`find . -name 'tmp.md*'`) - act -n "${#mds} markdown fields " - - { test ${#mds} = 0 } || { + { test "${#mds}" = "0" } || { # second pass substituted saved parts with rendered markdown + act -n "${#mds} markdown fields " + + for i in $mds; do md=`basename $i` @@ -314,7 +310,7 @@ EOF EOF # render html - act -n "Html rendering: $dst " + act -n "Html rendering: $B $dst $r" cat $src | render_html >> $dst cat <> $dst @@ -336,13 +332,13 @@ gals=(`find views -type f -name '*.gal'`) for src in $gals; do cat ${src} | read_meta dst="pub/`basename ${src%.*}`" - act -n "Gallery rendering: $dst ... " + act -n "Gallery rendering: $B $dst $r ... " cat $src | render_gallery > $dst print "done" done for m in `find views -mindepth 1 -type d `; do - act -n "publishing $m... " + act -n "publishing $B $m $r ... " rsync -r $m pub/ print "done" done @@ -359,4 +355,6 @@ done } -act "Website refreshed." +notice "Website refreshed." + +{ test "$DIR" = "." } || { sleep 10 } \ No newline at end of file diff --git a/utils b/utils index aab204c..5da558d 100755 --- a/utils +++ b/utils @@ -18,10 +18,16 @@ # this source code; if not, write to: # Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -VERSION=0.2 +# initialize paths +DIR=`dirname $SYS` # project dir + + +VERSION=0.3 QUIET=0 +autoload colors; colors + # standard output message routines # it's always useful to wrap them, in case we change behaviour later notice() { if [[ $QUIET == 0 ]]; then print "$fg_bold[green][*]$fg_no_bold[default] $1" >&2; fi } @@ -37,6 +43,10 @@ act() { fi } +# quick bold +B="$fg_bold[white]" +r="$reset_color" + # honor quiet and debug flags as early as possible if [[ ${@} == *-q* ]]; then QUIET=1; fi if [[ ${@} == *-D* ]]; then DEBUG=1; fi