Gittyup drush command
Categories
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Downloads
Component created
Component changed
Component body
Gittyup is a set of drush commands to update a Drupal install's git repository. With the advent of drush site aliases and site groups, as well as it's remote capabilities, it became advantageous to use drush commands instead of shell scripts for keeping development and staging sites up to date.
Assumptions
It is assumed that the root directory of the git repository is the root of the Drupal install. If this is not the case, it is recommended to explicitly declare your repository's root in the site-alias for the site:
$aliases['foo']['git-root'] = '/bar/baz';
You may also specify it inline with the git-root option:
drush gittyup --git-root='/bar/baz'
Usage
Drush site aliases are pretty cool. Check out the example.aliases.drushrc.php and start using them! Within the site alias you can specify all the options to drush gittyup you would want, including specifying a git tag. Consider the following:
// My development site
$aliases['dev'] = array(
'uri' => 'dev',
'root' => '/var/www/dev',
'git-branch' => 'master',
);
// My staging site
$aliases['stage'] = array(
'uri' => 'staging.example.com',
'root' => '/var/www/stage',
'git-tag' => '1.0',
);
With this set up, I can create cron jobs on the dev site to pull in the latest changes from the master branch every minute:
* * * * * /usr/bin/drush @dev gittyup > /dev/null
Since I've explicitly specified a tag in my staging alias, I could also set up a cron job to update the staging site nightly.
0 0 * * * /usr/bin/drush @stage gittyup > /dev/null
Now if I create a new tag, say 1.1, all I have to do is edit the alias file and set 'git-tag' equal to '1.1' and then at midnight the staging site will automatically fetch the latest commits, and checkout the specified tag.
Use with caution
This is still very new and untested. If you don't know what you're doing, don't use this! You can seriously mess up your site. You have been warned. :)
