Created
November 8, 2015 16:39
-
-
Save zanardigit/84f0bd8f2948c57d6d2d to your computer and use it in GitHub Desktop.
Script to build epub from Symfony docs repos
This file contains hidden or 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
#!/bin/bash | |
# | |
# apt-get install git | |
# apt-get install python-sphinx | |
# | |
# This script assumes you have am existing clone of each repo in $home_dir | |
home_dir=/home/zanardi | |
web_dir=/var/www/symfonyepub | |
################# | |
### FUNCTIONS ### | |
################# | |
# Function: build EN e-book from the given branch | |
function build_en_book { | |
BRANCH=$1 | |
echo ">>> BUILDING EN $BRANCH" | |
git checkout $BRANCH | |
git pull | |
make epub | |
mv $home_dir/symfony-docs/_build/epub/SymfonyFrameworkDocumentation.epub $web_dir/SymfonyFrameworkDocumentation_${BRANCH}.en.epub | |
} | |
# Function: build FR e-book from the given branch | |
function build_fr_book { | |
BRANCH=$1 | |
echo ">>> BUILDING FR $BRANCH" | |
git checkout $BRANCH | |
git pull | |
cp $home_dir/symfony-docs/Makefile $home_dir/symfony-docs-fr | |
make epub | |
rm /$home_dir/symfony-docs-fr/Makefile | |
mv $home_dir/symfony-docs-fr/_build/epub/DocumentationduFrameworkSymfony2.epub $web_dir/SymfonyFrameworkDocumentation_${BRANCH}.fr.epub | |
} | |
# Function build CMF e-book from the given branch | |
function build_cmf_book { | |
BRANCH=$1 | |
echo ">>> BUILDING CMF $BRANCH" | |
git checkout $BRANCH | |
git pull | |
make epub | |
mv $home_dir/symfony-cmf-docs/_build/epub/SymfonyCMF.epub $web_dir/SymfonyCMF_${BRANCH}.en.epub | |
} | |
############ | |
### MAIN ### | |
############ | |
# update Sphinx | |
echo ">>> UPDATE SPHINX-PHP" | |
cd $home_dir/sphinx-php | |
git checkout master | |
git pull | |
# sync Sphinx extensions to docs repos | |
rsync -au $home_dir/sphinx-php/sensio/ $home_dir/symfony-docs/_theme/_exts/sensio | |
rsync -au $home_dir/sphinx-php/sensio/ $home_dir/symfony-docs-fr/_theme/_exts/sensio | |
rsync -au $home_dir/sphinx-php/sensio/ $home_dir/symfony-cmf-docs/_theme/_exts/sensio | |
# build english docs | |
cd $home_dir/symfony-docs | |
build_en_book 2.3 | |
build_en_book 2.7 | |
build_en_book 2.8 | |
build_en_book master | |
# build french docs | |
cd $home_dir/symfony-docs-fr | |
build_fr_book 2.3 | |
build_fr_book 2.7 | |
build_fr_book 2.8 | |
build_fr_book master | |
# build CMF docs | |
cd $home_dir/symfony-cmf-docs | |
build_cmf_book master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment