-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
936b9d3
commit aac5180
Showing
2 changed files
with
65 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,46 @@ | ||
<?php | ||
<?php /** @noinspection PhpUnhandledExceptionInspection */ | ||
|
||
/** @noinspection PhpMissingFieldTypeInspection */ | ||
|
||
namespace App\Containers\Commands; | ||
|
||
use App\Exceptions\DockerServiceNotFoundException; | ||
use App\Services\DockerService; | ||
use App\Services\TerminalService; | ||
use Illuminate\Contracts\Container\BindingResolutionException; | ||
use LaravelZero\Framework\Commands\Command; | ||
namespace App\Containers\Commands; | ||
|
||
class Composer extends Command{ | ||
protected $signature = 'composer'; | ||
use App\Services\DockerService; | ||
use App\Services\TerminalService; | ||
use LaravelZero\Framework\Commands\Command; | ||
|
||
protected $description = 'Runs a composer command'; | ||
class Composer extends Command | ||
{ | ||
protected $signature = 'composer'; | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
$this->ignoreValidationErrors(); | ||
} | ||
|
||
/** | ||
* @param DockerService $docker_service | ||
* @param TerminalService $terminal | ||
* | ||
* @return int | ||
* @throws DockerServiceNotFoundException | ||
* @throws BindingResolutionException | ||
*/ | ||
public function handle(DockerService $docker_service, TerminalService $terminal){ | ||
|
||
$terminal->init($this->output); | ||
|
||
$arguments = (string) $this->input; | ||
|
||
if(empty($arguments)){ | ||
$this->info('Log into Composer Shell'); | ||
|
||
return $terminal->execute([ | ||
'docker-compose', | ||
'run', | ||
'--rm', | ||
'composer', | ||
'bash', | ||
]); | ||
} else{ | ||
$composer_commands = explode(' ', $arguments); | ||
$commands = array_merge(['composer'], $composer_commands); | ||
return $docker_service->service('composer')->run($terminal, $commands); | ||
} | ||
protected $description = 'Runs a composer command'; | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
$this->ignoreValidationErrors(); | ||
} | ||
|
||
public function handle(DockerService $docker_service, TerminalService $terminal): int | ||
{ | ||
$terminal->init($this->output); | ||
|
||
$arguments = (string) $this->input; | ||
|
||
if (empty($arguments)) { | ||
$this->info('Log into Composer Shell'); | ||
|
||
return $terminal->execute([ | ||
'docker-compose', | ||
'run', | ||
'--rm', | ||
'composer', | ||
'bash', | ||
]); | ||
} else { | ||
$composer_commands = explode(' ', $arguments); | ||
$commands = array_merge(['composer'], $composer_commands); | ||
return $docker_service->service('composer')->run($terminal, $commands); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,41 +1,45 @@ | ||
<?php | ||
<?php /** @noinspection PhpUnhandledExceptionInspection */ | ||
|
||
/** @noinspection PhpMissingFieldTypeInspection */ | ||
|
||
namespace App\Containers\Commands; | ||
|
||
use App\Exceptions\DockerServiceNotFoundException; | ||
namespace App\Containers\Commands; | ||
|
||
use App\Services\DockerService; | ||
use App\Services\TerminalService; | ||
use Illuminate\Contracts\Container\BindingResolutionException; | ||
use LaravelZero\Framework\Commands\Command; | ||
|
||
class Node extends Command{ | ||
protected $signature = 'node | ||
{commands* : node commands to execute} '; | ||
protected $signature = 'node'; | ||
|
||
protected $description = 'Executes a node command'; | ||
protected $description = 'Runs a node command'; | ||
|
||
/** | ||
* @param DockerService $docker_service | ||
* @param TerminalService $terminal | ||
* @return int | ||
* @throws DockerServiceNotFoundException | ||
* @throws BindingResolutionException | ||
*/ | ||
public function handle(DockerService $docker_service, TerminalService $terminal){ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
$this->ignoreValidationErrors(); | ||
} | ||
|
||
public function handle(DockerService $docker_service, TerminalService $terminal): int | ||
{ | ||
$terminal->init($this->output); | ||
|
||
$commands = [ | ||
"node", | ||
]; | ||
|
||
$composer_commands = $this->argument("commands"); | ||
if(!empty($composer_commands)){ | ||
$commands = array_merge($commands, $composer_commands); | ||
$arguments = (string) $this->input; | ||
|
||
if (empty($arguments)) { | ||
$this->info('Log into Node Shell'); | ||
|
||
return $terminal->execute([ | ||
'docker-compose', | ||
'run', | ||
'--rm', | ||
'node', | ||
'bash', | ||
]); | ||
} else { | ||
$node_commands = explode(' ', $arguments); | ||
$commands = array_merge(['node'], $node_commands); | ||
return $docker_service->service('node')->run($terminal, $commands); | ||
} | ||
return $docker_service->service('node')->run($terminal, $commands); | ||
|
||
|
||
} | ||
} |