Skip to content

Instantly share code, notes, and snippets.

@sergiitk
Created December 25, 2013 10:11
Show Gist options
  • Save sergiitk/8121921 to your computer and use it in GitHub Desktop.
Save sergiitk/8121921 to your computer and use it in GitHub Desktop.
Drupal Cookbook

Drupal Cookbook

Upgrade

  • Remove all files from working directory — _ rm -rf ^.git(D)
  • Open Drupal Releases page
  • Copy link to the last release compressed to tar.gz
  • Download and extract last Drupal — tar xvf =(curl $(pbpaste)) --strip 1
  • Restore deleted files in sites and profiles folder — g ls-files -z --deleted -- {sites,profiles} | xargs -0 git checkout --
  • Show status for these folders — gst -- {sites,profiles}
  • In most cases all changes to profiles folder are necessary — ga profiles/
  • It's ok to update default.settings.php — ga sites/default/default.settings.php
  • Add core functionality and readme files — ga modules/ themes/ includes/ misc/ CHANGELOG.txt COPYRIGHT.txt INSTALL.txt LICENSE.txt update.php
  • Check dotfiles and merge — gdw .gitignore .htaccess robots.txt. In the most cases just revert these — gco -- .gitignore .htaccess robots.txt
  • Check the rest of deleted files — g ls-files --deleted. In the most cases just revert these — gco -- $(g ls-files --deleted)
  • Check the rest. In the most cases just revert these — gco -- .
  • Commit — gc

Drush

  • Clean cache and revert features, alert after each stage — {drush cc all |& alert}; {drush -y fra |& alert}

Cleanup

  • dos2unix sites/all/modules/custom/**/*.(php|module|inc|info|install|js|css|ini)(.)

  • dos2unix sites/all/modules/features/**/*.(php|module|inc|info|install|js|css|ini)(.)

  • dos2unix sites/all/themes/jsk_*/**/*.(php|module|inc|info|install|js|css|ini|txt|less|scss)(.)

  • p sites/all/themes/jsk_*/**/*.(php|module|inc|info|install|js|css|ini|txt|less|scss)(e_'[[ -n $(tail -c1 $REPLY) ]]'_) | xargs -pn1 -I{} sh -c 'echo >> {}'

  • p sites/all/modules/features/**/*.(php|module|inc|info|install|js|css|ini)(e_'[[ -n $(tail -c1 $REPLY) ]]'_) | xargs -pn1 -I{} sh -c 'echo >> {}'

  • p sites/all/modules/custom/**/*.(php|module|inc|info|install|js|css|ini)(e_'[[ -n $(tail -c1 $REPLY) ]]'_) | xargs -pn1 -I{} sh -c 'echo >> {}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment