Skip to content

Commit

Permalink
Merge pull request #120 from palantirnet/rearrange-templates-again
Browse files Browse the repository at this point in the history
Rearrange templates/default files (again)
  • Loading branch information
becw authored Jan 9, 2019
2 parents 8d9645e + bc7aa9e commit afd5d97
Show file tree
Hide file tree
Showing 45 changed files with 123 additions and 89 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ $> vendor/bin/phing test

## Configuration

Configure your build by editing `.the-build/build.default.properties.yml`. You can find more properties in [defaults.properties.yml](defaults.properties.yml), and override the defaults by copying them into your project's properties files.
Configure your build by editing `.the-build/build.yml`. You can find more properties in [defaults.yml](defaults.yml), and override the defaults by copying them into your project's properties files.

## Additional documentation

Expand Down
22 changes: 11 additions & 11 deletions defaults.properties.yml → defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#
# Properties may be overridden for individual projects by copying them to the project's
# own property files:
# - .the-build/build.default.properties.yml
# - .the-build/build.circleci.properties.yml
# - .the-build/build.acquia.properties.yml
# - .the-build/build.yml
# - .the-build/build.circleci.yml
# - .the-build/build.acquia.yml
# - etc.
#
# @copyright 2018 Palantir.net, Inc.
Expand Down Expand Up @@ -43,7 +43,7 @@ drupal:
# loading any missing values from drupal.sites._defaults.
#
# To add a Drupal multisite installation, copy these default values into
# your project's .the-build/build.default.properties.yml file and change
# your project's .the-build/build.yml file and change
# the 'default' key to the name of your new multisite. The key must not
# contain '.' characters, but the 'dir' property may.
default:
Expand Down Expand Up @@ -112,11 +112,11 @@ drupal:
build:
# Source template for Drupal's `settings.php` file. This may vary per build
# environment.
settings_template: .the-build/drupal.settings.build.php
settings_template: .the-build/drupal/settings.build.php

# Source template for Drupal's `services.yml` file. This may vary per build
# environment.
services_template: .the-build/drupal.services.build.yml
services_template: .the-build/drupal/services.build.yml

# Configuration for the database loading utility.
load_db:
Expand Down Expand Up @@ -147,10 +147,10 @@ artifact:
prefix: artifact-

# Path to a template .gitignore file to use in the artifact.
gitignore_template: "${build.thebuild.dir}/defaults/templates/artifact.gitignore"
gitignore_template: "${build.thebuild.dir}/defaults/artifact/gitignore"

# Path to a template README file to use in the artifact.
readme_template: "${build.thebuild.dir}/defaults/templates/artifact.README.md"
readme_template: "${build.thebuild.dir}/defaults/artifact/README.md"

git:
# Git repository for the artifact. This is typically an Acquia or Pantheon git URL.
Expand Down Expand Up @@ -209,7 +209,7 @@ acquia:
# template.
phplint:
# Path to a file where each line is a pattern matching files to lint.
includesfile: "${build.thebuild.dir}/defaults/config/phplint.txt"
includesfile: "${build.thebuild.dir}/defaults/standard/phplint.txt"


# Configuration for using PHP_CodeSniffer to review code according to the Drupal coding
Expand Down Expand Up @@ -246,7 +246,7 @@ phpmd:
# Output format for phpmd.
format: text
# Comma-separated list of ruleset paths or names.
rulesets: "${build.thebuild.dir}/defaults/config/phpmd.xml"
rulesets: "${build.thebuild.dir}/defaults/standard/phpmd.xml"
# File extensions to review.
suffixes: php,inc,module,theme,profile,install,test

Expand All @@ -255,7 +255,7 @@ phpmd:
#
# Putting these flags in configuration allows you to vary the behat configuration per
# environment. Sometimes, there are tests that are appropriate to skip on CI. Compare
# these values to the defaults in build.circleci.properties.yml.
# these values to the defaults in build.circleci.yml.
#
# Also consider:
# * Tagging tests based on where they should run (e.g. '@skipci')
Expand Down
9 changes: 9 additions & 0 deletions defaults/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Contents of the `defaults` directory

