Skip to content

Commit

Permalink
Fixing working directory for drush tasks. (#310)
Browse files Browse the repository at this point in the history
* Fixing drush.wrapper integration with Phing.

* Fixing working directory for drush tasks.
  • Loading branch information
grasmash authored Aug 17, 2016
1 parent 6e8fcb1 commit 0fdfae4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ Use the following commands to create a testable BLT-created project alongside BL
git clone https://github.com/acquia/blt.git
cp -R blt/blt-project .
cd blt-project
git init
composer install
./vendor/bin/blt install-alias
blt init
blt configure
rm -rf vendor
composer update
```

Expand Down
3 changes: 1 addition & 2 deletions phing/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
<if>
<available property="xdebug.enabled" extension="xdebug"/>
<then>
<echo level="warning">You are running BLT with xdebug enabled. This has a major impact on
runtime performance.</echo>
<echo level="warning">You are running BLT with xdebug enabled. This has a major impact on runtime performance.</echo>
</then>
</if>

Expand Down
1 change: 1 addition & 0 deletions phing/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ drupal:
drush:
bin: ${composer.bin}/drush
cmd: ${drush.bin} @${drush.alias} -r ${docroot} -l ${multisite.name}
dir: ${repo.root}
root: ${docroot}

multisite:
Expand Down
15 changes: 14 additions & 1 deletion phing/phingcludes/DrushTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class DrushTask extends Task {
private $bin = NULL;
private $alias = NULL;
private $uri = NULL;
private $dir = NULL;
private $root = NULL;
private $assume = NULL;
private $simulate = FALSE;
Expand Down Expand Up @@ -94,6 +95,12 @@ public function setAlias($str) {
$this->alias = $str;
}

/**
* Drupal working directory to use.
*/
public function setDir($str) {
$this->dir = $str;
}
/**
* Drupal root directory to use.
*/
Expand Down Expand Up @@ -206,6 +213,7 @@ public function init() {
$this->root = $this->getProject()->getProperty('drush.root');
$this->uri = $this->getProject()->getProperty('drush.uri');
$this->bin = $this->getProject()->getProperty('drush.bin');
$this->dir = $this->getProject()->getProperty('drush.dir');
}

/**
Expand Down Expand Up @@ -274,8 +282,13 @@ public function main() {

$command = implode(' ', $command);

if (!empty($this->dir)) {
$this->log("Changing working directory to: $this->dir");
chdir($this->dir);
}

// Execute Drush.
$this->log("Executing '$command'...");
$this->log("Executing: $command");
$output = array();
exec($command, $output, $return);
// Collect Drush output for display through Phing's log.
Expand Down

0 comments on commit 0fdfae4

Please sign in to comment.