Skip to content

Commit

Permalink
Update to use separate HTML template project for look and feel
Browse files Browse the repository at this point in the history
See sonatype#142
And https://issues.sonatype.org/browse/NXBOOK-913

Squashed commit of the following:

commit 7c1af13
Author: Manfred Moser <[email protected]>
Date:   Thu Mar 10 09:22:35 2016 -0800

    - added usage of env variable for local deployment path
    - synced with iq server assemble script in terms of usage of variables for templateScript and docProperties

commit bffb13e
Author: Manfred Moser <[email protected]>
Date:   Thu Mar 3 11:14:57 2016 -0800

    removed 2.13 links since its not happening yet

commit 903862b
Author: Manfred Moser <[email protected]>
Date:   Wed Mar 2 16:56:39 2016 -0800

    added property for search URL

commit b3723f0
Author: Manfred Moser <[email protected]>
Date:   Wed Mar 2 11:15:08 2016 -0800

    fixed relative depth of links from index page

commit f170499
Author: Manfred Moser <[email protected]>
Date:   Tue Mar 1 14:38:58 2016 -0800

    fixed include for properties

commit d462198
Author: Manfred Moser <[email protected]>
Date:   Tue Mar 1 12:44:15 2016 -0800

    rebranded index page and added links for 2.12 and 2.13

commit 49b41df
Author: Manfred Moser <[email protected]>
Date:   Tue Mar 1 10:22:38 2016 -0800

    added index publishing

commit 75941bb
Author: Manfred Moser <[email protected]>
Date:   Tue Mar 1 10:01:53 2016 -0800

    script to deploy on local machine emulating production deployment

commit 4928a95
Author: Manfred Moser <[email protected]>
Date:   Mon Feb 29 16:18:27 2016 -0800

    usage of properties file with more properties and simplified prop names

commit 3851221
Author: Manfred Moser <[email protected]>
Date:   Mon Feb 29 12:35:01 2016 -0800

    updated assemble script to use wrapper, nealry complete, NXBOOK-913

commit 740a4e7
Author: Manfred Moser <[email protected]>
Date:   Mon Feb 29 12:20:26 2016 -0800

    removed site stuff that is now in shared repo, NXBOOK-913
  • Loading branch information
mosabua committed Mar 10, 2016
1 parent 6279755 commit 29fed37
Show file tree
Hide file tree
Showing 114 changed files with 147 additions and 8,271 deletions.
Binary file removed airspeed/__init__.pyc
Binary file not shown.
43 changes: 0 additions & 43 deletions airspeed/api.py

This file was deleted.

79 changes: 51 additions & 28 deletions assemble.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
#!/bin/bash

# assemble.sh processes the output files created by build.sh and prepares
# the folders target/site and target/archive for rsync runs to
# staging and production

# see build.sh
# see deploy-to-prodcution.sh
# see deploy-to-staging.sh
# see deploy-locally.sh

# fail if anything errors
set -e
# fail if a function call is missing an argument
set -u

# load properties to be able to use them in here
source nexus-book.properties
dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
echo "Processing in ${dir}"

echo "nexus_version set to $nexus_version"
templateScript=../nexus-documentation-wrapper/apply-template.sh
docProperties=$dir/nexus-book.properties
source $docProperties

echo "Nexus Repository Manager Version $version"

if [ $publish_master == "true" ]; then
echo "Preparing for master deployment"
Expand All @@ -20,39 +33,49 @@ if [ $publish_master == "true" ]; then
mkdir -p target/site/other
fi

echo "Preparing for version $nexus_version deployment"
rm -rf target/site/$nexus_version/reference
rm -rf target/site/$nexus_version/pdf
rm -rf target/site/$nexus_version/other
mkdir -p target/site/$nexus_version/reference
mkdir -p target/site/$nexus_version/pdf
mkdir -p target/site/$nexus_version/other
echo "Preparing for version $version deployment"
rm -rf target/site/$version/reference
rm -rf target/site/$version/pdf
rm -rf target/site/$version/other
mkdir -p target/site/$version/reference
mkdir -p target/site/$version/pdf
mkdir -p target/site/$version/other

