2 Commits
0.0.1 ... 0.0.2

3 changed files with 52 additions and 16 deletions

View File

@@ -49,6 +49,20 @@ abstract class Base extends BaseTask
}
}
/**
* {@inheritdoc}
*/
public function run()
{
$command = $this->getCommand();
$this->printTaskInfo(
'Running Docker-Compose: {command}',
['command' => $command]
);
return $this->executeCommand($command);
}
/**
* Get docker-compose command.
*

View File

@@ -60,15 +60,4 @@ class Down extends Base
return $this;
}
/**
* {@inheritdoc}
*/
public function run()
{
$command = $this->getCommand();
$this->printTaskInfo('Docker Down: {command}', ['command' => $command]);
return $this->executeCommand($command);
}
}

View File

@@ -14,6 +14,13 @@ class Up extends Base
*/
protected $action = 'up';
/**
* Docker compose services.
*
* @var array
*/
protected $services = [];
/**
* Command detached mode.
*
@@ -21,6 +28,34 @@ class Up extends Base
*/
protected $detachedMode = false;
/**
* Add docker composer service.
*
* @param string $service
* The docker services.
*/
public function setService($service)
{
$this->services[] = $service;
return $this;
}
/**
* Add docker composer services.
*
* @param array $services
* An array of services.
*/
public function setServices(array $services)
{
foreach ($services as $service) {
$this->setService($service);
}
return $this;
}
/**
* Run containers in the background.
*/
@@ -115,12 +150,10 @@ class Up extends Base
/**
* {@inheritdoc}
*/
public function run()
protected function getCommand()
{
$command = $this->getCommand();
$this->printTaskInfo('Docker Up: {command}', ['command' => $command]);
return $this->executeCommand($command);
// Append the services to the end of the command.
return parent::getCommand() . ' ' . implode(' ', $this->services);
}
/**