Merge branch 'master' into master
This commit is contained in:
@@ -33,6 +33,9 @@ composer require --dev droath/robo-docker-compose
|
||||
The following commands have been implemented:
|
||||
|
||||
- docker-compose up
|
||||
- docker-compose ps
|
||||
- docker-compose logs
|
||||
- docker-compose pull
|
||||
- docker-compose exec
|
||||
- docker-compose down
|
||||
- docker-compose start
|
||||
|
||||
77
src/Task/Logs.php
Normal file
77
src/Task/Logs.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace Droath\RoboDockerCompose\Task;
|
||||
|
||||
use Droath\RoboDockerCompose\DockerServicesTrait;
|
||||
use Robo\Exception\TaskException;
|
||||
|
||||
/**
|
||||
* Define the docker compose logs task.
|
||||
*/
|
||||
class Logs extends Base
|
||||
{
|
||||
use DockerServicesTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $action = 'logs';
|
||||
|
||||
/**
|
||||
* Produce monochrome output.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function noColor()
|
||||
{
|
||||
$this->option('no-color');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Follow log output.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function follow()
|
||||
{
|
||||
$this->option('follow');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show timestamps.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function timestamps()
|
||||
{
|
||||
$this->option('timestamps');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of lines to show from the end of the logs for
|
||||
* each container.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return $this
|
||||
* @throws TaskException
|
||||
*/
|
||||
public function tail($value = 'all')
|
||||
{
|
||||
if ($value !== 'all' && !is_numeric($value)) {
|
||||
throw new TaskException(
|
||||
__CLASS__,
|
||||
'Provided argument value is invalid.'
|
||||
);
|
||||
}
|
||||
$this->option('tail', $value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
59
src/Task/Ps.php
Normal file
59
src/Task/Ps.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Droath\RoboDockerCompose\Task;
|
||||
|
||||
use Droath\RoboDockerCompose\DockerServicesTrait;
|
||||
|
||||
/**
|
||||
* Define the docker composer ps command.
|
||||
*/
|
||||
class Ps extends Base
|
||||
{
|
||||
use DockerServicesTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $action = 'ps';
|
||||
|
||||
/**
|
||||
* Only display IDs.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function quiet()
|
||||
{
|
||||
$this->option('quiet');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display services.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function services()
|
||||
{
|
||||
$this->option('services');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter services by a property.
|
||||
*
|
||||
* @param string $key
|
||||
* The filter property key.
|
||||
* @param string $value
|
||||
* The filter property value.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function filter($key, $value)
|
||||
{
|
||||
$this->option('filter', "{$key}={$value}");
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
66
src/Task/Pull.php
Normal file
66
src/Task/Pull.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace Droath\RoboDockerCompose\Task;
|
||||
|
||||
use Droath\RoboDockerCompose\DockerServicesTrait;
|
||||
|
||||
/**
|
||||
* Define Docker compose pull command.
|
||||
*/
|
||||
class Pull extends Base
|
||||
{
|
||||
use DockerServicesTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $action = 'pull';
|
||||
|
||||
/**
|
||||
* Pull what it can and ignores images with pull failures.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function ignoreFailures()
|
||||
{
|
||||
$this->option('ignore-pull-failures');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pull multiple images in parallel.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function parallel()
|
||||
{
|
||||
$this->option('parallel');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pull without printing progress information.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function quiet()
|
||||
{
|
||||
$this->option('quiet');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Also pull services declared as dependencies.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function includeDeps()
|
||||
{
|
||||
$this->option('include-deps');
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,22 @@ trait loadTasks
|
||||
return $this->task(Up::class, $pathToDockerCompose);
|
||||
}
|
||||
|
||||
/**
|
||||
* Docker compose ps task.
|
||||
*/
|
||||
protected function taskDockerComposePs($pathToDockerCompose = null)
|
||||
{
|
||||
return $this->task(Ps::class, $pathToDockerCompose);
|
||||
}
|
||||
|
||||
/**
|
||||
* Docker compose logs task.
|
||||
*/
|
||||
protected function taskDockerComposeLogs($pathToDockerCompose = null)
|
||||
{
|
||||
return $this->task(Logs::class, $pathToDockerCompose);
|
||||
}
|
||||
|
||||
/**
|
||||
* Docker compose down task.
|
||||
*/
|
||||
@@ -31,6 +47,14 @@ trait loadTasks
|
||||
return $this->task(Pause::class, $pathToDockerCompose);
|
||||
}
|
||||
|
||||
/**
|
||||
* Docker compose pull task.
|
||||
*/
|
||||
protected function taskDockerComposePull($pathToDockerCompose = null)
|
||||
{
|
||||
return $this->task(Pull::class, $pathToDockerCompose);
|
||||
}
|
||||
|
||||
/**
|
||||
* Docker compose start task.
|
||||
*/
|
||||
@@ -56,7 +80,7 @@ trait loadTasks
|
||||
}
|
||||
|
||||
/**
|
||||
* Docker compose execute task.
|
||||
* Docker compose run task.
|
||||
*/
|
||||
protected function taskDockerComposeRun($pathToDockerCompose = null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user