Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multisite support for setup tasks #1005

Closed
wants to merge 88 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
c6cc1f7
add multisite support for setup tasks
bobbygryzynger Jan 21, 2017
dc16993
Merge branch '8.x' into issue-799--multisite-support-tasks
bobbygryzynger Jan 21, 2017
3e52225
putting passthru=false back in place
bobbygryzynger Jan 21, 2017
df16f8b
whitespace addition
bobbygryzynger Jan 21, 2017
6536078
add config file loading blocks
bobbygryzynger Jan 21, 2017
d45c407
name site files project.[site-name].yml
bobbygryzynger Jan 24, 2017
ff9276d
additional setup logic for Drupal settings when a site's directory do…
bobbygryzynger Jan 24, 2017
473c22f
add missing default.local.drushrc.php file, which is called for in se…
bobbygryzynger Jan 24, 2017
c0f49c2
add travis commands for creating sample site config - WIP
bobbygryzynger Jan 24, 2017
6f1d912
add initial keys to yaml file
bobbygryzynger Jan 24, 2017
d8b297a
build yaml keys with successive echos
bobbygryzynger Jan 24, 2017
148aec5
remove debug statement
bobbygryzynger Jan 24, 2017
808d530
add additional tests for Drush and Drupal settings
bobbygryzynger Jan 25, 2017
83ae9f2
reformat code
bobbygryzynger Jan 25, 2017
f8767fe
fix path to blt tests
bobbygryzynger Jan 25, 2017
852b9e4
reset path to phpunit xml
bobbygryzynger Jan 25, 2017
375d55b
run phpunit tests with debug flag
bobbygryzynger Jan 25, 2017
ac6677b
run phpunit tests with verbose flag
bobbygryzynger Jan 25, 2017
91e63fc
listing test groups
bobbygryzynger Jan 25, 2017
23685cd
list tests from blt directory
bobbygryzynger Jan 25, 2017
774234d
ensure blt/sites exists before scanning it
bobbygryzynger Jan 25, 2017
fb18b87
fix path to phpunit xml
bobbygryzynger Jan 25, 2017
3d7f57e
add verbose test output
bobbygryzynger Jan 25, 2017
56eb635
run tests in debug mode
bobbygryzynger Jan 25, 2017
59fb677
debugging output
bobbygryzynger Jan 25, 2017
f85a3b9
more debugging output
bobbygryzynger Jan 25, 2017
e2f6ce5
debugging output
bobbygryzynger Jan 25, 2017
74115f5
more debugging output
bobbygryzynger Jan 25, 2017
b5d519c
remove debugging statements, fix path
bobbygryzynger Jan 25, 2017
4be582d
add comment
bobbygryzynger Jan 25, 2017
e6819ba
use in_array instead of empty
bobbygryzynger Jan 25, 2017
eeef16f
setup settings during general setup task
bobbygryzynger Jan 25, 2017
2f6d775
remove debugging flags
bobbygryzynger Jan 25, 2017
dc44ecb
first ensure file exists before checking its contents
bobbygryzynger Jan 25, 2017
b01d9ce
update file naming pattern
Jan 25, 2017
89e99ef
Merge branch '8.x' into issue-799--multisite-support-tasks
bobbygryzynger Jan 25, 2017
580ee48
revert typo fixes
Jan 25, 2017
ef5f1e2
update patterns, ensure the default site is always listed as a site
Jan 25, 2017
4e1ae2d
add property parsing test - WIP
Jan 25, 2017
10deb8c
add directory slash
Jan 25, 2017
9e51044
test parsing of site-specific properties
bobbygryzynger Jan 26, 2017
6e3aa55
reformat code
bobbygryzynger Jan 26, 2017
f6bb60c
separate blt settings test and settings.php test
bobbygryzynger Jan 26, 2017
44c7745
whitespace
bobbygryzynger Jan 26, 2017
6808fa5
remove unnecessary character
bobbygryzynger Jan 26, 2017
fe02813
revise spacing
bobbygryzynger Jan 26, 2017
1a88107
revert whitespace revision within command
bobbygryzynger Jan 26, 2017
44f70ac
add docblocks
bobbygryzynger Jan 26, 2017
03c2f9e
add new line
bobbygryzynger Jan 26, 2017
b2323fa
remove quotes
bobbygryzynger Jan 26, 2017
ff982c0
add param type
bobbygryzynger Jan 26, 2017
57f22e5
documentation style
bobbygryzynger Jan 26, 2017
0095c7e
use consistent expression
bobbygryzynger Jan 26, 2017
5290097
don't capture quotes, refine expression
bobbygryzynger Jan 26, 2017
4625bfd
allow colons and slashes
bobbygryzynger Jan 26, 2017
60490ee
escape slash
bobbygryzynger Jan 26, 2017
855fe6b
make assertion function protected
bobbygryzynger Jan 26, 2017
41e4c35
allow '@' symbol
bobbygryzynger Jan 26, 2017
5bcb1e7
refine expression
bobbygryzynger Jan 26, 2017
3b372c3
allow commas, check additional property
bobbygryzynger Jan 26, 2017
1bb5e4f
refine regular expressions
bobbygryzynger Jan 26, 2017
a3bc6ad
making argument checking function reusable - WIP
bobbygryzynger Jan 26, 2017
33d46f4
refatoring, add docblock
Jan 26, 2017
ebb5120
ruleset fixes
Jan 26, 2017
8fe4313
put additional tests in the blt-multisite group
Jan 26, 2017
fd5815a
group all multisite related commands together
Jan 26, 2017
0e9e164
keep commands on same line
Jan 26, 2017
f197804
quote arguments
Jan 26, 2017
9c861f2
single line of command arguments
Jan 26, 2017
8eb747e
run blt setup:settings after new file is added
Jan 26, 2017
4f94f55
fix multisite list building when there are no site-specific config files
Jan 26, 2017
07bff38
strip trailing comma after all other work is done
Jan 26, 2017
4161f63
refactor site list building logic
Jan 26, 2017
8e5600d
make local:sync dependent on setup:settings
Jan 26, 2017
95182ed
decouple property file loading from site list building
Jan 26, 2017
c16ecc0
enforce the site name being a word
Jan 26, 2017
06acb54
use plural
Jan 26, 2017
11ec097
use testing values that aren't the same as the default values
Jan 26, 2017
28a942b
run tests against the single site
bobbygryzynger Jan 27, 2017
25d8e13
flesh out docs, provide full path to blt bin
bobbygryzynger Jan 27, 2017
49cc11d
use bootstrap files instead of command-line parsing
Jan 27, 2017
a926bc5
ruleset fixes
Jan 27, 2017
1c2990e
remove blt-project group
Jan 27, 2017
f6428b2
coding standards
Jan 27, 2017
0ad9334
fix value
Jan 27, 2017
a592ec7
fix property name
Jan 27, 2017
b01b88b
fix key and run project test against multisite config
Jan 27, 2017
dca8d32
adds a negative case test
bobbygryzynger Feb 1, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,24 @@ script:
- blt ci:build:validate:test -Dcreate_alias=false -Dbehat.run-server=true -Dbehat.launch-phantom=true -Dblt.verbose=true
# Run 'blt-project' tests.
- phpunit ../blt/tests/phpunit --group blt-project
# Run 'blt-multisite' tests against the single site.
- phpunit ../blt/tests/phpunit --group blt-multisite --bootstrap ../blt/tests/phpunit/bootstrap/site.php
# Create a site-specific settings file and give it some values.
- mkdir -p blt/sites
# Create initial keys.
- echo "drush:" >> blt/sites/project.subsite.yml
- echo "uri:" >> blt/sites/project.subsite.yml
# Update values.
- yaml-cli update:value blt/sites/project.subsite.yml drush.aliases.ci 'subsite.ci.local'
- yaml-cli update:value blt/sites/project.subsite.yml uri.ci '127.0.0.1:3000'
- cat blt/sites/project.subsite.yml
# Run settings setup with the new file in place.
- blt setup:settings
# Run 'blt-project' tests again with new file in place.
- phpunit ../blt/tests/phpunit --group blt-project
# Run 'blt-multisite' tests,
# ensuring we are able use the properties in blt/sites/project.subsite.yml (created above).
- phpunit ../blt/tests/phpunit --group blt-multisite --bootstrap ../blt/tests/phpunit/bootstrap/multisite.php
# Initialize ACSF config.
- blt acsf:init
# Ensure that the doctor doesn't report any problems at this point.
Expand Down
8 changes: 6 additions & 2 deletions phing/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ blt:
local: ${repo.root}/blt/project.local.yml
example-local: ${repo.root}/blt/example.project.local.yml
schema-version: ${repo.root}/blt/.schema_version
config-dirs:
sites: ${repo.root}/blt/sites

