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

Fixing working directory for drush tasks. #310

Merged
merged 2 commits into from
Aug 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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