-
Notifications
You must be signed in to change notification settings - Fork 396
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
9 changed files
with
101 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace Acquia\Blt\Robo\Hooks; | ||
|
||
use Acquia\Blt\Robo\Config\ConfigAwareTrait; | ||
use Psr\Log\LoggerAwareInterface; | ||
use Psr\Log\LoggerAwareTrait; | ||
use Robo\Contract\ConfigAwareInterface; | ||
use Robo\Contract\IOAwareInterface; | ||
use Robo\Tasks; | ||
|
||
/** | ||
* This class defines hooks that provide user interaction. | ||
* | ||
* These hooks typically use a Wizard to evaluate the validity of config or | ||
* state and guide the user toward resolving issues. | ||
*/ | ||
class InitHook extends Tasks implements IOAwareInterface, ConfigAwareInterface, LoggerAwareInterface { | ||
|
||
use ConfigAwareTrait; | ||
use LoggerAwareTrait; | ||
|
||
/** | ||
* This hook will fire for all commands. | ||
* | ||
* @hook init * | ||
*/ | ||
public function initialize() { | ||
// We set the value for site late in the bootstrap process so that a user | ||
// may define its value at runtime via --define. This can only happen after | ||
// input has been processed. | ||
$site = $this->getConfigValue('site', 'default'); | ||
$this->getConfig()->setSiteConfig($site); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace Acquia\Blt\Robo\Hooks; | ||
|
||
use Acquia\Blt\Robo\Common\IO; | ||
use Acquia\Blt\Robo\Config\ConfigAwareTrait; | ||
use Acquia\Blt\Robo\Inspector\InspectorAwareInterface; | ||
use Acquia\Blt\Robo\Inspector\InspectorAwareTrait; | ||
use League\Container\ContainerAwareInterface; | ||
use League\Container\ContainerAwareTrait; | ||
use Psr\Log\LoggerAwareInterface; | ||
use Psr\Log\LoggerAwareTrait; | ||
use Robo\Contract\ConfigAwareInterface; | ||
|
||
/** | ||
* | ||
*/ | ||
class WebServerHook implements ConfigAwareInterface, ContainerAwareInterface, LoggerAwareInterface, InspectorAwareInterface { | ||
|
||
use ConfigAwareTrait; | ||
use ContainerAwareTrait; | ||
use LoggerAwareTrait; | ||
use InspectorAwareTrait; | ||
use IO; | ||
|
||
protected $serverUrl; | ||
protected $serverPort; | ||
|
||
/** | ||
* @hook pre-command @launchWebServer | ||
*/ | ||
public function launchWebServer() { | ||
if ($this->getConfigValue('behat.run-server')) { | ||
$this->serverUrl = $this->getConfigValue('behat.server.url'); | ||
$this->killWebServer(); | ||
$this->say("Launching PHP's internal web server via drush."); | ||
$this->logger->info("Running server at $this->serverUrl..."); | ||
$this->getContainer()->get('executor')->drush("runserver $this->serverUrl > /dev/null")->background(TRUE)->run(); | ||
$this->getContainer()->get('executor')->waitForUrlAvailable($this->serverUrl); | ||
} | ||
} | ||
|
||
/** | ||
* @hook post-command @launchWebServer | ||
*/ | ||
public function killWebServer() { | ||
$this->getContainer()->get('executor')->killProcessByName('runserver'); | ||
$this->getContainer()->get('executor')->killProcessByPort($this->getConfigValue('behat.server.port')); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters