Skip to content

Commit e12739e

Browse files
authored
Merge pull request #21 from dennisinteractive/proposal_console_chains
27689 Proposal for console command changes, removal of hardcoded values.
2 parents 0f7c924 + cbee666 commit e12739e

9 files changed

+113
-68
lines changed

chain/chain-grunt.yml

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

chain/chain-npm.yml

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

chain/chain-site-build.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Usage: drupal site:build --placeholder="name:subscriptions"
1+
# Usage: drupal site:build --placeholder="name:subscriptions" --placeholder="root:\/vagrant\/repos"
22
command:
33
name: site:build
4-
description: 'Performs multiple commands to build a site'
4+
description: 'Builds a new site.'
55
commands:
66
# Checkout site
77
- command: site:checkout
@@ -14,3 +14,4 @@ commands:
1414
options:
1515
placeholder:
1616
- 'name:%{{name}}'
17+
- 'root:%{{root|\/vagrant\/repos}}'

chain/chain-site-compile.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Usage: drupal site:compile --placeholder="name:subscriptions" --placeholder="root:\/vagrant\/repos"
2+
command:
3+
name: site:compile
4+
description: 'Compiles the source, downloading and extracting the packages.'
5+
commands:
6+
# Run composer
7+
- command: site:compose
8+
arguments:
9+
name: '%{{name}}'
10+
# Run npm
11+
- command: exec
12+
arguments:
13+
bin: 'cd %{{root|\/vagrant\/repos}}/%{{name}}/web; find . -type d \( -name node_modules -o -name contrib -o -path ./core \) -prune -o -name package.json -execdir sh -c "npm install" \;'
14+
# Run grunt
15+
- command: exec
16+
arguments:
17+
bin: 'cd %{{root|\/vagrant\/repos}}/%{{name}}/web; find . -type d \( -name node_modules -o -name contrib -o -path ./core \) -prune -o -name Gruntfile.js -execdir sh -c "grunt" \;'

chain/chain-site-configure.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Usage: drupal site:configure --placeholder="name:subscriptions"
2+
command:
3+
name: site:configure
4+
description: 'Generates the necessary configuration files.'
5+
commands:
6+
# Create settings.db.php
7+
- command: site:settings:db
8+
arguments:
9+
name: '%{{name}}'
10+
# Create settings.local.php
11+
- command: site:settings:local
12+
arguments:
13+
name: '%{{name}}'
14+
# Create settings.memcache.php
15+
- command: site:settings:memcache
16+
arguments:
17+
name: '%{{name}}'

chain/chain-site-construct.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Usage: drupal site:construct --placeholder="name:subscriptions" --placeholder="root:\/vagrant\/repos"
2+
command:
3+
name: site:construct
4+
description: 'Sets the site up based on current configuration and database.'
5+
commands:
6+
# Clear cache
7+
- command: exec
8+
arguments:
9+
bin: 'cd %{{root|\/vagrant\/repos}}/%{{name}}/web; drush cr;'
10+
# Set default drush alias
11+
- command: exec
12+
arguments:
13+
bin: 'cd %{{root|\/vagrant\/repos}}/%{{name}}/web; drush site-set @vm;'
14+
# Run db updates
15+
- command: exec
16+
arguments:
17+
bin: 'cd %{{root|\/vagrant\/repos}}/%{{name}}/web; drush updb -y;'
18+
# Import configuration twice to fix a problem with config import when new modules are added to core.extensions.yml
19+
- command: exec
20+
arguments:
21+
bin: 'cd %{{root|\/vagrant\/repos}}/%{{name}}/web; drush cim -y; drush cim -y'
22+
# Clear cache
23+
- command: exec
24+
arguments:
25+
bin: 'cd %{{root|\/vagrant\/repos}}/%{{name}}/web; drush cr;'

chain/chain-site-rebuild-prod.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Usage: drupal site:rebuild:prod --placeholder="name:subscriptions" --placeholder="root:\/vagrant\/repos"
2+
command:
3+
name: site:rebuild:prod
4+
description: 'Peforms necessary steps to build the site from a given source.'
5+
commands:
6+
# Compile the packages.
7+
- command: site:compile
8+
options:
9+
placeholder:
10+
- 'name:%{{name}}'
11+
- 'root:%{{root|\/vagrant\/repos}}'
12+
# Build the site based on existing setup.
13+
- command: site:construct
14+
options:
15+
placeholder:
16+
- 'name:%{{name}}'
17+
- 'root:%{{root|\/vagrant\/repos}}'

chain/chain-site-rebuild.yml

Lines changed: 13 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,26 @@
1-
# Usage: drupal site:rebuild --placeholder="name:subscriptions"
1+
# Usage: drupal site:rebuild --placeholder="name:subscriptions" --placeholder="root:\/vagrant\/repos"
22
command:
33
name: site:rebuild
4-
description: 'Performs multiple commands to build a site (without git checkout)'
4+
description: 'Peforms necessary steps to build the site from a given source.'
55
commands:
6-
# Run composer
7-
- command: site:compose
8-
arguments:
9-
name: '%{{name}}'
10-
# Run npm
11-
- command: site:npm
6+
# Compile the packages.
7+
- command: site:compile
128
options:
139
placeholder:
1410
- 'name:%{{name}}'
15-
# Run grunt
16-
- command: site:grunt
11+
- 'root:%{{root|\/vagrant\/repos}}'
12+
# Generate the settings.
13+
- command: site:configure
1714
options:
1815
placeholder:
1916
- 'name:%{{name}}'
20-
# Create settings.db.php
21-
- command: site:settings:db
22-
arguments:
23-
name: '%{{name}}'
24-
# Create settings.local.php
25-
- command: site:settings:local
26-
arguments:
27-
name: '%{{name}}'
28-
# Create phpunit.xml
29-
- command: site:phpunit:setup
30-
arguments:
31-
name: '%{{name}}'
32-
# Create behat.yml
33-
- command: site:behat:setup
34-
arguments:
35-
name: '%{{name}}'
36-
# Create settings.memcache.php
37-
- command: site:settings:memcache
38-
arguments:
39-
name: '%{{name}}'
4017
# Imports db or installs a site
4118
- command: site:db:import
4219
arguments:
4320
name: '%{{name}}'
44-
# Clear cache
45-
- command: exec
46-
arguments:
47-
bin: 'cd /vagrant/repos/%{{name}}/web; drush cr;'
48-
# Set default drush alias
49-
- command: exec
50-
arguments:
51-
bin: 'cd /vagrant/repos/%{{name}}/web; drush site-set @vm;'
52-
# Run db updates
53-
- command: exec
54-
arguments:
55-
bin: 'cd /vagrant/repos/%{{name}}/web; drush updb -y;'
56-
# Import configuration twice to fix a problem with config import when new modules are added to core.extensions.yml
57-
- command: exec
58-
arguments:
59-
bin: 'cd /vagrant/repos/%{{name}}/web; drush cim -y;drush cim -y'
60-
# Clear cache
61-
- command: exec
62-
arguments:
63-
bin: 'cd /vagrant/repos/%{{name}}/web; drush cr;'
21+
# Build the site based on existing setup.
22+
- command: site:construct
23+
options:
24+
placeholder:
25+
- 'name:%{{name}}'
26+
- 'root:%{{root|\/vagrant\/repos}}'

chain/chain-site-test.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Usage: drupal site:test --placeholder="name:subscriptions" --placeholder="root:\/vagrant\/repos"
2+
command:
3+
name: site:test
4+
description: 'Sets the test suites up and then runs them.'
5+
commands:
6+
# Create phpunit.xml
7+
- command: site:phpunit:setup
8+
arguments:
9+
name: '%{{name}}'
10+
# Create behat.yml
11+
- command: site:behat:setup
12+
arguments:
13+
name: '%{{name}}'
14+
# Run Behat
15+
- command: exec
16+
arguments:
17+
bin: 'cd %{{root|\/vagrant\/repos}}/%{{name}}/tests; ./behat;'
18+
# Run phpunit
19+
- command: exec
20+
arguments:
21+
bin: 'cd %{{root|\/vagrant\/repos}}/%{{name}}; phpunit;'

0 commit comments

Comments
 (0)