Created
November 3, 2013 21:38
-
-
Save craychee/7295149 to your computer and use it in GitHub Desktop.
Getting your local build policy into code.
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
| #!/usr/bin/env bash | |
| # Pass all arguments to drush | |
| while [ $# -gt 0 ]; do | |
| drush_flags="$drush_flags $1" | |
| shift | |
| done | |
| drush="drush $drush_flags" | |
| build_path=$(dirname "$0") | |
| drupal_path="/var/drupals/SITENAME/www" | |
| file_lock_path="$drupal_path/.file_lock" | |
| $drush sql-drop -y && | |
| $drush sqlc < $build_path/ref_db/SITE_db.sql -y | |
| cd ~ | |
| $drush dl registry_rebuild -y | |
| cd $drupal_path | |
| $drush rr | |
| echo "updatedb"; | |
| $drush updatedb -y | |
| echo "clear cache"; | |
| $drush cc all | |
| echo "Turn off caching"; | |
| $drush vset -y preprocess_css 0 && | |
| $drush vset -y preprocess_js 0 && | |
| echo "Enable Modules" && | |
| $drush en $(cat $build_path/mods_enabled | tr '\n' ' ') -y && | |
| echo "Disable Modules" && | |
| $drush dis $(cat $build_path/mods_purge | tr '\n' ' ') -y && | |
| echo "Uninstall Modules" && | |
| $drush pm-uninstall $(cat $build_path/mods_purge | tr '\n' ' ') -y && | |
| $drush cc all | |
| $drush updatedb -y | |
| $drush cc all | |
| if test ! -e $file_lock_path && ! grep "~/.drush/aliases.drushrc.php" $file_lock_path && ! grep "~/.ssh/id_rsa" $file_lock_path; then | |
| if [[ ! -d ~/.drush ]]; then | |
| mkdir ~/.drush | |
| fi | |
| cp "$build_path/aliases.drushrc.php" ~/.drush && | |
| cp "$build_path/id_rsa" ~/.ssh/id_rsa && | |
| chmod 600 ~/.ssh/id_rsa && | |
| echo "~/.drush/aliases.drushrc.php" >> $file_lock_path && | |
| echo "~/.ssh/id_rsa" >> $file_lock_path | |
| fi | |
| if (test ! -e $file_lock_path && ! grep "$drupal_path/sites/default/files" $file_lock_path) || (test -e $file_lock_path && ! grep "$drupal_path/sites/default/files" $file_lock_path); then | |
| rm -rf $drupal_path/sites/default/files && | |
| mkdir $drupal_path/sites/default/files && | |
| chmod -R 775 $drupal_path/sites/default/files && | |
| $drush rsync @SITE.prod:%files/ @self:$drupal_path/sites/default/files --delete && | |
| echo "$drupal_path/sites/default/files" >> $file_lock_path | |
| fi | |
| echo "Revert Features" && | |
| $drush fra -y && | |
| $drush cc all | |
| drush fra -y && | |
| $drush cc all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment