diff --git a/sut b/sut index 9b792321ff..88c1ecc561 100755 --- a/sut +++ b/sut @@ -16,14 +16,20 @@ $vendor = $sut . '/vendor'; $arguments = $GLOBALS['argv']; // Shift off argv[0] which contains the name of this script. array_shift($arguments); -// Add uri option -array_unshift($arguments, "--uri=dev"); +// Add alias if not already specified +if (!empty($arguments) && ($arguments[0][0] != '@')) { + array_unshift($arguments, "@sut.dev"); +} -// Make it easy to just call `/.sut si -y testing` +// Make it easy to just call `./sut si -y testing`, or `./sut @sut.stage -y testing` if (in_array('si', $arguments) || in_array('site-install', $arguments)) { + $subdir = 'dev'; + if (in_array('@sut.stage', $arguments)) { + $subdir = 'stage'; + } $db_url = getenv('UNISH_DB_URL') ?: 'mysql://root:@127.0.0.1'; - $arguments[] = "--db-url=$db_url/unish_dev"; - $arguments[] = '--sites-subdir=dev'; + $arguments[] = "--db-url=$db_url/unish_$subdir"; + $arguments[] = "--sites-subdir=$subdir"; } /** diff --git a/unish.sut.php b/unish.sut.php index d7e45a196c..b902e5771e 100755 --- a/unish.sut.php +++ b/unish.sut.php @@ -28,6 +28,7 @@ function unish_validate() { */ function unish_setup_sut($unish_sandbox) { $working_dir = dirname($unish_sandbox) . DIRECTORY_SEPARATOR . 'build-drush-sut'; + $target_dir = dirname($working_dir) . DIRECTORY_SEPARATOR . 'drush-sut'; drush_delete_dir($working_dir, TRUE); $codebase = 'tests/resources/codebase'; drush_copy_dir($codebase, $working_dir); @@ -41,6 +42,18 @@ function unish_setup_sut($unish_sandbox) { } } + $alias_contents = <<