From 2800a55776a72b7b0bad1df506760b755769f51d Mon Sep 17 00:00:00 2001 From: Travis Tomka Date: Sat, 14 Apr 2018 13:36:15 -0600 Subject: [PATCH 1/3] Add docker compose pull command to the project. --- README.md | 1 + src/Task/Pull.php | 66 ++++++++++++++++++++++++++++++++++++++++++ src/Task/loadTasks.php | 9 +++++- 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 src/Task/Pull.php diff --git a/README.md b/README.md index 196a469..7ed15f2 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ composer require --dev droath/robo-docker-compose The following commands have been implemented: - docker-compose up +- docker-compose pull - docker-compose exec - docker-compose down - docker-compose start diff --git a/src/Task/Pull.php b/src/Task/Pull.php new file mode 100644 index 0000000..de26c63 --- /dev/null +++ b/src/Task/Pull.php @@ -0,0 +1,66 @@ +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; + } +} diff --git a/src/Task/loadTasks.php b/src/Task/loadTasks.php index 8162800..66b33c3 100755 --- a/src/Task/loadTasks.php +++ b/src/Task/loadTasks.php @@ -31,6 +31,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. */ @@ -54,5 +62,4 @@ trait loadTasks { return $this->task(Execute::class, $pathToDockerCompose); } - } From 8ff8ed66bfb017199e1188f8802c472d89685692 Mon Sep 17 00:00:00 2001 From: Travis Tomka Date: Sat, 28 Apr 2018 12:33:19 -0600 Subject: [PATCH 2/3] Add the docker-composer ps command. --- README.md | 1 + src/Task/Ps.php | 59 ++++++++++++++++++++++++++++++++++++++++++ src/Task/loadTasks.php | 8 ++++++ 3 files changed, 68 insertions(+) create mode 100644 src/Task/Ps.php diff --git a/README.md b/README.md index 7ed15f2..065df9a 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ composer require --dev droath/robo-docker-compose The following commands have been implemented: - docker-compose up +- docker-compose ps - docker-compose pull - docker-compose exec - docker-compose down diff --git a/src/Task/Ps.php b/src/Task/Ps.php new file mode 100644 index 0000000..459f4ac --- /dev/null +++ b/src/Task/Ps.php @@ -0,0 +1,59 @@ +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; + } +} diff --git a/src/Task/loadTasks.php b/src/Task/loadTasks.php index 66b33c3..92aa453 100755 --- a/src/Task/loadTasks.php +++ b/src/Task/loadTasks.php @@ -15,6 +15,14 @@ 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 down task. */ From c3fee3173745001198f25f24718035ee137f1964 Mon Sep 17 00:00:00 2001 From: Travis Tomka Date: Sat, 28 Apr 2018 13:14:06 -0600 Subject: [PATCH 3/3] Add the docker-compose logs command. --- README.md | 1 + src/Task/Logs.php | 77 ++++++++++++++++++++++++++++++++++++++++++ src/Task/loadTasks.php | 8 +++++ 3 files changed, 86 insertions(+) create mode 100644 src/Task/Logs.php diff --git a/README.md b/README.md index 065df9a..4d25c6d 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ The following commands have been implemented: - docker-compose up - docker-compose ps +- docker-compose logs - docker-compose pull - docker-compose exec - docker-compose down diff --git a/src/Task/Logs.php b/src/Task/Logs.php new file mode 100644 index 0000000..dc12767 --- /dev/null +++ b/src/Task/Logs.php @@ -0,0 +1,77 @@ +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; + } +} diff --git a/src/Task/loadTasks.php b/src/Task/loadTasks.php index 92aa453..87e3fcd 100755 --- a/src/Task/loadTasks.php +++ b/src/Task/loadTasks.php @@ -23,6 +23,14 @@ trait loadTasks 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. */