Skip to content

Commit 14543db

Browse files
committed
Case 27689; Updated chains and readme
1 parent ca81e0f commit 14543db

File tree

6 files changed

+109
-82
lines changed

6 files changed

+109
-82
lines changed

README.md

Lines changed: 94 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,85 +10,137 @@ Provides custom Drupal console commands and chains.
1010

1111
curl -L https://goo.gl/UnjUuW | sh
1212

13-
# Commands
13+
## Commands
1414
These are custom commands used to build a site. The information about the site comes from ~/.console/sites/site-name.yml.
1515
e.g. https://raw.githubusercontent.com/dennisinteractive/drupal_console_commands/master/example/site-example.yml
1616

1717
- drupal **site:new**
1818
Builds a new site using Drupal project as template https://github.com/dennisinteractive/drupal-project
19-
- drupal **site:checkout** *site-mame* --
19+
20+
- drupal **site:checkout** *site-name*
2021
Performs a git clone and checks out the specified branch
22+
2123
- drupal **site:compose** *site-name*
22-
Runs *composer install*. Alternatively, it will run *composer update* if there is a composer.lock.
24+
Runs *composer*
25+
26+
- drupal **site:npm** **site:new**
27+
Runs NPM
28+
29+
- drupal **site:grunt** **site:new**
30+
Runs Grunt
31+
2332
- drupal **site:settings:db** *site-name*
2433
Creates *settings.db.php* in the *web/sites/default* folder. This file contains DB credentials and should not be committed.
34+
2535
- drupal **site:settings:local** *site-name*
2636
Creates *settings.local.php* in the *web/sites/default* folder. This file contains local settings overrides and should not be committed.
37+
2738
- drupal **site:settings:memcache** *site-name*
2839
Creates *settings.memcache.php* in the *web/sites/default* folder. This file contains Memcache configuration and should not be committed.
40+
41+
- drupal **site:drush:alias** *site-name*
42+
Sets up drush aliases
43+
2944
- drupal **site:phpunit:setup** *site-name*
3045
Creates *phpunit.xml* in the root. This file contains PHPUnit configuration and should not be committed.
46+
3147
- drupal **site:behat:setup** *site-name*
3248
Creates *behat.yml* in the *tests* folder. This file contains Behat configuration and should not be committed.
49+
3350
- drupal **site:db:import** *site-name*
3451
If a database dump is available, it will drop the current database and import the dump. The db-dump information comes from *~/.console/sites/site-name.yml*.
3552
The command will copy the dump from the original place to */tmp*. If you run the command again, it will only copy the file once the original has changed. This is very useful when working remotely on slow networks.
3653
If no db-dump information is available or there is no dump at the location, it will run a site install.
3754
Supported extensions: **.sql**, **.sql.gz**.
38-
- drupal **site:build**
39-
A chain that will call all the commands below:
40-
- site:checkout
41-
- site:rebuild
42-
- drupal **site:rebuild**
43-
A chain that will call all the commands below:
44-
- site:compile
45-
- site:configure
46-
- site:db:import
47-
- site:construct
48-
- drupal **site:rebuild-prod**
49-
A chain that will call all the commands below:
50-
- site:compile
51-
- site:construct
52-
- drupal **site:npm**
53-
Runs NPM.
54-
- drupal **site:grunt**
55-
Runs Grunt.
56-
- drupal **site:compile**
57-
A chain that will call all the commands below:
58-
- site:compose
59-
- 'exec' command that runs npm in supported directories.
60-
- 'exec' command that runs grunt in supported directories.
61-
- drupal **site:configure**
62-
A chain that will call all the commands below:
55+
56+
## Chains
57+
Chains that can be reused on various environments
58+
59+
- drupal **site:configure** A chain that will call all the commands below:
6360
- site:settings:db
6461
- site:settings:local
6562
- site:settings:memcache
66-
- drupal **site:construct**
67-
A chain that will call all the commands below:
68-
- 'exec' command that clears drupal caches.
69-
- 'exec' command that sets drush aliases.
70-
- 'exec' command that runs drupal updates.
71-
- 'exec' command that imports drupal config twice.
72-
- 'exec' command that clears drupal caches.
73-
- drupal **site:test**
74-
A chain that will call all the commands below:
63+
- site:drush:alias
64+
65+
- drupal **site:update** Used to run updates and import configuration
66+
- drush cr (Clear caches)
67+
- drush site-set @site (Set default drush alias)
68+
- drush updb (Runs updates)
69+
- drush cim (Imports configuration)
70+
- drush cr (Clear caches)
71+
72+
- drupal **site:test:setup** Sets the test suites
7573
- site:phpunit:setup
7674
- site:behat:setup
77-
- 'exec' command that runs behat tests.
78-
- 'exec' command that runs phpunit tests.
7975

