Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Pinoco project initializer
#!/bin/sh
PINOCO_VER="0.5.2"
PINOCO_URL_BASE="https://github.com/downloads/tanakahisateru/pinoco"
PHPTAL_VER="1.2.2"
PHPTAL_URL_BASE="http://phptal.org/files"
if [ ! -d _download ]; then
mkdir _download
curl -o _download/empty-project.tgz -L ${PINOCO_URL_BASE}/empty-project.tgz
fi
if [ ! -f _download/pinoco.tgz ]; then
curl -o _download/pinoco.tgz -L ${PINOCO_URL_BASE}/Pinoco-${PINOCO_VER}.tgz
fi
if [ ! -f _download/phptal.tar.gz ]; then
curl -o _download/phptal.tar.gz -L ${PHPTAL_URL_BASE}/PHPTAL-${PHPTAL_VER}.tar.gz
fi
if [ -f _gateway.php ]; then
rm _gateway.php
fi
if [ -f .htaccess ]; then
rm .htaccess
fi
if [ -d _app ]; then
rm -rf _app
fi
tar -xzf _download/empty-project.tgz
mv htdocs/.htaccess ./
sed -e s/Pinoco\.php/_app\\/lib\\/Pinoco.php/ \
-e s/\.\.\\/app/_app/ \
htdocs/_gateway.php > _gateway.php
rm -rf htdocs
mv app _app
rm _app/lib/install-info.txt
tar -xzf _download/pinoco.tgz
mv Pinoco-${PINOCO_VER}/Pinoco.php _app/lib/
mv Pinoco-${PINOCO_VER}/Pinoco _app/lib/
rm package.xml
rm -rf Pinoco-${PINOCO_VER}
tar -xzf _download/phptal.tar.gz
mv PHPTAL-${PHPTAL_VER}/PHPTAL.php _app/lib/
mv PHPTAL-${PHPTAL_VER}/PHPTAL _app/lib/
rm package.xml
rm -rf PHPTAL-${PHPTAL_VER}
if [ ! -f index.html ]; then
echo "<p>Hello <span tal:content=\"this/message | default\">World</span></p>" > index.html
fi
echo "Current directory was initialized with Pinoco-${PINOCO_VER} and PHPTAL-${PHPTAL_VER}."
echo "Enjoy!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment