Skip to content
This repository has been archived by the owner on Jun 12, 2022. It is now read-only.

Apply fixes from StyleCI #3

Merged
merged 1 commit into from
Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/Console/ReleasesListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

namespace TPG\Attache\Console;

use Illuminate\Support\Arr;
use Symfony\Component\Console\Command\Command as SymfonyCommand;
use Symfony\Component\Console\Style\SymfonyStyle;
use TPG\Attache\Exceptions\ConfigurationException;
use TPG\Attache\ReleaseService;
use TPG\Attache\Ssh;

/**
* Class ReleasesListCommand.
Expand Down
8 changes: 4 additions & 4 deletions src/Console/ReleasesPruneCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function configure()
$this->setName('releases:prune')
->setDescription('Prune releases from the specified server. Retains the most recent two')
->addArgument('server', InputArgument::REQUIRED, 'The name of the configured server')
->addOption('count','o', InputOption::VALUE_REQUIRED, 'The number of releases to prune.');
->addOption('count', 'o', InputOption::VALUE_REQUIRED, 'The number of releases to prune.');

$this->requiresConfig();
}
Expand All @@ -39,12 +39,12 @@ public function fire(): int

$pruneIds = $this->getIdsToDelete($releaseService->list(), $this->option('count'));

if (!$pruneIds) {
if (! $pruneIds) {
$this->output->writeln('<error>There are no releases to prune</error>');
exit(1);
}

if (!$this->confirmDeletion($pruneIds)) {
if (! $this->confirmDeletion($pruneIds)) {
$this->output->writeln('Cancelled.');
exit(1);
}
Expand All @@ -58,7 +58,7 @@ public function fire(): int

protected function getIdsToDelete(array $releases, ?int $count = null): array
{
if (!$count || $count > count($releases) - 2) {
if (! $count || $count > count($releases) - 2) {
$count = count($releases) - 2;
}

Expand Down
4 changes: 1 addition & 3 deletions src/Console/ReleasesRollbackCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,13 @@ protected function fire(): int
}

if ($activeIndex > 0) {
$rollbackId = $releaseService->list()[$activeIndex -1];
$rollbackId = $releaseService->list()[$activeIndex - 1];

$command = 'ln -nfs '.$server['root'].'/releases/'.$rollbackId.' '.
$server['root'].'/live';

(new Ssh($server))->run($command, function ($outputs) use ($rollbackId) {

$this->output->writeln('Rolled back to <info>'.$rollbackId.'</info>');

});
}

Expand Down
6 changes: 1 addition & 5 deletions src/ReleaseService.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ public function fetch(): self
$command = 'ls '.$this->server['root'].'/releases && ls -l '.$this->server['root'];

(new Ssh($this->server))->run($command, function ($output) {

$this->releases = $this->getReleasesFromOutput($output);
$this->active = $this->getActiveFromOutput($output);

});

return $this;
Expand Down Expand Up @@ -83,7 +81,7 @@ public function exists(string $id): bool
public function activate(string $id): void
{
if ($id === 'latest') {
$id = $this->releases[count($this->releases) -1];
$id = $this->releases[count($this->releases) - 1];
}

$command = 'ln -nfs '.$this->server['root'].'/releases/'.$id.' '.
Expand All @@ -92,7 +90,6 @@ public function activate(string $id): void
(new Ssh($this->server))->run($command, function ($outputs) {

//

});
}

Expand All @@ -108,7 +105,6 @@ public function delete(array $ids): void
(new Ssh($this->server))->run($command, function ($outputs) use ($ids) {

//

});
}
}