commands/core/core.drush.inc | 60 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 60 insertions(+), 0 deletions(-) diff --git commands/core/core.drush.inc commands/core/core.drush.inc index 676d447..fb5113b 100644 --- commands/core/core.drush.inc +++ commands/core/core.drush.inc @@ -97,6 +97,36 @@ function core_drush_command() { ), 'topics' => array('docs-readme'), ); + $engines = array( + 'engines' => array( + 'package_handler' => 'Determine how to download/checkout new projects and acquire updates to projects.', + ), + ); + $items['core-quick-drupal'] = array( + 'description' => 'Download, install, serve and login to Drupal with minimal configuration and dependencies.', + 'bootstrap' => DRUSH_BOOTSTRAP_DRUSH, + 'options' => array( + 'destination' => 'Filesystem target for Drupal. Defaults to ./mysite/drupal', + 'dev' => 'Download a development release. ', + 'select' => 'Select the version to download interactively from a list of available releases.', + 'drupal-project-rename' => 'Alternate name for "drupal-x.y" directory when downloading Drupal project. Defaults to "drupal".', + 'default-major' => 'Specify the major version of Drupal. Defaults to 7.', + 'cache' => 'Cache release XML and tarballs or git clones. Git clones use git\'s --reference option', + 'cache-duration-releasexml' => 'Expire duration (in seconds) for release XML. Only applicable when --cache is set. Defaults to 86400 (24 hours).', + 'no-cache' => 'Negate a --cache option which might have been set in drushrc.php (for example). Tip: the no- prefix works for any option.', + 'profile' => 'The install profile to use. Defaults to standard.', + 'ip:port' => 'Host IP address and port number to bind to (default 127.0.0.1:8888). The IP is optional, in which case just pass in the numeric port.', + 'php-cgi' => 'Name of the php-cgi binary. If it is not on your current $PATH you should include the full path. You can include command line parameters to pass into php-cgi.', + 'conf-inject' => 'Key-value array of variables to override in the $conf array for the running site. By default disables drupal_http_request_fails to avoid errors on Windows (which supports only one connection at a time). Note that as this is a key-value array, it can only be specified in a drushrc or alias file, and not on the command line.' + ), + 'examples' => array( + 'drush qd --profile=minimal --dev --cache --default-major=8 --yes' => 'Fire up dev release of Drupal site with minimal install profile.', + ), + 'arguments' => array( + 'site id' => 'Short name of your site. Used as directory name and as sqlite file name.', + ), + 'aliases' => array('qd'), + ) + $engines; $items['php-eval'] = array( 'description' => 'Evaluate arbitrary php code after bootstrapping Drupal (if available).', 'examples' => array( @@ -629,6 +659,36 @@ function _drush_core_is_named_in_array($key, $the_array) { } /** + * Command callback. + */ +function drush_core_quick_drupal($name) { + $base = getcwd() . '/' . $name; + drush_set_option('destination', $name); + drush_set_option('drupal-project-rename', 'drupal'); + drush_invoke('pm-download', 'drupal'); + drush_set_option('root', $base . '/drupal'); + drush_set_option('uri', 'http://localhost:8888'); + drush_set_option('db-url', 'sqlite:' . $base . '/' . $name . '.sqlite'); + drush_bootstrap_max(DRUSH_BOOTSTRAP_DRUPAL_ROOT); + drush_invoke('site-install', array(drush_get_option('profile'))); + drush_bootstrap_max(); + $user = user_load(1); + $login = user_pass_reset_url($user); + drush_print(dt('Login URL: ') . $login); + // See if we can find an OS helper to open in default browser + if (drush_shell_exec('which sensible-browser')) { + $browser = 'sensible-browser'; + } + else if (drush_shell_exec('which open')) { + $browser = 'open'; + } + // This is a race, although the server always comes up in time on my machine + // would be worth thinking of another way to do this. + drush_shell_exec($browser . ' %s', $login); + drush_invoke('runserver', array(drush_get_option('ip:port', '8888'))); +} + +/** * Command callback. Runs "naked" php scripts * and drush "shebang" scripts ("#!/usr/bin/env drush"). */