diff --git a/environments/drupal-7.sh b/environments/drupal-7.sh index 04bda49..db77cd9 100644 --- a/environments/drupal-7.sh +++ b/environments/drupal-7.sh @@ -7,11 +7,6 @@ function drupal_ti_download_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 "$DRUPAL_TI_INSTALL_PROFILE" --db-url="$DRUPAL_TI_DB_URL" drush use $(pwd)#default } diff --git a/environments/drupal-8.sh b/environments/drupal-8.sh index 8fe0b9e..359e07f 100644 --- a/environments/drupal-8.sh +++ b/environments/drupal-8.sh @@ -9,10 +9,6 @@ function drupal_ti_download_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 "$DRUPAL_TI_INSTALL_PROFILE" --db-url="$DRUPAL_TI_DB_URL" drush use $(pwd)#default } diff --git a/functions/drupal.sh b/functions/drupal.sh index 3115228..f9009f6 100644 --- a/functions/drupal.sh +++ b/functions/drupal.sh @@ -3,9 +3,9 @@ # Common functionality for common tasks. # -# Ensures that the right Drupal version exists. +# Ensures that the right Drupal version is downloaded. # -function drupal_ti_ensure_drupal() { +function drupal_ti_ensure_drupal_download() { # This function is re-entrant. if [ -d "$DRUPAL_TI_DRUPAL_DIR" ] then @@ -30,16 +30,24 @@ function drupal_ti_ensure_drupal() { } # -# Ensures that Drupal is installed. +# Ensures that the right Drupal version is installed. # -function drupal_ti_ensure_drupal_installed() { - drupal_ti_ensure_drupal +function drupal_ti_ensure_drupal() { + # This function is re-entrant. + drupal_ti_ensure_drupal_download + + # @todo Maybe use a different check for Drupal installed. + if [ -r "$TRAVIS_BUILD_DIR/../drupal_ti-drupal-installed" ] + then + return + fi # Create database and install Drupal. mysql -e "create database $DRUPAL_TI_DB" - cd drupal + cd "$DRUPAL_TI_DRUPAL_DIR" drupal_ti_install_drupal + touch "$TRAVIS_BUILD_DIR/../drupal_ti-drupal-installed" } # @@ -98,7 +106,7 @@ function drupal_ti_run_server() { { "$GOPATH/bin/hhvm-serve" -listen="$DRUPAL_TI_WEBSERVER_HOST:$DRUPAL_TI_WEBSERVER_PORT" 2>&1 | drupal_ti_log_output "webserver" ; } & else # start a web server on port 8080, run in the background; wait for initialization - { drush runserver "$DRUPAL_TI_WEBSERVER_URL:$DRUPAL_TI_WEBSERVER_PORT" 2>&1 | drupal_ti_log_output "webserver" ; } & + { php -S "$DRUPAL_TI_WEBSERVER_HOST:$DRUPAL_TI_WEBSERVER_PORT" 2>&1 | drupal_ti_log_output "webserver" ; } & fi # Wait until drush server has been started. diff --git a/runners/behat/before_script.sh b/runners/behat/before_script.sh index 7afe134..cebdd15 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_installed +drupal_ti_ensure_drupal # 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 d61d072..c19f3af 100755 --- a/runners/phpunit-core/before_script.sh +++ b/runners/phpunit-core/before_script.sh @@ -4,10 +4,7 @@ set -e $DRUPAL_TI_DEBUG # Ensure the right Drupal version is downloaded. -drupal_ti_ensure_drupal - -# Change directory to Drupal core directory. -cd drupal +drupal_ti_ensure_drupal_download # 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 1876359..5a526b6 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_installed +drupal_ti_ensure_drupal # Enable simpletest module. cd "$DRUPAL_TI_DRUPAL_DIR"