| Directory | Contents |
|---|---|
| `artifact/` | Default files used in build artifacts. Override these by editing the `artifact.gitignore_template` and `artifact.readme_template` in your project's properties. |
| `drupal-skeleton/` | Files used for automated testing of the [palantirnet/drupal-skeleton](https://github.com/palantirnet/drupal-skeleton) project. |
| `install/` | Templates used when installing the-build into a project. |
| `install_site/` | Templates used when adding a multisite to a project with the `phing drupal-add-multisite` command. |
| `standard/` | Configuration files and a module that are referenced directly by the-build. |
File renamed without changes.
File renamed without changes.
19 changes: 0 additions & 19 deletions defaults/config/drupal-skeleton/build.test.properties.yml

This file was deleted.

14 changes: 14 additions & 0 deletions defaults/drupal-skeleton/.the-build/build.circleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# These properties are for running the Drupal Skeleton on circle.
drupal:
twig:
debug: false
sites:
default:
database:
database: circle_test
username: root
password: "root"
host: 127.0.0.1

behat:
args: "--profile=circleci --suite=default --strict --format=junit --out=/tmp/artifacts --tags=~@skipci"
32 changes: 32 additions & 0 deletions defaults/drupal-skeleton/.the-build/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# @file
# Build configuration for the palantirnet/drupal-skeleton project.

build:
host: other

drupal:
root: "web"

twig:
debug: true

sites:
default:
dir: default
uri: "drupal-skeleton.local"
hash_salt: "temporary"
profile: standard
database:
database: "drupal"

# Multisites created by `phing drupal-add-multisite` will be automatically added here.
# @multisite_placeholder@

_defaults:
database:
username: "root"
password: "root"
host: "127.0.0.1"

behat:
args: "--suite=default --strict"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ drupal:
sites:
default:
build:
settings_template: .the-build/drupal.settings.build-acquia.php
settings_template: .the-build/drupal/settings.build-acquia.php
services_dest: artifacts/dev/null
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ drupal:
sites:
default:
build:
settings_template: .the-build/drupal.settings.build-pantheon.php
settings_template: .the-build/drupal/settings.build-pantheon.php
services_dest: artifacts/dev/null
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ drupal:
sites:
default:
build:
settings_template: .the-build/drupal.settings.build-platformsh.php
settings_template: .the-build/drupal/settings.build-platformsh.php
services_dest: artifacts/dev/null
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
#
# This file may be customized for your project. The full set of default values can be
# found in the-build's repository.
# @see https://github.com/palantirnet/the-build/blob/release-2.0/defaults.properties.yml
# @see https://github.com/palantirnet/the-build/blob/release-2.0/defaults.yml

# These properties are used when building the settings.php and settings.yml for your
# Drupal site, and by some of the targets in the default build.xml file.
# @see .the-build/drupal.services.yml
# @see .the-build/drupal.settings.php
# @see .the-build/drupal/services.build.yml
# @see .the-build/drupal/settings.build.php
build:
host: ${build.host}

Expand Down Expand Up @@ -47,12 +47,12 @@ drupal:

# Putting these flags in configuration allows you to vary the behat configuration per
# environment. Sometimes, there are tests that are appropriate to skip on CI. Compare
# these values to the defaults in build.circleci.properties.yml.
# these values to the defaults in build.circleci.yml.
behat:
args: "--suite=default --strict"

# To build an artifact from your code, add the URL to your artifact git repository.
# @see https://github.com/palantirnet/the-build/blob/release-2.0/defaults.properties.yml
# @see https://github.com/palantirnet/the-build/blob/release-2.0/defaults.yml
#
# artifact:
# git:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* To customize the configuration:
* - Create a settings.local.php
* - Edit the templates at .the-build/drupal.settings.*.php
* - Edit the templates at .the-build/drupal/settings.*.php
* - Avoid editing this file
*
* @see https://api.drupal.org/api/drupal/sites%21default%21default.settings.php/8.6.x
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions docs/artifacts.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Building an Artifact

You can find the full set of configuration options for artifacts under the 'artifact' property in the [defaults.properties.yml](../defaults.properties.yml) file.
You can find the full set of configuration options for artifacts under the 'artifact' property in the [defaults.yml](../defaults.yml) file.

## Basic configuration

Expand All @@ -12,7 +12,7 @@ artifact:
remote: [email protected]:example.git
```

All artifact configuration should be in your project's base properties file, `.the-build/build.default.properties.yml`.
All artifact configuration should be in your project's base properties file, `.the-build/build.yml`.

## Runtime flags

Expand Down
14 changes: 7 additions & 7 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

## Where to set configuration

In general, you should configure the-build for your project in the `.the-build/build.default.properties.yml` file within your project root.
In general, you should configure the-build for your project in the `.the-build/build.yml` file within your project root.

You can customize your test and prod build behaviors by adding environment-specific configuration to the `.the-build/build.ENVIRONMENT.properties.yml` files.
You can customize your test and prod build behaviors by adding environment-specific configuration to the `.the-build/build.ENVIRONMENT.yml` files.

You can find documentation for the full set of properties used by the-build in the [`defaults.properties.yml`](../defaults.properties.yml) file. Properties and default values can be copied from there into your project's `.the-build/build.default.properties.yml` file.
You can find documentation for the full set of properties used by the-build in the [`defaults.yml`](../defaults.yml) file. Properties and default values can be copied from there into your project's `.the-build/build.yml` file.

## Property loading

Expand Down Expand Up @@ -37,9 +37,9 @@ Cool! This phing-ism is what allows us to do environment-specific property layer
phing build -Dbuild.env=circleci
```
1. Set the `build.dir`, `projectname`, `build.thebuild.dir`, and `build.env` core properties in `tasks/the-build.xml`
1. Load properties from the project's `.the-build/build.[environment].properties.yml`
1. Load properties from the project's `.the-build/build.default.properties.yml`
1. Load default property values from the-build's own `defaults.properties.yml` file
1. Load properties from the project's `.the-build/build.[environment].yml`
1. Load properties from the project's `.the-build/build.yml`
1. Load default property values from the-build's own `defaults.yml` file

In order to support Drupal multisites, site-specific configuration should be set in the `drupal.sites.SITENAME.*` properties, but should be referenced using the `drupal.site.*` properties. See [drupal_multisite.md](drupal_multisite.md) for details on how these properties are provided.

Expand Down Expand Up @@ -71,7 +71,7 @@ These properties are provided by the init process in `the-build.xml`, and do not

## Available properties

All available properties are documented in the-build's [defaults.properties.yml](../defaults.properties.yml) file. This file is also the source of default values for the-build; anything that is not set in your project's `.the-build/build.*.properties.yml` files will be set based on these defaults.
All available properties are documented in the-build's [defaults.yml](../defaults.yml) file. This file is also the source of default values for the-build; anything that is not set in your project's `.the-build/build.*.yml` files will be set based on these defaults.

----
Copyright 2016, 2017, 2018 Palantir.net, Inc.
6 changes: 2 additions & 4 deletions docs/drupal_multisite.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Using Drupal Multisites

Multisite builds are supported under `the-build`. When you have multiple sites configured in your `.the-build/build.default.properties.yml` file, and you run targets like `build` and `install` that act on a specific site, you will be prompted to select a site.
Multisite builds are supported under `the-build`. When you have multiple sites configured in your `.the-build/build.yml` file, and you run targets like `build` and `install` that act on a specific site, you will be prompted to select a site.

These site-specific targets declare a dependency on the `set-site` target in [tasks/the-build.xml](../tasks/the-build.xml), which sets up the site properties in `drupal.site.*`. This allows targets to reference the same properties (e.g. `${drupal.site.uri}`) for each site, rather than needing to reference a site-specific property (e.g. `${drupal.sites.default.uri}`, `${drupal.sites.intranet.uri}`).

Expand All @@ -16,7 +16,7 @@ A target is provided for setting up new multisites:
$> phing drupal-add-multisite
```

This command will prompt you for the Drupal sites subdirectory and the site URL, and then will generate the required `settings.php` files and add the site to `sites.php`. It will output configuration values for you to paste into your `.the-build/build.default.properties.yml`.
This command will prompt you for the Drupal sites subdirectory and the site URL, and then will generate the required `settings.php` files and add the site to `sites.php`. It will output configuration values for you to paste into your `.the-build/build.yml`.

You will still need to manually update your Vagrant, Behat, and CircleCI configuration.

Expand Down Expand Up @@ -68,5 +68,3 @@ With this configuration:
* For `default` and `intranet`, user 1 is named `obscure_admin_name` (inherited from `drupal.sites._defaults`)
* For `conference2019_mysite_com` the admin is named `sarah` (overridden)
* These three sites are found in the directories `web/sites/default`, `web/sites/intranet`, and `web/sites/conference2019.mysite.com` respectively


2 changes: 1 addition & 1 deletion tasks/acquia.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Include this file in your build.xml with:
<import file="vendor/palantirnet/the-build/tasks/acquia.xml" />
@see defaults.properties.yml
@see defaults.yml
Copyright 2016, 2018 Palantir.net, Inc.
-->
Expand Down
4 changes: 2 additions & 2 deletions tasks/artifact.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Targets for managing Drupal code artifacts.
@see docs/artifacts.md
@see defaults.properties.yml
@see defaults.yml
Copyright 2018 Palantir.net, Inc.
-->
Expand All @@ -22,7 +22,7 @@
<!-- This property MUST be provided. -->
<fail unless="artifact.git.remote" message="The remote git repository must be configured in the 'artifact.git.remote' property." />

<!-- Defaults are set in defaults.properties.yml -->
<!-- Defaults are set in defaults.yml -->
<fail unless="artifact.directory" />
<fail unless="artifact.prefix" />
<fail unless="artifact.git.remote_base_branch" />
Expand Down
12 changes: 6 additions & 6 deletions tasks/drupal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Include this file in your build.xml with:
<import file="vendor/palantirnet/the-build/tasks/drupal.xml" />
@see defaults.properties.yml
@see defaults.yml
Copyright 2016, 2018 Palantir.net, Inc.
-->
Expand Down Expand Up @@ -255,7 +255,7 @@ Or, you can specify the export file directly:
<target name="drupal-first-install" depends="set-site">
<fail unless="drupal.site.admin_user" />

<symlink link="${build.dir}/${drupal.root}/modules/contrib/the_build_utility" target="${build.thebuild.dir}/defaults/config/modules/the_build_utility" />
<symlink link="${build.dir}/${drupal.root}/modules/contrib/the_build_utility" target="${build.thebuild.dir}/defaults/standard/modules/the_build_utility" />

<composer command="require" composer="${composer.composer}">
<arg value="drupal/admin_toolbar" />
Expand Down Expand Up @@ -357,7 +357,7 @@ $sites['${_multisite.sites_php_domain}'] = '${_multisite.dir}';


<!--
Generate property configuration for the user to add to their .the-build/build.default.properties.yml file.
Generate property configuration for the user to add to their .the-build/build.yml file.
-->

<!-- Generate a hash salt for Drupal. -->
Expand All @@ -379,7 +379,7 @@ $sites['${_multisite.sites_php_domain}'] = '${_multisite.dir}';
uri: ${_multisite.uri}
hash_salt: ${_multisite.hash_salt}</property>

<reflexive file=".the-build/build.default.properties.yml">
<reflexive file=".the-build/build.yml">
<filterchain>
<replacetokens>
<token key="multisite_placeholder" value="${_multisite.config}" />
Expand All @@ -389,14 +389,14 @@ $sites['${_multisite.sites_php_domain}'] = '${_multisite.dir}';

<!-- If the '@multisite_placeholder@' is missing from the default properties file, the developer will have to
add the configuration manually. -->
<exec command="grep '@multisite_placeholder@' .the-build/build.default.properties.yml" returnProperty="_multisite.placeholder_missing" />
<exec command="grep '@multisite_placeholder@' .the-build/build.yml" returnProperty="_multisite.placeholder_missing" />
<if>
<equals arg1="${_multisite.placeholder_missing}" arg2="1" />
<then>
<!-- Whitespace is intentional. -->
<echo>

To build and install this site, you need to add the following configuration to your .the-build/build.default.properties.yml file:
To build and install this site, you need to add the following configuration to your .the-build/build.yml file:

drupal:
sites:
Expand Down
Loading

0 comments on commit afd5d97

Please sign in to comment.