-
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
4fecd8a
commit 8822260
Showing
9 changed files
with
26 additions
and
133 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
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,45 +1,18 @@ | ||
<?php /** @noinspection PhpUnhandledExceptionInspection */ | ||
<?php | ||
/** @noinspection PhpUnhandledExceptionInspection */ | ||
|
||
/** @noinspection PhpMissingFieldTypeInspection */ | ||
|
||
|
||
namespace App\Containers\Commands; | ||
|
||
use App\Services\DockerService; | ||
use App\Services\TerminalService; | ||
use LaravelZero\Framework\Commands\Command; | ||
use App\Traits\ExecutesShellCommands; | ||
use LaravelZero\Framework\Commands\Command; | ||
|
||
class Node extends Command{ | ||
protected $signature = 'node'; | ||
class Node extends Command | ||
{ | ||
use ExecutesShellCommands; | ||
|
||
protected $description = 'Runs a node 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 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); | ||
} | ||
} | ||
} | ||
protected $signature = 'node'; | ||
protected $description = 'Runs a node command'; | ||
} |
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
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,15 @@ | ||
<?php | ||
|
||
|
||
namespace App\Containers\Commands; | ||
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; | ||
use App\Traits\ExecutesShellCommands; | ||
use LaravelZero\Framework\Commands\Command; | ||
|
||
class Php extends Command{ | ||
protected $signature = 'php | ||
{commands* : php commands to execute} '; | ||
class Php extends Command | ||
{ | ||
use ExecutesShellCommands; | ||
|
||
protected $description = 'Executes an php command'; | ||
|
||
/** | ||
* @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); | ||
|
||
$commands = [ | ||
"php", | ||
]; | ||
|
||
$composer_commands = $this->argument("commands"); | ||
if(!empty($composer_commands)){ | ||
$commands = array_merge($commands, $composer_commands); | ||
} | ||
return $docker_service->service('php')->execute($terminal, $commands); | ||
|
||
|
||
} | ||
} | ||
protected $signature = 'php'; | ||
protected $description = 'Executes an php command'; | ||
} |
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
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
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
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
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