diff --git a/environments/drupal-7.sh b/environments/drupal-7.sh index 6f948d2..7e8367b 100644 --- a/environments/drupal-7.sh +++ b/environments/drupal-7.sh @@ -2,9 +2,16 @@ # @file # Drupal-7 environment variables and functions. -function drupal_ti_install_drupal() { +function drupal_ti_download_drupal() { drush --yes dl drupal-7 --drupal-project-rename=drupal - cd drupal +} + +function drupal_ti_install_drupal() { + if [ ! -f install.php ] + then + return -1 + fi + php -d sendmail_path=$(which true) ~/.composer/vendor/bin/drush.php --yes site-install testing --db-url="$DRUPAL_TI_DB_URL" drush use $(pwd)#default } diff --git a/environments/drupal-8.sh b/environments/drupal-8.sh index 55825ab..2e0ee9e 100644 --- a/environments/drupal-8.sh +++ b/environments/drupal-8.sh @@ -2,9 +2,15 @@ # @file # Drupal-8 environment variables and functions. -function drupal_ti_install_drupal() { +function drupal_ti_download_drupal() { git clone --depth 1 --branch 8.0.x http://git.drupal.org/project/drupal.git - cd drupal +} + +function drupal_ti_install_drupal() { + if [ ! -f install.php ] + then + return -1 + fi php -d sendmail_path=$(which true) ~/.composer/vendor/bin/drush.php --yes -v site-install minimal --db-url="$DRUPAL_TI_DB_URL" drush use $(pwd)#default } diff --git a/functions/drupal.sh b/functions/drupal.sh index 122bbd1..3115228 100644 --- a/functions/drupal.sh +++ b/functions/drupal.sh @@ -3,7 +3,7 @@ # Common functionality for common tasks. # -# Ensures that the right Drupal version is installed. +# Ensures that the right Drupal version exists. # function drupal_ti_ensure_drupal() { # This function is re-entrant. @@ -23,12 +23,22 @@ function drupal_ti_ensure_drupal() { export PATH="$BIN_DIR:$PATH" fi - # Create database and install Drupal. - mysql -e "create database $DRUPAL_TI_DB" - mkdir -p "$DRUPAL_TI_DRUPAL_BASE" cd "$DRUPAL_TI_DRUPAL_BASE" + drupal_ti_download_drupal +} + +# +# Ensures that Drupal is installed. +# +function drupal_ti_ensure_drupal_installed() { + drupal_ti_ensure_drupal + + # Create database and install Drupal. + mysql -e "create database $DRUPAL_TI_DB" + + cd drupal drupal_ti_install_drupal } diff --git a/runners/behat/before_script.sh b/runners/behat/before_script.sh index cebdd15..7afe134 100755 --- a/runners/behat/before_script.sh +++ b/runners/behat/before_script.sh @@ -4,7 +4,7 @@ set -e $DRUPAL_TI_DEBUG # Ensure the right Drupal version is installed. -drupal_ti_ensure_drupal +drupal_ti_ensure_drupal_installed # Ensure the module is linked into the code base and enabled. drupal_ti_ensure_module diff --git a/runners/phpunit-core/before_script.sh b/runners/phpunit-core/before_script.sh index 43586b3..4801f8f 100755 --- a/runners/phpunit-core/before_script.sh +++ b/runners/phpunit-core/before_script.sh @@ -3,8 +3,8 @@ set -e $DRUPAL_TI_DEBUG -# Ensure the right Drupal version is installed. +# Ensure the right Drupal version is downloaded. drupal_ti_ensure_drupal -# Ensure the module is linked into the code base and enabled. -drupal_ti_ensure_module +# Ensure the module is linked into the code base. +drupal_ti_ensure_module_linked diff --git a/runners/simpletest/before_script.sh b/runners/simpletest/before_script.sh index 5a526b6..1876359 100755 --- a/runners/simpletest/before_script.sh +++ b/runners/simpletest/before_script.sh @@ -4,7 +4,7 @@ set -e $DRUPAL_TI_DEBUG # Ensure the right Drupal version is installed. -drupal_ti_ensure_drupal +drupal_ti_ensure_drupal_installed # Enable simpletest module. cd "$DRUPAL_TI_DRUPAL_DIR"