diff --git a/.probo.yaml b/.probo.yaml index c5ccc04..605ac23 100644 --- a/.probo.yaml +++ b/.probo.yaml @@ -1,8 +1,7 @@ steps: - - name: Make and install Bear - plugin: Drupal - makeFile: build-bear.make - profileName: bear - runInstall: true + - name: Run the profile script + command: './$SRC_DIR/profile-build.sh' + - name: Run install + command: "drush site-install --root=/var/www/html bear --db-url='mysqli://root:strongpassword@localhost/bear'" - name: Run behat tests command: 'cd /var/www/html/profiles/bear/tests ; composer install ; ./bin/behat --profile probo --tags "~@javascript"' diff --git a/profile-build.sh b/profile-build.sh new file mode 100755 index 0000000..009aba5 --- /dev/null +++ b/profile-build.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +PROFILE_NAME='bear' +MAKE_FILE='' +SRC_DIR='/src' +DESTINATION='/var/www/html' + +function checkMakeFile() { + # Matches the following: + # projects[bear] + # projects[] = 'bear' + # projects[] = "bear" + # projects[] = bear + # projects[]=bear + if grep "\[$PROFILE_NAME\]" $1 > /dev/null || grep "['\"]\?$PROFILE_NAME['\"]\?$" $1 > /dev/null; then + echo 'Error: Project should not be listed in make file.' >&2 + exit 1 + fi + return +} + +if [ "$SRC_DIR/$MAKE_FILE" != '' ] && [ -f "$SRC_DIR/$MAKE_FILE" ]; then + checkMakeFile "$SRC_DIR/$MAKE_FILE" + + drush make "$SRC_DIR/$MAKE_FILE" $DESTINATION +elif [ -f "$SRC_DIR/drupal-org-core.make" ] && [ -f "$SRC_DIR/drupal-org.make" ]; then + checkMakeFile "$SRC_DIR/drupal-org-core.make" + checkMakeFile "$SRC_DIR/drupal-org.make" + + drush make "$SRC_DIR/drupal-org-core.make" $DESTINATION + cd $SRC_DIR + drush make "drupal-org.make" --contrib-destination=. --no-core . -y + cd - +fi + +if [ ! -d "$DESTINATION/profiles/$PROFILE_NAME" ]; then + cp -r $SRC_DIR "$DESTINATION/profiles/$PROFILE_NAME" +else + echo 'Error: Unable to copy profile to destination because it already exists.' >&2 + exit 1 +fi