Skip to content

Commit

Permalink
Script to push the generated files to a server
Browse files Browse the repository at this point in the history
  • Loading branch information
DamienCassou committed Jul 17, 2015
1 parent f92dc96 commit bf855f0
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions push-results-to-server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash

set -e

SERVER=files.pharo.org
BASEDIR=/appli/files.pharo.org/books/enterprisepharo/book
SERVER_USER=filepharosync
TMP_DIR='~cassou/enterprisepharo-book'

PILLAR_COMMAND="./pillar"

chapters=$($PILLAR_COMMAND show inputFiles 2>/dev/null)

ssh $SERVER sh <<EOF
sudo su --login --command "mkdir -p \"$BASEDIR\"" "$SERVER_USER"
rm -rf $TMP_DIR
mkdir $TMP_DIR
EOF

rm -rf to-push
mkdir -p to-push/html/figures
cp book-result/EnterprisePharo.pdf to-push/

# Push all css/js files
cp -R support/html/* to-push/html

# Push all .html chapters
for chapter in $chapters; do
html="${chapter%%.*}.html"

# Hack to change the references to support files (e.g., .css, .js)
sed 'sX../support/html/XX' $html > to-push/html/$(basename $html)

# copy the figures
cp -R $(dirname $html)/figures/* to-push/html/figures/ 2>/dev/null || true
done

cd to-push/html

cd ../..

echo Pushing all files to $SERVER
scp -r to-push $SERVER:$TMP_DIR

ssh $SERVER sh <<EOF
sudo su --login --command "cp -R $TMP_DIR/to-push/* $BASEDIR" filepharosync
EOF

0 comments on commit bf855f0

Please sign in to comment.