diff --git a/build/phing/build.xml b/build/phing/build.xml index 044739c70..0caadcf8c 100644 --- a/build/phing/build.xml +++ b/build/phing/build.xml @@ -162,7 +162,7 @@ - + diff --git a/template/build/core/phing/build.xml b/template/build/core/phing/build.xml index 8f7df1ad9..27ba83241 100644 --- a/template/build/core/phing/build.xml +++ b/template/build/core/phing/build.xml @@ -57,4 +57,25 @@ + + + + + + + + + + + + The directory ${target-hooks.${hook-name}.dir} does not exist. Will not run command for ${hook-name}. + + + + + No commands are defined for ${hook-name}. Skipping. + + + + diff --git a/template/build/core/phing/tasks/deploy.xml b/template/build/core/phing/tasks/deploy.xml index 13e0615a3..473f28ff2 100644 --- a/template/build/core/phing/tasks/deploy.xml +++ b/template/build/core/phing/tasks/deploy.xml @@ -26,6 +26,13 @@ + + + + + + + @@ -63,7 +70,7 @@ + depends="frontend:build, deploy:copy, deploy:composer:install, deploy:sanitize"> @@ -90,21 +97,6 @@ - - - - - - - - "${profile.dir}/drupal-org.make" - "${profile.dir}" - - - - - - diff --git a/template/build/core/phing/tasks/frontend.xml b/template/build/core/phing/tasks/frontend.xml index 70f356932..664755958 100644 --- a/template/build/core/phing/tasks/frontend.xml +++ b/template/build/core/phing/tasks/frontend.xml @@ -1,53 +1,9 @@ - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/template/build/core/phing/tasks/local-sync.xml b/template/build/core/phing/tasks/local-sync.xml index 71b25a5f0..c2eebd8c9 100644 --- a/template/build/core/phing/tasks/local-sync.xml +++ b/template/build/core/phing/tasks/local-sync.xml @@ -6,7 +6,7 @@ - + diff --git a/template/build/core/phing/tasks/setup.xml b/template/build/core/phing/tasks/setup.xml index f23d4220c..e8a9d0712 100644 --- a/template/build/core/phing/tasks/setup.xml +++ b/template/build/core/phing/tasks/setup.xml @@ -1,7 +1,7 @@ + depends="setup:build, setup:drupal:install, blt:alias"> For a full list of available Phing targets, run: ./blt.sh -l @@ -16,23 +16,13 @@ - - + + + + + - - - - - - - - - "${profile.dir}/drupal-org.make" - ${profile.dir} - - - diff --git a/template/project.yml b/template/project.yml index 304871a90..e2089150e 100644 --- a/template/project.yml +++ b/template/project.yml @@ -40,6 +40,25 @@ drush: # The default drush alias to be used when no environment is specified. default_alias: ${drush.aliases.local} +# Custom tasks that are triggered at pre-defined times in the build process. +# The tasks hook into BLT's existing Phing targets. Available hooks keys are: +# frontend-build, post-deploy-build, and post-setup-build. +target-hooks: + # Executed when front end assets should be generated. + frontend-build: + # E.g., ${docroot}/sites/all/themes/custom/mytheme. + dir: ${docroot} + # E.g., `npm install` or `bower install`. + command: echo 'No frontend build configured.' + # Executed after deployment artifact is created. + post-deploy-build: + dir: ${deploy.dir}/docroot/profiles/contrib/lightning + command: npm install && bower install + # Executed after setup:build is run. + post-setup-build: + dir: ${docroot}/profiles/contrib/lightning + command: npm install && bower install + # Hosting environment flags. # Examples: acsf (Acquia Cloud Site Factory), ac (Acquia Cloud) # hosting: "acsf" diff --git a/template/readme/deploy.md b/template/readme/deploy.md index 3f48dabb9..25a2924fd 100644 --- a/template/readme/deploy.md +++ b/template/readme/deploy.md @@ -25,7 +25,7 @@ In order to create the build artifact in `/deploy`, simply run ./blt.sh deploy:build ``` -This task is analogous to `setup:build:all` but with a few critical differences: +This task is analogous to `setup:build` but with a few critical differences: * The docroot is created at `/deploy/docroot`. * Only production required to the docroot * (planned) CSS / JS are compiled in production mode (compressed / minified) diff --git a/template/readme/onboarding.md b/template/readme/onboarding.md index 9a11ff031..9de5e7a2e 100644 --- a/template/readme/onboarding.md +++ b/template/readme/onboarding.md @@ -59,7 +59,7 @@ If you need to make requests via a proxy server, please [configure git to use a drupal. 1. Create and edit your local drush alias file. Copy `drush/site-aliases/example.local.aliases.drushrc.php` to `drush/site-aliases/local.aliases.drushrc.php`. Edit the new alias file with your local path. -After this initial setup, you should only need to run `./blt.sh setup:build:all` when composer.json is updated, and `./blt.sh local:drupal:install` when you need to reinstall the site. +After this initial setup, you should only need to run `./blt.sh setup:build` when composer.json is updated, and `./blt.sh local:drupal:install` when you need to reinstall the site. For a full list of available project tasks, run `./blt.sh -l`. See [Project Tasks](project-tasks.md) for more information. diff --git a/template/readme/project-tasks.md b/template/readme/project-tasks.md index c4dbb74e5..f6a113ad6 100644 --- a/template/readme/project-tasks.md +++ b/template/readme/project-tasks.md @@ -15,7 +15,7 @@ Pre-requisites to installation: 1. Ensure that `docroot/sites/default/settings/local.settings.php` exists by executing `./blt.sh setup:drupal:settings`. 1. Verify that correct local database credentials are set in `local.settings.php`. -1. Ensure that project dependencies have already been built via `./blt.sh setup:build:all` +1. Ensure that project dependencies have already been built via `./blt.sh setup:build` To re-install Drupal, execute: `./blt.sh setup:drupal:install`. Note that this will drop the existing database tables and install Drupal from scratch! @@ -62,22 +62,41 @@ Please see [Deploy](deploy.md) for a detailed description of how to deploy to Ac Please see [tests/README.md](../tests/README.md) for information on running tests. -To execute PHP codesniffer and PHP lint against the project codebase, run: `./blt.sh validate:all` +To execute PHP codesniffer and PHP lint against the project codebase, run: + +``` +./blt.sh validate:all +``` ## Build front end assets Ideally, you will be using a theme that uses SASS/SCSS, a styleguide, and other tools that require compilation. Like dependencies, the compiled assets should not be directly committed to the project repository. Instead, they should be built during the creation of a production-ready build artifact. -BLT only natively supports the [Acquia PS Thunder](https://github.com/acquia-pso/thunder) base theme. +BLT allows you to define a custom command that will be run to compile your project's frontend assets. You can specify the command in your project's `project.yml` file under the `target-hooks.frontend-build` key: + +``` +target-hooks: + frontend-build: + # The directory in which the command will be executed. + dir: ${docroot} + command: npm install. +``` -To install Thunder's dependencies: +If you need to run more than one command, you may use this feature to call a custom script: -1. See [Acquia PS Thunder](https://github.com/acquia-pso/thunder) for system requirements. -1. Execute `/.blt.sh frontend:install`. +``` +target-hooks: + frontend-build: + # The directory in which the command will be executed. + dir: ${repo.root} + command: ./scripts/custom/my-script.sh +``` -To build Thunder's assets, execute: +This command will be executed when dependencies are built in a local or CI environment, and when a deployment artifact is generated. You may execute the command directly by calling the `frontend:build` target: -`/.blt.sh frontend:build`. +``` +./blt.sh frontend:build +``` ## Updating you local environment @@ -87,14 +106,20 @@ The project is configured to update the local environment with a local drush ali This all in one command will make sure your local is in sync with the remote site. -`./blt.sh local:refresh` +``` +./blt.sh local:refresh +``` ### Sync: Copy the database from the remote site -`./blt.sh local:sync` +``` +./blt.sh local:sync +``` ### Update: Run update tasks locally -`./blt.sh local:update` +``` +./blt.sh local:update +``` These tasks can be seen in `build/core/phing/tasks/local-sync.xml`. An additional script can be added at `/hooks/dev/post-db-copy/dev-mode.sh` which would run at the end of this task.