composer:
bin: ${repo.root}/${bin.path}
Expand Down Expand Up @@ -59,9 +61,9 @@ drupal:

drush:
bin: ${composer.bin}/drush
cmd: ${drush.bin} @${drush.alias} -l ${multisite.name}
cmd: ${drush.bin} @${drush.alias} -r ${docroot} -l ${site.uri.${environment}}
dir: ${docroot}
uri: ${multisite.name}
uri: ${site.uri.${environment}}
assume: yes
passthru: yes
logoutput: yes
Expand Down Expand Up @@ -95,3 +97,5 @@ phpcs:
project:
local:
uri: ${project.local.protocol}://${project.local.hostname}
ci:
uri: 127.0.0.1:8888
2 changes: 1 addition & 1 deletion phing/tasks/local-sync.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</target>

<target name="local:sync" description="Synchronize local environment from remote (remote --> local)."
depends="setup:drupal:settings">
depends="setup:settings">
<drush command="cc drush"/>
<drush command="sql-drop"/>
<if>
Expand Down
55 changes: 54 additions & 1 deletion phing/tasks/properties.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,60 @@
</then>
</if>

<echo level="verbose">Executing commands against multisite "${multisite.name}"</echo>
<!-- Set the default site to operate against. -->
<property name="multisite.default" value="default" override="false" />
<property name="site.name" value="${multisite.default}" override="false" />

