Skip to content

Commit

Permalink
Format using Tlint
Browse files Browse the repository at this point in the history
  • Loading branch information
mattstauffer committed Oct 12, 2020
1 parent b383e09 commit 41ac728
Show file tree
Hide file tree
Showing 31 changed files with 104 additions and 172 deletions.
2 changes: 0 additions & 2 deletions app/Commands/ListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

use App\InitializesCommands;
use App\Shell\Docker;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use LaravelZero\Framework\Commands\Command;

class ListCommand extends Command
Expand Down
20 changes: 11 additions & 9 deletions app/Commands/StartCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Commands;

use App\InitializesCommands;
use App\Services;
use App\Shell\Docker;
use Illuminate\Support\Str;
use LaravelZero\Framework\Commands\Command;
Expand Down Expand Up @@ -40,17 +39,20 @@ public function startableContainers(): array
})->map(function ($container) {
$label = sprintf('%s - %s', $container['container_id'], $container['names']);

return [$label, function (CliMenu $menu) use ($container, $label) {
$this->start($menu->getSelectedItem()->getText());
return [
$label,
function (CliMenu $menu) use ($container, $label) {
$this->start($menu->getSelectedItem()->getText());

foreach ($menu->getItems() as $item) {
if ($item->getText() === $label) {
$menu->removeItem($item);
foreach ($menu->getItems() as $item) {
if ($item->getText() === $label) {
$menu->removeItem($item);
}
}
}

$menu->redraw();
}];
$menu->redraw();
},
];
}, collect())->toArray();
}

Expand Down
20 changes: 11 additions & 9 deletions app/Commands/StopCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Commands;

use App\InitializesCommands;
use App\Services;
use App\Shell\Docker;
use Illuminate\Support\Str;
use LaravelZero\Framework\Commands\Command;
Expand Down Expand Up @@ -40,17 +39,20 @@ public function stoppableContainers(): array
})->map(function ($container) {
$label = sprintf('%s - %s', $container['container_id'], $container['names']);

return [$label, function(CliMenu $menu) use ($container, $label) {
$this->stop($menu->getSelectedItem()->getText());
return [
$label,
function(CliMenu $menu) use ($container, $label) {
$this->stop($menu->getSelectedItem()->getText());

foreach ($menu->getItems() as $item) {
if ($item->getText() === $label) {
$menu->removeItem($item);
foreach ($menu->getItems() as $item) {
if ($item->getText() === $label) {
$menu->removeItem($item);
}
}
}

$menu->redraw();
}];
$menu->redraw();
},
];
}, collect())->toArray();
}

Expand Down
44 changes: 0 additions & 44 deletions app/Commands/TempInstall.php

This file was deleted.

40 changes: 0 additions & 40 deletions app/Commands/TempUninstall.php

This file was deleted.

7 changes: 4 additions & 3 deletions app/Services/BaseService.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ abstract class BaseService
{
use WritesToConsole;

protected static $category;
protected static $displayName;

protected $organization = 'library'; // Official repositories use `library` as the organization name.
protected $imageName;
protected static $category;
protected $dockerTagsClass = DockerTags::class;
protected $tag;
protected $dockerRunTemplate;
Expand All @@ -38,7 +40,6 @@ abstract class BaseService
protected $shell;
protected $environment;
protected $docker;
protected static $displayName;
protected $useDefaults = false;

public function __construct(Shell $shell, Environment $environment, Docker $docker)
Expand Down Expand Up @@ -139,7 +140,7 @@ protected function prompts(): void
foreach ($this->prompts as $prompt) {
$this->askQuestion($prompt, $this->useDefaults);

while ($prompt['shortname'] === 'volume' && !$this->docker->volumeIsAvailable($this->promptResponses['volume'])) {
while ($prompt['shortname'] === 'volume' && ! $this->docker->volumeIsAvailable($this->promptResponses['volume'])) {
app('console')->error("Volume {$this->promptResponses['volume']} is already in use. Please select a different volume.");
$this->askQuestion($prompt);
}
Expand Down
3 changes: 2 additions & 1 deletion app/Services/Beanstalkd.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

class Beanstalkd extends BaseService
{
protected static $category = Category::CACHE;

protected $organization = 'schickling';
protected $imageName = 'beanstalkd';
protected static $category = Category::CACHE;
protected $defaultPort = 11300;

protected $dockerRunTemplate = '-p "${:port}":11300 \
Expand Down
3 changes: 2 additions & 1 deletion app/Services/DynamoDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

class DynamoDB extends BaseService
{
protected static $category = Category::CACHE;

protected $organization = 'amazon';
protected $imageName = 'dynamodb-local';
protected static $category = Category::CACHE;
protected $defaultPort = 8000;
protected $prompts = [
[
Expand Down
3 changes: 2 additions & 1 deletion app/Services/ElasticSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

class ElasticSearch extends BaseService
{
protected $imageName = 'elasticsearch';
protected static $category = Category::SEARCH;

protected $imageName = 'elasticsearch';
protected $defaultPort = 9200;
protected $prompts = [
[
Expand Down
3 changes: 2 additions & 1 deletion app/Services/InfluxDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

class InfluxDB extends BaseService
{
protected $imageName = 'influxdb';
protected static $category = Category::DATABASE;

protected $imageName = 'influxdb';
protected $defaultPort = 8086;
protected $prompts = [
[
Expand Down
5 changes: 3 additions & 2 deletions app/Services/MailHog.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@

class MailHog extends BaseService
{
protected static $category = Category::MAIL;

protected $organization = 'mailhog';
protected $imageName = 'mailhog';
protected static $category = Category::MAIL;
protected $defaultPort = 1025;
protected $prompts = [
[
'shortname' => 'web_port',
'prompt' => 'What will the web port be?',
'default' => '8025',
]
],
];

protected $dockerRunTemplate = '-p "${:port}":1025 \
Expand Down
3 changes: 2 additions & 1 deletion app/Services/MariaDb.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

class MariaDb extends BaseService
{
protected $imageName = 'mariadb';
protected static $category = Category::DATABASE;

protected $imageName = 'mariadb';
protected $defaultPort = 3306;
protected $prompts = [
[
Expand Down
3 changes: 2 additions & 1 deletion app/Services/MeiliSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

class MeiliSearch extends BaseService
{
protected static $category = Category::SEARCH;

protected $organization = 'getmeili';
protected $imageName = 'meilisearch';
protected static $category = Category::SEARCH;
protected $defaultPort = 7700;
protected $prompts = [
[
Expand Down
3 changes: 2 additions & 1 deletion app/Services/Memcached.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

class Memcached extends BaseService
{
protected $imageName = 'memcached';
protected static $category = Category::CACHE;

protected $imageName = 'memcached';
protected $defaultPort = 11211;
protected $prompts = [];

Expand Down
3 changes: 2 additions & 1 deletion app/Services/Minio.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

class Minio extends BaseService
{
protected static $category = Category::STORAGE;

protected $organization = 'minio';
protected $imageName = 'minio';
protected static $category = Category::STORAGE;
protected $defaultPort = 9000;
protected $prompts = [
[
Expand Down
3 changes: 2 additions & 1 deletion app/Services/Mongo.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

class Mongo extends BaseService
{
protected $imageName = 'mongo';
protected static $category = Category::DATABASE;

protected $imageName = 'mongo';
protected $defaultPort = 27017;
protected $dockerTagsClass = MongoDockerTags::class;
protected $prompts = [
Expand Down
3 changes: 2 additions & 1 deletion app/Services/MsSql.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

class MsSql extends BaseService
{
protected static $category = Category::DATABASE;

protected $organization = 'mcr.microsoft.com';
protected $imageName = 'mssql/server';
protected static $category = Category::DATABASE;
protected $dockerTagsClass = MicrosoftDockerTags::class;
protected $defaultPort = 1433;
protected $prompts = [
Expand Down
3 changes: 2 additions & 1 deletion app/Services/MySql.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

class MySql extends BaseService
{
protected $imageName = 'mysql';
protected static $category = Category::DATABASE;

protected $imageName = 'mysql';
protected $defaultPort = 3306;
protected $prompts = [
[
Expand Down
3 changes: 2 additions & 1 deletion app/Services/PostgreSql.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

class PostgreSql extends BaseService
{
protected $imageName = 'postgres';
protected static $category = Category::DATABASE;

protected $imageName = 'postgres';
protected $defaultPort = 5432;
protected $prompts = [
[
Expand Down
3 changes: 2 additions & 1 deletion app/Services/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

class Redis extends BaseService
{
protected $imageName = 'redis';
protected static $category = Category::CACHE;

protected $imageName = 'redis';
protected $defaultPort = 6379;
protected $prompts = [
[
Expand Down
3 changes: 1 addition & 2 deletions app/Shell/Docker.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Exception;
use Illuminate\Support\Collection;
use Symfony\Component\Process\Process;

class Docker
{
Expand Down Expand Up @@ -131,7 +130,7 @@ public function bootContainer(string $dockerRunTemplate, array $parameters): voi
$process = $this->shell->exec('docker run -d --name "${:container_name}" ' . $dockerRunTemplate, $parameters);

if (! $process->isSuccessful()) {
throw new Exception("Failed installing " . $parameters['image_name']);
throw new Exception("Failed installing " . $parameters['image_name']);
}
}

Expand Down
Loading

0 comments on commit 41ac728

Please sign in to comment.