Skip to content

Commit

Permalink
Adding local.protocol and local.hostname.
Browse files Browse the repository at this point in the history
  • Loading branch information
grasmash committed Jun 8, 2016
1 parent 151ef44 commit 0799c2d
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 13 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ cache:
apt: true
directories:
- "$HOME/.composer/cache"
- "$HOME/.console"
- "$HOME/.drush/cache"
- "$HOME/.nvm"
- "vendor"
Expand Down Expand Up @@ -39,6 +40,8 @@ before_install:
install:
- composer install
- export PATH=$TRAVIS_BUILD_DIR/vendor/bin:$PATH
# Initialize drupal consile default configuration.
- drupal init

before_script:
# Clear drush release history cache, to pick up new releases.
Expand All @@ -49,13 +52,18 @@ before_script:
script:
# Generate a new 'blted' project.
- ./blt.sh configure
# The local.hostname must be set to 127.0.0.1:8888 because we are using drush runserver to run the site on Travis CI.
- drupal yaml:update:value project.yml project.local.hostname '127.0.0.1:8888'
- ./blt.sh create
# Call targets in the new 'blted' project.
- ../blted8/blt.sh ci:build:validate:test -Dcreate_alias=false -Dbehat.run-server=true -Dbehat.launch-phantom=true
# Debug:
- cat ../blted8/docroot/sites/default/local.drushrc.php
# Deploy build artifact.
- ../blted8/blt.sh deploy:artifact:build -Ddeploy.commitMsg="Automated commit by Travis CI for Build ${TRAVIS_BUILD_ID}" -Ddeploy.branch="8.x-build"
# Validate and run 'blt' phpunit tests.
- phpcs --standard=../blted8/vendor/drupal/coder/coder_sniffer/Drupal/ruleset.xml tests
# Run phpunit tests, excluding deploy-push tests.
- phpunit tests/phpunit --exclude-group deploy-push

deploy:
Expand Down
13 changes: 4 additions & 9 deletions build/phing/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

<!-- Load the root project.yml file for this project. -->
<property file="${blt.root}/project.yml" override="true"/>
<!-- Load the core build.yml. -->
<property file="${blt.root}/template/build/core/phing/build.yml" />

<taskdef name="randomString" classname="${blt.root}.vendor.platinumpixs.phing-random-string.src.PlatinumPixs.RandomString.GenerateTask" />

Expand All @@ -26,7 +28,6 @@
<target name="clean" description="Removes generated configuration files from BLT directory.">
<delete file="${blt.root}/project.yml" quiet="true"/>
<delete file="${blt.root}/local.settings.php" quiet="true"/>
<delete file="${blt.root}/local.drushrc.php" quiet="true"/>
<delete file="${blt.root}/template/sites/default/settings/local.settings.php" quiet="true"/>
<delete file="${blt.root}/template/tests/behat/local.yml" quiet="true"/>
<delete dir="${blt.root}/template/vendor" quiet="true"/>
Expand All @@ -42,18 +43,12 @@
<expandproperties />
</filterchain>
</copy>
<copy file="${blt.root}/template/docroot/sites/default/settings/default.local.settings.php" tofile="${blt.root}/local.settings.php" />
<copy file="${blt.root}/template/docroot/sites/default/default.local.drushrc.php" tofile="${blt.root}/local.drushrc.php">
<filterchain>
<expandproperties />
</filterchain>
</copy>
<copy file="${blt.root}/template/docroot/sites/default/settings/default.local.settings.php" tofile="${blt.root}/local.settings.php"/>

<echo></echo>
<echo>The following files have been generated:</echo>
<echo>${blt.root}/project.yml</echo>
<echo>${blt.root}/local.settings.php</echo>
<echo>${blt.root}/local.drushrc.php</echo>
<echo></echo>
<echo>Modify these files and then run "./blt.sh create" to generate a new project.</echo>
</target>
Expand Down Expand Up @@ -103,7 +98,7 @@
<!-- Copy configuration files to new project. -->
<copy file="${blt.root}/project.yml" tofile="${blt.new.dir}/project.yml" overwrite="true" />
<copy file="${blt.root}/local.settings.php" tofile="${blt.new.dir}/docroot/sites/default/settings/local.settings.php" overwrite="true" />
<copy file="${blt.root}/local.drushrc.php" tofile="${blt.new.dir}/docroot/sites/default/local.drushrc.php" overwrite="true">
<copy file="${blt.root}/template/docroot/sites/default/default.local.drushrc.php" tofile="${blt.new.dir}/docroot/sites/default/local.drushrc.php">
<filterchain>
<expandproperties />
</filterchain>
Expand Down
4 changes: 4 additions & 0 deletions template/build/core/phing/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ multisite:
reports:
localDir: ${repo.root}/reports
remoteDir: reports

project:
local:
uri: ${project.local.protocol}://${project.local.hostname}
2 changes: 1 addition & 1 deletion template/build/core/phing/tasks/properties.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
<phpVariable file="${repo.root}/drush/drushrc.php" variable="options[uri]" outputProperty="local_url" />

<!-- Default drush alias. -->
<property name="drush.alias" value="self" override="false" />
<property name="drush.alias" value="${drush.default_alias}" override="false" />
</project>
2 changes: 1 addition & 1 deletion template/docroot/sites/default/default.local.drushrc.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* Local drush configuration for this project.
*/

$options['uri'] = 'http://127.0.0.1:8888';
$options['uri'] = '${project.local.uri}';
6 changes: 6 additions & 0 deletions template/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ project:
- thunder
# These are random strings used to configure the hash salt.
hash_salt: ${project.hash_salt}
# This will be used as the local uri for all developers.
local:
protocol: http
hostname: ${project.machine_name}.localhost

# Configuration settings for new git repository.
git:
Expand All @@ -33,6 +37,8 @@ drush:
local: self
# The drush alias against which all ci commands are run.
ci: self
# The default drush alias to be used when no environment is specified.
default_alias: ${drush.aliases.local}

# Hosting environment flags.
# Examples: acsf (Acquia Cloud Site Factory), ac (Acquia Cloud)
Expand Down
2 changes: 1 addition & 1 deletion template/tests/behat/example.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ local:
Behat\MinkExtension:
javascript_session: selenium2
# configure the base url for your site
base_url: ${local_url}
base_url: ${project.local.uri}
# set default command for "Show last response" step.
show_cmd: "open %s"
# ADDITIONAL OPTIONS FOR WEB DRIVERS
Expand Down
2 changes: 1 addition & 1 deletion template/tests/phpunit/DrushTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function testDrushConfig() {
print "Executing \"$command\" in $dir \n";
// If it contains the local URI, we know it is correctly loading
// drushrc.php.
$this->assertContains('http://127.0.0.1:8888', shell_exec($command));
$this->assertContains($this->config['project.local.hostname'], shell_exec($command));
}
}

Expand Down

0 comments on commit 0799c2d

Please sign in to comment.