<!-- Build the site list from project.[site-name].yml files in the blt/sites directory. -->
<if>
<available file="${blt.config-dirs.sites}"/>
<then>
<exec dir="${blt.config-dirs.sites}"
command="ls -1 | grep -E 'project\.\w+\.yml' | sed -E s/project.\|.yml//g | tr '\n' ','"
outputProperty="multisite.names"/>
</then>
</if>

<!-- Ensure the site list has, at minimum, the default site. -->
<if>
<not><isset property="multisite.names"/></not>
<then>
<property name="multisite.names" value="${multisite.default}"/>
</then>
<else>
<!-- There are sites in the list, ensure the default site appears as well. -->
<if>
<not><contains string="${multisite.names}" substring="${multisite.default}"/></not>
<then>
<property name="multisite.names" value="${multisite.default},${multisite.names}" override="true"/>
</then>
</if>
<!-- Strip out the trailing comma from site list. -->
<propertyregex subject="${multisite.names}" pattern=",$" replace="" property="multisite.names" override="true"/>
</else>
</if>

<!-- Load default site properties if overrides are provided. -->
<if>
<available filepath="${blt.config-dirs.sites}" file="project.${site.name}.yml" />
<then>
<property file="${blt.config-dirs.sites}/project.${site.name}.yml" prefix="site" logoutput="false"/>
</then>
</if>

<!-- Set site aliases if not already set by project.${site.name}.yml. -->
<property name="site.drush.aliases.local" value="${drush.aliases.local}" override="false"/>
<property name="site.drush.aliases.remote" value="${drush.aliases.remote}" override="false"/>
<property name="site.drush.aliases.ci" value="${drush.aliases.ci}" override="false"/>

<!-- Set site uris if not already set by project.${site.name}.yml. -->
<property name="site.uri.local" value="${project.local.uri}" override="false"/>
<property name="site.uri.ci" value="${project.ci.uri}" override="false"/>

<echo level="verbose">Executing commands against multisite "${site.name}"</echo>

<!-- If no environment is set, assume we're working locally. -->
<property name="environment" value="local" override="false" logoutput="false"/>

<!-- Default drush alias. -->
<property name="drush.alias" value="${drush.default_alias}" override="false" logoutput="false"/>
Expand Down
Loading