80-
# Useful arguments and options
76+
- drupal **site:test** Runs test suites
77+
- site:test:setup
78+
- behat (Runs behat tests)
79+
- phpunit (Runs phpunit tests)
80+
81+
## Environment specific chains
82+
Each environment will have its own chain that executes the relevant commands and chains
83+
84+
### Dev
85+
- drupal **site:build** Builds a site for development
86+
- site:checkout
87+
- site:rebuild (chain)
88+
89+
- drupal **site:rebuild** Performs necessary steps to rebuild the site from a given source
90+
- site:compose
91+
- site:npm
92+
- site:grunt
93+
- site:configure (chain)
94+
- site:test:setup (chain)
95+
- site:db:import
96+
- site:update (chain)
97+
98+
### Artifact
99+
- drupal **site:build** Builds a site for artifacts
100+
- site:checkout
101+
- site:rebuild (chain)
102+
103+
- drupal **site:build:artifact** Prepare artifacts
104+
- site:compose
105+
- site:npm
106+
- site:grunt
107+
108+
### CI
109+
- drupal **site:build:ci** Builds a site for CI
110+
- site:configure (chain)
111+
- site:db:import
112+
- site:update (chain)
113+
- site:test (chain)
114+
115+
### QA
116+
- drupal **site:build:qa** Builds a site for QA
117+
- site:configure (chain)
118+
- site:db:import
119+
- site:update (chain)
120+
- site:test (chain)
121+
122+
### Staging
123+
- drupal **site:build:staging** Builds a site for Staging
124+
- site:configure (chain)
125+
- site:db:import
126+
- site:update (chain)
127+
128+
### Production
129+
- drupal **site:build:prod** Runs updates on production
130+
- site:update (chain)
131+
132+
## Useful arguments and options
81133
- **-h** Show all the available arguments and options
82134
- **--no-interaction** Will execute the command without asking any optional argument
83135

84-
# Environment variables
136+
## Environment variables
85137
By default, the commands will use parameters from the site.yml, but it is possible to override them using environment variables.
86138

87139
For example, to override the root directory you can set the variable before calling `site:build`
88140

89141
`export site_destination_directory="/directory/"`
90142

91-
# Usage example
143+
## Usage example
92144
```
93145
drupal site:build
94146
drupal site:db:import [site_name]
Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
# Usage: drupal site:build:artifact --placeholder="name:subscriptions"
22
command:
33
name: site:build:artifact
4-
description: 'Builds artifacts.'
4+
description: 'Prepare artifacts.'
55
commands:
66
# Run composer.
77
- command: site:compose
8-
options:
9-
placeholder:
10-
- 'name:%{{name}}'
8+
arguments:
9+
name: '%{{name}}'
1110
# Run NPM.
1211
- command: site:npm
13-
options:
14-
placeholder:
15-
- 'name:%{{name}}'
12+
arguments:
13+
name: '%{{name}}'
1614
# Run Grunt.
1715
- command: site:grunt
18-
options:
19-
placeholder:
20-
- 'name:%{{name}}'
16+
arguments:
17+
name: '%{{name}}'

chain/chain-site-build-production.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Usage: drupal site:build:prod --placeholder="name:subscriptions"
22
command:
33
name: site:rebuild:prod
4-
description: 'Builds site for Production.'
4+
description: 'Runs updates on Production.'
55
commands:
66
# Run updates.
77
- command: site:update

chain/chain-site-compile.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

chain/chain-site-rebuild.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,16 @@ command:
55
commands:
66
# Run composer.
77
- command: site:compose
8-
options:
9-
placeholder:
10-
- 'name:%{{name}}'
8+
arguments:
9+
name: '%{{name}}'
1110
# Run NPM.
1211
- command: site:npm
13-
options:
14-
placeholder:
15-
- 'name:%{{name}}'
12+
arguments:
13+
name: '%{{name}}'
1614
# Run Grunt.
1715
- command: site:grunt
18-
options:
19-
placeholder:
20-
- 'name:%{{name}}'
16+
arguments:
17+
name: '%{{name}}'
2118
# Generate the settings.
2219
- command: site:configure
2320
options:

chain/chain-site-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ command:
33
name: site:test
44
description: 'Sets the test suites up and then runs them.'
55
commands:
6-
# Create phpunit.xml
6+
# Set up testing suites
77
- command: site:test:setup
88
arguments:
99
name: '%{{name}}'

0 commit comments

Comments
 (0)