Skip to content

Instantly share code, notes, and snippets.

@mdrmike
Last active December 9, 2016 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdrmike/85116450398185dc13876ef7ea4b55e2 to your computer and use it in GitHub Desktop.
Save mdrmike/85116450398185dc13876ef7ea4b55e2 to your computer and use it in GitHub Desktop.
#!/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