Last active
December 9, 2016 23:49
-
-
Save mdrmike/85116450398185dc13876ef7ea4b55e2 to your computer and use it in GitHub Desktop.
Install paternlab on c9 (or similar ubuntu environment) || run: wget -O - 'https://gist.github.com/mdrmike/85116450398185dc13876ef7ea4b55e2/raw/deb646cbceec5f894d8607b07275b85998db53cd/setup-patternlab.sh' | bash
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 | |
# DO NOT RUN AS ROOT | |
# Customize to your liking, or run as-is | |
PL_PRJNAME="my-patternlab/" | |
C9_WORKSPACE="workspace/" | |
function install_composer { | |
EXPECTED_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig) | |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');") | |
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ] | |
then | |
>&2 echo 'ERROR: Invalid composer installer signature in Function install_composer. Exiting.' | |
rm composer-setup.php | |
exit 1 | |
fi | |
php composer-setup.php --quiet | |
RESULT=$? | |
#echo "Setup Result: $RESULT" | |
rm composer-setup.php | |
#echo "rm Result: $?" | |
# INSTALL GLOBALLY | |
# PER | |
# https://getcomposer.org/doc/00-intro.md#globally | |
echo 'mv composer.phar /usr/local/bin/composer' | exec sudo bash | |
} | |
# Install dependencies | |
install_composer | |
# Setup project | |
cd $HOME | |
echo "$HOME" | |
echo "running: composer create-project --no-interaction -- pattern-lab/edition-twig-standard ${C9_WORKSPACE}${PL_PRJNAME}" | |
composer create-project --no-interaction -- pattern-lab/edition-twig-standard ~/${C9_WORKSPACE}${PL_PRJNAME} | |
RESULT=$? | |
if [ ! $RESULT ]; then | |
echo "Failed to create ${C9_WORKSPACE}${PL_PRJNAME} project: $RESULT" | |
fi | |
cd ~/${C9_WORKSPACE}${PL_PRJNAME} | |
echo "Creating demo site: php core/console --starterkit --install pattern-lab/starterkit-twig-demo" | |
php core/console --starterkit --install pattern-lab/starterkit-twig-demo | |
php core/console --generate | |
echo "Done. To access 'Pattern Lab' demo, browse: | |
https://${C9_HOSTNAME}/${PL_PRJNAME}public/" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment