Skip to content

Commit

Permalink
Issue LionsAd#38: Decouple download and installation of Drupal core a…
Browse files Browse the repository at this point in the history
…nd modules.
  • Loading branch information
mradcliffe authored and yanniboi committed Jan 23, 2017
1 parent 9b963a2 commit c2b060a
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 12 deletions.
11 changes: 9 additions & 2 deletions environments/drupal-7.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$DRUPAL_TI_INSTALL_PROFILE" --db-url="$DRUPAL_TI_DB_URL"
drush use $(pwd)#default
}
Expand Down
9 changes: 8 additions & 1 deletion environments/drupal-8.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@
# @file
# Drupal-8 environment variables and functions.

function drupal_ti_install_drupal() {
function drupal_ti_download_drupal() {
git clone --depth 1 --branch "$DRUPAL_TI_CORE_BRANCH" http://git.drupal.org/project/drupal.git
cd drupal
composer install
}

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
18 changes: 14 additions & 4 deletions functions/drupal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
}

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
drupal_ti_ensure_drupal_installed

# Ensure the module is linked into the code base and enabled.
drupal_ti_ensure_module
Expand Down
6 changes: 3 additions & 3 deletions runners/phpunit-core/before_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

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

# Ensure server is running for Functional tests
drupal_ti_run_server
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
drupal_ti_ensure_drupal_installed

# Enable simpletest module.
cd "$DRUPAL_TI_DRUPAL_DIR"
Expand Down

0 comments on commit c2b060a

Please sign in to comment.