? .drush_make.drush.inc.swp Index: drush_make.drush.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/drush_make/Attic/drush_make.drush.inc,v retrieving revision 1.11.2.71 diff -u -p -r1.11.2.71 drush_make.drush.inc --- drush_make.drush.inc 4 Sep 2010 16:17:42 -0000 1.11.2.71 +++ drush_make.drush.inc 3 Oct 2010 18:26:56 -0000 @@ -46,6 +46,13 @@ function drush_make_drush_command() { ), ); + $items['make-and-go'] = array( + 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_LOGIN, + 'description' => 'Incorporates a makefile into an existing Drupal install and executes a number of Drupal commands afterwards to enable new functionality.', + ); + $items['make-run']['arguments'] = $items['make']['arguments']; + $items['make-run']['options'] = $items['make']['options']; + $items['make-test'] = array( 'bootstrap' => DRUSH_BOOTSTRAP_DRUSH, 'description' => 'Run a drush make test.', @@ -72,6 +79,8 @@ function drush_make_drush_help($section) switch ($section) { case 'drush:make': return dt('Turns a makefile into a working drupal install. For a full description of options and makefile syntax, see the README.txt included with drush make.'); + case 'drush:make-run': + return dt('Drush make, then run any commands in the makefile.'); case 'drush:make-test': return dt('Run a drush make test.'); case 'drush:generate-makefile': @@ -118,6 +127,47 @@ function drush_drush_make_make($makefile } drush_make_clean_tmp(); + // Success - we didn't barf early + return $info; +} + +/** + * Drush callback; make based on the makefile and then run any commands. + */ +function drush_drush_make_make_and_go($makefile = NULL, $build_path = NULL) { + // No point running further Drupal commands if we don't have a core + drush_set_option('no-core', 1); + + // Also we need to have a make that works + if (!($info = drush_drush_make_make($makefile, $build_path))) { return; } + + // Firstly any enables + if(is_array($info['enable'])) { + $enable_args = array('pm-enable'); + // Sanitize modules into an array keyed 0,1,2,3... + foreach($info['enable'] as $module) { + $enable_args[] = $module; + } + // Enable all modules in one command + _drush_make_run_subprocess($enable_args); + + } + + // Now commands - run each separately + if(is_array($info['postprocess'])) { + foreach($info['postprocess'] as $command) { + _drush_make_run_subprocess(split(" ", $command)); + } + } +} + +/** + * Run a subprocess within make-and-go + */ +function _drush_make_run_subprocess($args) { + drush_set_arguments($args); + $c = drush_parse_command(); + drush_dispatch($c); } function drush_make_projects($recursion, $contrib_destination, $info, $build_path) {