if [ $publish_master == "true" ]; then
echo "Copying for master deployment"
cp -r target/book-nexus.chunked/* target/site/reference
mkdir -p target/site/reference/css
cp -r site/css target/site/reference
cp -r site/js target/site/reference
cp -r site/images target/site/reference
cp site/search.html target/site/reference
cp -r target/book-nexus.chunked/* target/site/reference
cp target/book-nexus.pdf target/site/pdf/nxbook-pdf.pdf
cp target/sonatype-nexus-eval-guide.pdf target/site/pdf/sonatype-nexus-eval-guide.pdf
cp target/book-nexus.epub target/site/other/nexus-book.epub
fi

echo "Copying for version $nexus_version deployment"
echo "Copying for version $version deployment"

# NOT copying the overall index into version specific directories since links would be broken and
# it is an overall index
cp -r target/book-nexus.chunked/* target/site/$version/reference
cp target/book-nexus.pdf target/site/$version/pdf/nxbook-pdf.pdf
cp target/sonatype-nexus-eval-guide.pdf target/site/$version/pdf/sonatype-nexus-eval-guide.pdf
cp target/book-nexus.epub target/site/$version/other/nexus-book.epub
if [ $publish_index == "true" ]; then
echo "Copying redirector"
cp -v site/global/index.html target/site/$version/
fi

cp -r target/book-nexus.chunked/* target/site/$nexus_version/reference
mkdir -p target/site/$nexus_version/reference/css
cp -r site/css target/site/$nexus_version/reference
cp -r site/js target/site/$nexus_version/reference
cp -r site/images target/site/$nexus_version/reference
cp site/search.html target/site/$nexus_version/reference
cp target/book-nexus.pdf target/site/$nexus_version/pdf/nxbook-pdf.pdf
cp target/sonatype-nexus-eval-guide.pdf target/site/$nexus_version/pdf/sonatype-nexus-eval-guide.pdf
cp target/book-nexus.epub target/site/$nexus_version/other/nexus-book.epub
if [ $publish_master == "true" ]; then
echo "Invoking templating process for master"
$templateScript ../nexus-book/target/site/reference $docProperties "block" "../../" "book"
fi

echo "Invoking templating process for $version "
$templateScript ../nexus-book/target/site/$version/reference $docProperties "block" "../../../" "book"

python template.py -p "target/site/reference" -t "../" -s "block" -v "$nexus_version"
python template.py -p "target/site/$nexus_version/reference" -t "../../" -s "block" -v "$nexus_version"
if [ $publish_index == "true" ]; then
echo "Preparing root index for deployment"
echo " Copying content and resources"
cp target/index.html target/site
echo "Invoking templating for index page"
$templateScript ../nexus-book/target/site/ $docProperties "none" "../" "article"
cp -rv site/global/sitemap*.xml target/site
echo "... done"
fi
49 changes: 49 additions & 0 deletions deploy-locally.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

# fail if anything errors
set -e
# fail if a function call is missing an argument
set -u

dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
# last folder needs to be nexus-book to reflect production setup
dest=$NEXUS_DOCUMENTATION/nexus-book
mkdir -p $dest

# load properties to be able to use them in here
source nexus-book.properties
echo "version set to $version"

function rsyncToDest {
source=$1
target=$dest/$2
options=$3
echo "Syncing $1 to $2 "
mkdir -p $target
rsync $options -av target/$source $target
}

if [ $publish_master == "true" ]; then
rsyncToDest site/reference/ reference --delete
rsyncToDest site/pdf/ pdf --delete
rsyncToDest site/other/ other --delete
fi

rsyncToDest site/$version/reference/ $version/reference --delete
rsyncToDest site/$version/pdf/ $version/pdf --delete
rsyncToDest site/$version/other/ $version/other --delete
rsyncToDest site/$version/index.html $version --delete

if [ $publish_index == "true" ]; then
rsyncToDest site/index.html "" --delete
rsyncToDest site/sitemap.xml "" --delete
rsyncToDest site/sitemap-nexus-2.xml "" --delete
rsyncToDest site/sitemap-nexus-3.xml "" --delete
rsyncToDest site/js/ js --delete
rsyncToDest site/images/ images --delete
rsyncToDest site/css/ css --delete
rsyncToDest site/sitemap.xml "" --delete
fi



19 changes: 15 additions & 4 deletions deploy-to-production.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -u
# load properties to be able to use them in here
source nexus-book.properties

echo "nexus_version set to $nexus_version"
echo "version set to $version"

# can we get rid of this?
./assemble.sh
Expand All @@ -29,9 +29,20 @@ if [ $publish_master == "true" ]; then
rsyncToProduction site/other/ other --delete
fi

rsyncToProduction site/$nexus_version/reference/ $nexus_version/reference --delete
rsyncToProduction site/$nexus_version/pdf/ $nexus_version/pdf --delete
rsyncToProduction site/$nexus_version/other/ $nexus_version/other --delete
if [ $publish_index == "true" ]; then
rsyncToDest site/index.html "" --delete
rsyncToDest site/sitemap.xml "" --delete
rsyncToDest site/sitemap-nexus-2.xml "" --delete
rsyncToDest site/sitemap-nexus-3.xml "" --delete
rsyncToDest site/js/ js --delete
rsyncToDest site/images/ images --delete
rsyncToDest site/css/ css --delete
fi

rsyncToDest site/$version/reference/ $version/reference --delete
rsyncToDest site/$version/pdf/ $version/pdf --delete
rsyncToDest site/$version/other/ $version/other --delete
rsyncToDest site/$version/index.html $version --delete

# Important to use separate rsync run WITHOUT --delete since its an archive! and we do NOT want old archives to be deleted
#rsyncToProduction archive/ archive
Expand Down
20 changes: 16 additions & 4 deletions deploy-to-staging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -u
# load properties to be able to use them in here
source nexus-book.properties

echo "nexus_version set to $nexus_version"
echo "version set to $version"

# can we get rid of this?
./assemble.sh
Expand All @@ -29,9 +29,21 @@ if [ $publish_master == "true" ]; then
rsyncToStage site/other/ other --delete
fi

rsyncToStage site/$nexus_version/reference/ $nexus_version/reference --delete
rsyncToStage site/$nexus_version/pdf/ $nexus_version/pdf --delete
rsyncToStage site/$nexus_version/other/ $nexus_version/other --delete
rsyncToDest site/$version/reference/ $version/reference --delete
rsyncToDest site/$version/pdf/ $version/pdf --delete
rsyncToDest site/$version/other/ $version/other --delete
rsyncToDest site/$version/index.html $version --delete

if [ $publish_index == "true" ]; then
rsyncToDest site/index.html "" --delete
rsyncToDest site/sitemap.xml "" --delete
rsyncToDest site/sitemap-nexus-2.xml "" --delete
rsyncToDest site/sitemap-nexus-3.xml "" --delete
rsyncToDest site/js/ js --delete
rsyncToDest site/images/ images --delete
rsyncToDest site/css/ css --delete
rsyncToDest site/sitemap.xml "" --delete
fi

# Important to use separate rsync run WITHOUT --delete since its an archive! and we do NOT want old archives to be deleted
#rsyncToStage archive/ archive
Expand Down
16 changes: 15 additions & 1 deletion nexus-book.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
# The version determines the path on the server under which the book content
# will be made available - e.g. http://books.sonatype.com/nexus-book/2.8/reference/index.html
nexus_version=2.12
version=2.12

# If set to "true" the documentation will in addition be made available in the master
# location at http://books.sonatype.com/nexus-book/reference/index.html
publish_master=true

publish_index=false

product="Nexus Repository Manager"

# TBD chnage to "Nexus Repository Manager Documentation"
bookTitle="Repository Management with Nexus"

googleSearchToken="011059148005191787079:jycarnaj42w"

# version has to be same as above,
#searchUrl="http://books.sonatype.com/nexus-book/3.0/reference/"
# and for publish_master true URL has to be
searchUrl="http://books.sonatype.com/nexus-book/reference/"
2 changes: 1 addition & 1 deletion package-eval-guide.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# zip up eval guide for easy download into neus-bundles
# zip up eval guide for easy download into nexus-bundles

cd target/
zip -r sonatype-nexus-eval-guide.zip sonatype-nexus-eval-guide.*
Expand Down
90 changes: 0 additions & 90 deletions site/book-template.html

This file was deleted.

Loading

0 comments on commit 29fed37

Please sign in to comment.