Created
July 22, 2012 09:08
-
-
Save fl3a/3158979 to your computer and use it in GitHub Desktop.
Drush configuration for git repositories
This file contains 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
<?php | |
/** | |
* @file | |
* Drush alias file for git repositories | |
* with predefined options for sql-dump command | |
* | |
* Place as etc/drush/aliases.drushrc.php | |
* within your git repository | |
* | |
* @see http://netzaffe.de/node/1608 for details about repository structure | |
* @see http://drupal.org/project/drush_sql_dump_hold for hold option | |
* @see etc/drush/git.drushrc.php for modifying structure-tables-key array | |
*/ | |
exec('git rev-parse --git-dir 2> /dev/null', $output); | |
if (!empty($output)) { | |
$repo = $output[0]; | |
$aliases['git'] = array( | |
'uri' => 'default', | |
'root' => realpath($repo . '/../drupal'), | |
'command-specific' => array ( | |
'sql-dump' => array( | |
'result-file' => TRUE, | |
'result-file' => realpath($repo . '/../dumps/') . '/@DATABASE_@DATE.sql', | |
'gzip' => TRUE, | |
'structure-tables-key' => 'common', | |
// Do not use strict, | |
// suppress errors, if drush_dump_hold (hold option) is not available. | |
'strict' => FALSE, | |
// Additional hold option from https://drupal.org/project/drush_sql_dump_hold. | |
'hold' => 31, | |
// Always confirm purge with yes. | |
'yes' => TRUE, | |
), | |
), | |
); | |
} |
This file contains 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
<?php | |
/** | |
* @file | |
* example.drushrc.php for git repositories | |
* | |
* Tries to load git.drushrc.php as additional config | |
* and searches for aliases in specified $options['alias-path'] | |
* if we are within a git repository. | |
* | |
* @see http://netzaffe.de/node/1608 for details about git repository structure. | |
* | |
* Rename this file to drushrc.php and optionally copy it to one of | |
* convenient places, or append the code below to the end of | |
* listed below locations in order of precedence: | |
* | |
* 1. Drupal site folder (e.g sites/{default|example.com}/drushrc.php). | |
* 2. Drupal installation root. | |
* 3. In any location, as specified by the --config (-c) option. | |
* 4. User's .drush folder (i.e. ~/.drush/drushrc.php). | |
* 5. System wide configuration folder (e.g. /etc/drush/drushrc.php). | |
* 6. Drush installation folder. | |
* | |
*/ | |
exec('git rev-parse --git-dir 2> /dev/null', $output); | |
if (!empty($output)) { | |
$repo = $output[0]; | |
$options['config'] = $repo . '/../etc/drush/git.drushrc.php'; | |
$options['alias-path'] = $repo . '/../etc/drush'; | |
} |
This file contains 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
<?php | |
/** | |
* @file | |
* Specifific drushrc.php for git repositories | |
* | |
* Place as etc/drush/git.drushrc.php | |
* within your git repository | |
* | |
* @see http://netzaffe.de/node/1608 for details about repository structure | |
*/ | |
exec('git rev-parse --git-dir 2> /dev/null', $output); | |
if (!empty($output)) { | |
$repo = $output[0]; | |
$options['r'] = realpath($repo . '/../drupal'); | |
$options['l'] = 'default'; | |
$options['structure-tables']['common'] = array( | |
'accesslog', 'cache', 'cache_block', | |
'cache_filter', 'cache_form', 'cache_menu', | |
'cache_page', 'cache_update', 'history', | |
'search_dataset', 'search_index', 'search_total', | |
'sessions', 'watchdog', | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment