Skip to content

Commit

Permalink
Merge pull request #496 from totten/master-d8-2020
Browse files Browse the repository at this point in the history
Various D8 updates
  • Loading branch information
totten authored Jan 29, 2020
2 parents 4b9b702 + 1bcc802 commit 5cb31a5
Show file tree
Hide file tree
Showing 12 changed files with 265 additions and 228 deletions.
25 changes: 25 additions & 0 deletions app/config/d8prj-clean/download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

## download.sh -- Download Drupal and CiviCRM

###############################################################################

#[ -z "$CMS_VERSION" ] && CMS_VERSION=8.7.x
[ -z "$CMS_VERSION" ] && CMS_VERSION=8.x-dev

composer create-project drupal-composer/drupal-project:"$CMS_VERSION" "$WEB_ROOT" --no-interaction

pushd "$WEB_ROOT" >> /dev/null
composer require drupal/{devel,libraries,userprotect}
composer require civicrm/civicrm-asset-plugin:'~1.0.0' civicrm/civicrm-setup:'dev-master as 0.2.99' civicrm/civicrm-{core,packages,drupal-8}:$(civicrm_composer_ver "$CIVI_VERSION") pear/pear_exception:'1.0.1 as 1.0.0' --prefer-source

## FIXME: All of the following should be removed/replaced as things get cleaner.
composer require "cache/integration-tests:dev-master#b97328797ab199f0ac933e39842a86ab732f21f9" ## Issue: it's a require-dev in civicrm-core for E2E/Cache/*; how do we pull in civi require-dev without all other require-dev?
case "$CIVI_VERSION" in
5.21*) git scan -N am https://github.com/civicrm/civicrm-core/pull/16328 ; ;; ## Issue: Patches needed in 5.21
5.22*) git scan -N am https://github.com/civicrm/civicrm-core/pull/16413 ; ;; ## Issue: Patches needed in 5.22 have one trivial difference
master) git scan -N am https://github.com/civicrm/civicrm-core/pull/{16403,16405,16406,16407,16408,16409} ; ;; ## Issue: This list may be volatile as PRs are getting reviewed.
*) cvutil_fatal "This build type is temporarily limited to branch which have a corresponding patchset." ; ;;
esac
extract-url --cache-ttl 172800 vendor/civicrm/civicrm-core/l10n=http://download.civicrm.org/civicrm-l10n-core/archives/civicrm-l10n-daily.tar.gz ## Issue: Don't write directly into vendor tree
popd >> /dev/null
61 changes: 61 additions & 0 deletions app/config/d8prj-clean/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash

## Transition: Old builds don't have "web/" folder. New builds do.
## TODO: Simplify sometime after Dec 2019
## install.sh -- Create config files and databases; fill the databases
[ -d "$WEB_ROOT/web" ] && CMS_ROOT="$WEB_ROOT/web"

###############################################################################
## Create virtual-host and databases

amp_install

###############################################################################
## Setup Drupal (config files, database tables)

drupal8_install
DRUPAL_SITE_DIR=$(_drupal_multisite_dir "$CMS_URL" "$SITE_ID")
pushd "${CMS_ROOT}/sites/${DRUPAL_SITE_DIR}" >> /dev/null
drush8 -y updatedb
drush8 -y en libraries
popd >> /dev/null

###############################################################################
## Setup CiviCRM (config files, database tables)

CIVI_DOMAIN_NAME="Demonstrators Anonymous"
CIVI_DOMAIN_EMAIL="\"Demonstrators Anonymous\" <info@example.org>"
CIVI_CORE="${WEB_ROOT}/vendor/civicrm/civicrm-core"
CIVI_UF="Drupal8"
GENCODE_CONFIG_TEMPLATE="${CMS_ROOT}/modules/contrib/civicrm/civicrm.config.php.drupal"

pushd "${CMS_ROOT}/sites/${DRUPAL_SITE_DIR}" >> /dev/null
civicrm_install_cv
popd >> /dev/null

###############################################################################
## Extra configuration
pushd "${CMS_ROOT}/sites/${DRUPAL_SITE_DIR}" >> /dev/null

## make sure drush functions are loaded
drush8 cc drush -y

## Setup CiviCRM -- But not in 'clean' config!
#echo '{"enable_components":["CiviEvent","CiviContribute","CiviMember","CiviMail","CiviReport","CiviPledge","CiviCase","CiviCampaign"]}' \
# | drush8 cvapi setting.create --in=json
#civicrm_apply_demo_defaults
#cv ev 'return CRM_Utils_System::synchronizeUsers();'

## Setup demo user
civicrm_apply_d8_perm_defaults
drush8 -y user-create --password="$DEMO_PASS" --mail="$DEMO_EMAIL" "$DEMO_USER"
drush8 -y user-add-role demoadmin "$DEMO_USER"

## Setup userprotect
drush8 -y en userprotect
drush8 -y rmp authenticated userprotect.account.edit
drush8 -y rmp authenticated userprotect.mail.edit
drush8 -y rmp authenticated userprotect.pass.edit

popd >> /dev/null

13 changes: 13 additions & 0 deletions app/config/d8prj-clean/uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

## uninstall.sh -- Delete config files and databases

###############################################################################

if [ -f "$CIVI_SETTINGS" ]; then
chmod u+w $(dirname "$CIVI_SETTINGS")
rm -f "$CIVI_SETTINGS"
fi

drupal_uninstall
amp_uninstall
23 changes: 23 additions & 0 deletions app/config/d8prj-re/download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

## download.sh -- Download Drupal and CiviCRM

###############################################################################

#[ -z "$CMS_VERSION" ] && CMS_VERSION=8.7.x
[ -z "$CMS_VERSION" ] && CMS_VERSION=8.x-dev
[ -z "$CIVI_VERSION" ] && cvutil_fatal "Must specify a CiviCRM version (--civi-ver X.Y)"
[ "$CIVI_VERSION" == "master" ] && cvutil_fatal "Must specify a CiviCRM version (--civi-ver X.Y)"

composer create-project drupal-composer/drupal-project:"$CMS_VERSION" "$WEB_ROOT" --no-interaction

pushd "$WEB_ROOT" >> /dev/null
composer require drupal/{devel,libraries}

## NOTE: No support for CIVI_VERSION
## NOTE: pear/log has a silly requirement for exactly 1.0.0
composer require roundearth/civicrm-composer-plugin civicrm/civicrm-setup:'dev-master as 0.2.1' civicrm/civicrm-{core,drupal-8}:~${CIVI_VERSION}.0 pear/pear_exception:'1.0.1 as 1.0.0'
#composer require roundearth/civicrm-composer-plugin civicrm/civicrm-setup:'dev-master as 0.2.1' civicrm/civicrm-core:5.14.2 civicrm/civicrm-drupal-8:5.14.2
#composer require roundearth/civicrm-composer-plugin civicrm/civicrm-setup:'dev-master as 0.2.1' civicrm/civicrm-drupal-8
#composer require roundearth/civicrm-composer-plugin civicrm/civicrm-setup:dev-master civicrm/civicrm-drupal-8
popd >> /dev/null
32 changes: 32 additions & 0 deletions app/config/d8prj-re/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

## Transition: Old builds don't have "web/" folder. New builds do.
## TODO: Simplify sometime after Dec 2019
## install.sh -- Create config files and databases; fill the databases
[ -d "$WEB_ROOT/web" ] && CMS_ROOT="$WEB_ROOT/web"

###############################################################################
## Create virtual-host and databases

amp_install

###############################################################################
## Setup Drupal (config files, database tables)

drupal8_install
DRUPAL_SITE_DIR=$(_drupal_multisite_dir "$CMS_URL" "$SITE_ID")
pushd "${CMS_ROOT}/sites/${DRUPAL_SITE_DIR}" >> /dev/null
# drush8 -y updatedb
# drush8 -y en libraries

cv core:install -f --cms-base-url="$CMS_URL" \
-m "settings.userFrameworkResourceURL=[cms.root]/libraries/civicrm" \
-m "siteKey=$CIVI_SITE_KEY"
# -m "db=$CIVI_DB_DSN" ## For two DBs
drush8 -y en civicrm

## Setup demo user
civicrm_apply_d8_perm_defaults
drush8 -y user-create --password="$DEMO_PASS" --mail="$DEMO_EMAIL" "$DEMO_USER"
drush8 -y user:role:add demoadmin "$DEMO_USER"
popd >> /dev/null
13 changes: 13 additions & 0 deletions app/config/d8prj-re/uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

## uninstall.sh -- Delete config files and databases

###############################################################################

if [ -f "$CIVI_SETTINGS" ]; then
chmod u+w $(dirname "$CIVI_SETTINGS")
rm -f "$CIVI_SETTINGS"
fi

drupal_uninstall
amp_uninstall
28 changes: 19 additions & 9 deletions app/config/drupal8-clean/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,24 @@

###############################################################################

[ -z "$CMS_VERSION" ] && CMS_VERSION=8.x
#[ -z "$CMS_VERSION" ] && CMS_VERSION=8.7.x
[ -z "$CMS_VERSION" ] && CMS_VERSION=8

MAKEFILE="${TMPDIR}/${SITE_TYPE}/${SITE_NAME}/${SITE_ID}.make"
cvutil_makeparent "$MAKEFILE"
cat "$SITE_CONFIG_DIR/drush.make.tmpl" \
| sed "s;%%CACHE_DIR%%;${CACHE_DIR};" \
| sed "s;%%CIVI_VERSION%%;${CIVI_VERSION};" \
| sed "s;%%CMS_VERSION%%;${CMS_VERSION};" \
> "$MAKEFILE"
mkdir "$WEB_ROOT"
drush8 -y dl drupal-${CMS_VERSION} --destination="$WEB_ROOT" --drupal-project-rename
mv "$WEB_ROOT/drupal" "$WEB_ROOT/web"

drush8 -y make --working-copy "$MAKEFILE" "$WEB_ROOT"
pushd "$WEB_ROOT/web" >> /dev/null
drush8 dl -y devel-1 libraries userprotect
composer require civicrm/civicrm-asset-plugin:'~1.0.0' civicrm/civicrm-setup:'dev-master as 0.2.99' civicrm/civicrm-{core,packages,drupal-8}:$(civicrm_composer_ver "$CIVI_VERSION") --prefer-source

## FIXME: All of the following should be removed/replaced as things get cleaner.
composer require "cache/integration-tests:dev-master#b97328797ab199f0ac933e39842a86ab732f21f9" ## Issue: it's a require-dev in civicrm-core for E2E/Cache/*; how do we pull in civi require-dev without all other require-dev?
case "$CIVI_VERSION" in
5.21*) git scan -N am https://github.com/civicrm/civicrm-core/pull/16328 ; ;; ## Issue: Patches needed in 5.21
5.22*) git scan -N am https://github.com/civicrm/civicrm-core/pull/16413 ; ;; ## Issue: Patches needed in 5.22 have one trivial difference
master) git scan -N am https://github.com/civicrm/civicrm-core/pull/{16403,16405,16406,16407,16408,16409} ; ;; ## Issue: This list may be volatile as PRs are getting reviewed.
*) cvutil_fatal "This build type is temporarily limited to branch which have a corresponding patchset." ; ;;
esac
extract-url --cache-ttl 172800 vendor/civicrm/civicrm-core/l10n=http://download.civicrm.org/civicrm-l10n-core/archives/civicrm-l10n-daily.tar.gz ## Issue: Don't write directly into vendor tree
popd >> /dev/null
68 changes: 0 additions & 68 deletions app/config/drupal8-clean/drush.make.tmpl

This file was deleted.

Loading

0 comments on commit 5cb31a5

Please sign in to comment.