Skip to content

Instantly share code, notes, and snippets.

@leewillis77
Created February 24, 2012 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leewillis77/1902076 to your computer and use it in GitHub Desktop.
Save leewillis77/1902076 to your computer and use it in GitHub Desktop.
Allow per-project working-file checkouts in drush makefiles (6.x-2.x)
diff --git a/drush_make.download.inc b/drush_make.download.inc
index 92c68f9..106269f 100644
--- a/drush_make.download.inc
+++ b/drush_make.download.inc
@@ -12,7 +12,12 @@ function drush_make_download_factory($name, $download, $download_location) {
function drush_make_download_cvs($name, $download, $download_location) {
if (!empty($download['module'])) {
- if (drush_get_option('working-copy')) {
+ if ( isset ( $download['working-copy'] ) ) {
+ $wc = true;
+ } else {
+ $wc = drush_get_option('working-copy');
+ }
+ if ($wc) {
if ($download['module'] == 'drupal') {
$download['root'] = ":pserver:anonymous:anonymous@drupalcode.org:/cvs/drupal";
}
@@ -34,7 +39,7 @@ function drush_make_download_cvs($name, $download, $download_location) {
$cd_to_directory = dirname($download_location);
$destination_directory = basename($download_location);
- $command = 'cvs -d%s ' . (drush_get_option('working-copy') ? 'checkout' : 'export') . ' -d%s';
+ $command = 'cvs -d%s ' . ($wc ? 'checkout' : 'export') . ' -d%s';
$args = array($download['root'], $destination_directory);
if (isset($download['revision'])) {
$command .= ' -r %s';
@@ -344,8 +349,13 @@ function drush_make_download_post($name, $download, $download_location) {
function drush_make_download_git($name, $download, $download_location) {
$tmp_path = drush_make_tmp();
- $wc = drush_get_option('working-copy');
-
+
+ if ( isset ( $download['working-copy'] ) ) {
+ $wc = true;
+ } else {
+ $wc = drush_get_option('working-copy');
+ }
+
// check if branch option is set in info file, otherwise set default to master branch
$download['branch'] = isset($download['branch']) ? $download['branch'] : 'master';
// check if tag option is set in info file, otherwise we set it to false
@@ -502,11 +512,16 @@ function drush_make_download_git($name, $download, $download_location) {
function drush_make_download_bzr($name, $download, $download_location) {
$tmp_path = drush_make_tmp();
$tmp_location = $tmp_path . '/__bzr__/' . basename($download_location);
+ if ( isset ( $download['working-copy'] ) ) {
+ $wc = true;
+ } else {
+ $wc = drush_get_option('working-copy');
+ }
drush_make_mkdir(dirname($tmp_location));
if (!empty($download['url'])) {
$args = array();
$command = 'bzr';
- if (drush_get_option('working-copy')) {
+ if ($wc) {
$command .= ' branch --use-existing-dir';
}
else {
@@ -517,7 +532,7 @@ function drush_make_download_bzr($name, $download, $download_location) {
$args[] = $download['revision'];
}
$command .= ' %s %s';
- if (drush_get_option('working-copy')) {
+ if ($wc) {
$args[] = $download['url'];
$args[] = $tmp_location;
}
@@ -554,7 +569,12 @@ function drush_make_download_svn($name, $download, $download_location) {
if (!isset($download['force']) || $download['force']) {
$options = ' --force';
}
- if (drush_get_option('working-copy')) {
+ if ( isset ( $download['working-copy'] ) ) {
+ $wc = true;
+ } else {
+ $wc = drush_get_option('working-copy');
+ }
+ if ($wc) {
$command = 'svn' . $options . ' checkout';
}
else {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment