Skip to content

Commit

Permalink
Issue LionsAd#38: Restructured drupal_ti_ensure_drupal and sub functi…
Browse files Browse the repository at this point in the history
…ons for backward compatibility.
  • Loading branch information
yanniboi committed Jan 23, 2017
1 parent cfe551b commit 3e4beb2
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 22 deletions.
5 changes: 0 additions & 5 deletions environments/drupal-7.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 0 additions & 4 deletions environments/drupal-8.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
22 changes: 15 additions & 7 deletions functions/drupal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
}

#
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion runners/behat/before_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions runners/phpunit-core/before_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion runners/simpletest/before_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 3e4beb2

Please sign in to comment.