Newer
Older
env_option=${1:-2}
PL_PATH=${3:-"/var/www/html/web"}
DRUPAL_PATH=${4:-"/var/www/html"}
os_option=${5:-1}
Eric Bremner
committed
if [[ -L "$PL_PATH/uw_wcms_ohana" || -d "$PL_PATH/uw_wcms_ohana" ]]; then
echo ""
echo "*************************************************************************"
echo "Removing old ohana symlink ..."
rm -rf "$PL_PATH/uw_wcms_ohana"
echo "Done removing old ohana symlink."
echo "**************************************************************************"
echo ""
fi
cd "$DRUPAL_PATH/web/profiles/uw_base_profile/modules/custom/uw_wcms_ohana"
if [[ -d ohana ]]; then
echo "**************************************************************************************"
echo "Removing old ohana ..."
rm -rf ohana
echo "Done removing old ohana."
echo "**************************************************************************************"
echo ""
fi
git clone https://github.com/chazchumley/ohana.git
if [ "$?" != 0 ]; then
echo "Error: git clone failed"
exit 2;
fi
cd ohana
echo "**************************************************************************************"
echo "Installing correct npm version ..."
file=".nvmrc"
version=$(cat "$file")
export NVM_DIR=$HOME/.nvm;
source $NVM_DIR/nvm.sh;
nvm install $version
echo "**************************************************************************************"
echo "Done installing correct npm version."
Eric Bremner
committed
echo "**************************************************************************************"
echo "Setting up theming ..."
cd ..
if [[ -d dist ]]; then
rm -rf dist
fi
if [[ $build_option == 1 || $build_option == 3 ]]; then
Eric Bremner
committed
cd ohana
rm -rf src/patterns
ln -s ../../src/patterns src/patterns
echo "**************************************************************************************"
echo "Done setting up theming."
if [[ -d "$DRUPAL_PATH"/web/config/fonts ]]; then
echo "**************************************************************************************"
echo "Copying fonts ..."
cp "$DRUPAL_PATH"/web/config/fonts/* dist/fonts
echo "**************************************************************************************"
echo "Done copying fonts."
fi
echo "**************************************************************************************"
echo "Running npm install ..."
if [[ $os_option == 1 ]]; then
export CPPFLAGS="-DPNG_ARM_NEON_OPT=0"
fi
npm install
echo "**************************************************************************************"
echo "Done running npm install."
echo "**************************************************************************************"
echo "Setting up es lint and gulp ..."
rm .eslintignore
ln -s ../.eslintignore .eslintignore
cp ../dashboard.js gulp-tasks
sed -i "3 i const { compileDashboard } = require('./gulp-tasks/dashboard');" gulpfile.js
sed -i "s/parallel(compileSass, compileJS)/parallel(compileSass, compileJS, compileDashboard)/g" gulpfile.js
Eric Bremner
committed
cd gulp-tasks
sed -i "17 i '!./dist/css/*dashboard*.css'," concat.js
cd ..
echo "**************************************************************************************"
echo "Done setting up es lint."
echo "**************************************************************************************"
echo "Running npm run build ..."
npm run build
echo "**************************************************************************************"
echo "Done running npm run build."
echo "**************************************************************************************"
echo "Setting up pattern-lab ..."
mkdir core
cd core
ln -s "$DRUPAL_PATH"/web/core/assets assets
ln -s "$DRUPAL_PATH"/web/core/misc misc
cd ..
Eric Bremner
committed
cd src/styleguide/meta
Eric Bremner
committed
rm _foot.twig
Eric Bremner
committed
ln -s ../../../../styleguide/_foot.twig _foot.twig
cd ../../..
echo "**************************************************************************************"
echo "Done setting up pattern-lab."
if [[ $build_option == 2 || $build_option == 4 ]]; then
echo "**************************************************************************************"
echo "Setting up css/js and removing ohana ..."
Eric Bremner
committed
mv ohana/dist .
cd dist/css
find . -type f -not \( -name 'all.min.css' -or -name 'uw-dashboard.min.css' \) -delete
Eric Bremner
committed
cd ../js
find . -type f -not -name 'all.min.js' -delete
Eric Bremner
committed
cd ..
if [[ -d vendor ]]; then
rm -rf vendor
Eric Bremner
committed
cd "$DRUPAL_PATH"/web/profiles/uw_base_profile/modules/custom/uw_wcms_ohana/
rm -rf ohana
echo "**************************************************************************************"
echo "Done setting up css/js and removing ohana."
fi
Eric Bremner
committed
if [[ $env_option == 1 ]]; then
echo "**************************************************************************************"
echo "Creating symlink for ohana ..."
ln -s "$DRUPAL_PATH"/web/profiles/uw_base_profile/modules/custom/uw_wcms_ohana "$PL_PATH"/uw_wcms_ohana
echo "Done creating symlink for ohana."
echo "**************************************************************************************"
echo ""
fi