Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit f2b971e

Browse files
committed
Generating local settings files only via local:setup.
1 parent 77a8549 commit f2b971e

File tree

4 files changed

+42
-43
lines changed

4 files changed

+42
-43
lines changed

phing/tasks/local-sync.xml

+40-1
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,51 @@
88

99
<target name="local:refresh" description="Refreshes local environment from upstream testing database." depends="setup:build, local:sync, local:update"/>
1010

11-
<target name="local:setup" description="Install dependencies, builds docroot, installs Drupal; uses local drush alias.">
11+
<target name="local:setup" description="Install dependencies, builds docroot, installs Drupal; uses local drush alias." depends="local:settings">
1212
<phingcall target="setup">
1313
<property name="drush.alias" value="${drush.aliases.local}" />
1414
</phingcall>
1515
</target>
1616

17+
<target name="local:settings">
18+
<echo>Generating local settings files.</echo>
19+
20+
<if>
21+
<not>
22+
<available file="${repo.root}/project.local.yml" type="file" />
23+
</not>
24+
<then>
25+
<copy file="${repo.root}/example.project.local.yml" tofile="${repo.root}/project.local.yml" />
26+
</then>
27+
</if>
28+
29+
<if>
30+
<not>
31+
<available file="${docroot}/sites/${multisite.name}/settings/local.settings.php" type="file" />
32+
</not>
33+
<then>
34+
<copy file="${docroot}/sites/${multisite.name}/settings/default.local.settings.php" tofile="${docroot}/sites/${multisite.name}/settings/local.settings.php" />
35+
</then>
36+
</if>
37+
38+
<if>
39+
<not>
40+
<available file="${docroot}/sites/${multisite.name}/local.drushrc.php" type="file" />
41+
</not>
42+
<then>
43+
<copy file="${docroot}/sites/${multisite.name}/default.local.drushrc.php" tofile="${docroot}/sites/${multisite.name}/local.drushrc.php"/>
44+
</then>
45+
</if>
46+
47+
<echo>Expanding Phing variables in ${docroot}/sites/${multisite.name}/local.drushrc.php.</echo>
48+
49+
<reflexive file="${docroot}/sites/${multisite.name}/local.drushrc.php">
50+
<filterchain>
51+
<expandproperties />
52+
</filterchain>
53+
</reflexive>
54+
</target>
55+
1756
<target name="local:sync" description="Synchronize remote environment with local environment."
1857
depends="setup:drupal:settings">
1958
<exec dir="${docroot}" command="${drush.cmd} sql-drop -y" logoutput="true" checkreturn="true"/>

phing/tasks/setup.xml

-41
Original file line numberDiff line numberDiff line change
@@ -62,47 +62,6 @@
6262
<chmod mode="0755" failonerror="false" file="${docroot}/sites/default/settings.php"/>
6363
<echo>Ensuring that blt.settings.php is required by settings.php</echo>
6464
<exec dir="${docroot}/sites/default" command="grep blt.settings.php settings.php || echo 'require DRUPAL_ROOT . &quot;/sites/default/settings/blt.settings.php&quot;;' >> settings.php " logoutput="false" checkreturn="true"/>
65-
66-
<echo>Generating local settings files.</echo>
67-
68-
<if>
69-
<not>
70-
<available file="${repo.root}/project.local.yml" type="file" />
71-
</not>
72-
<then>
73-
<copy file="${repo.root}/example.project.local.yml" tofile="${repo.root}/project.local.yml" />
74-
</then>
75-
</if>
76-
77-
<if>
78-
<not>
79-
<available file="${docroot}/sites/${multisite.name}/settings/local.settings.php" type="file" />
80-
</not>
81-
<then>
82-
<copy file="${docroot}/sites/${multisite.name}/settings/default.local.settings.php" tofile="${docroot}/sites/${multisite.name}/settings/local.settings.php" />
83-
</then>
84-
</if>
85-
86-
<if>
87-
<not>
88-
<available file="${docroot}/sites/${multisite.name}/local.drushrc.php" type="file" />
89-
</not>
90-
<then>
91-
<copy file="${docroot}/sites/${multisite.name}/default.local.drushrc.php" tofile="${docroot}/sites/${multisite.name}/local.drushrc.php"/>
92-
</then>
93-
</if>
94-
95-
<echo>Expanding Phing variables in ${docroot}/sites/${multisite.name}/local.drushrc.php.</echo>
96-
97-
<reflexive file="${docroot}/sites/${multisite.name}/local.drushrc.php">
98-
<filterchain>
99-
<expandproperties />
100-
</filterchain>
101-
</reflexive>
102-
103-
<!-- Re-extract value of $options['uri'] in case it was not yet set. -->
104-
<!-- @todo Add multisite support. -->
105-
<phpVariable file="${repo.root}/drush/drushrc.php" variable="options[uri]" outputProperty="local_url" />
10665
</target>
10766

10867
<target name="setup:drupal:install"

scripts/blt/alias

+1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ function blt() {
1010
$GIT_ROOT/vendor/bin/blt "$@"
1111
else
1212
echo "You must run this command from within a BLT-generated project repository."
13+
echo "If you are in a BLT-generated repository, try running 'composer install'."
1314
fi
1415
}

template/tests/phpunit/Bolt/BehatTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function testSetupBehat() {
1717
// Assert that a local.yml file was created in the new project.
1818
$this->assertFileExists($this->projectDirectory . '/tests/behat/local.yml');
1919
$this->assertNotContains(
20-
'${local_url}',
20+
'${local.uri}',
2121
file_get_contents("{$this->projectDirectory}/tests/behat/local.yml")
2222
);
2323
}

0 commit comments

Comments
 (0)