forked from SquareBracketAssociates/EnterprisePharo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Script to push the generated files to a server
- Loading branch information
1 parent
f92dc96
commit bf855f0
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |