Skip to content

Commit 0b084da

Browse files
committed
Merge remote-tracking branch 'origin/main' into main
2 parents 60a38c0 + 99b045b commit 0b084da

26 files changed

+200
-290
lines changed

config/atomic-deployments.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,36 @@
44

55
/**
66
* Symbolic link to the current deployed build
7-
* This path should be used for schedules and setting your web root
7+
* This path should be used for schedules and setting your web root.
88
*/
99
'deployment-link' => env('ATM_DEPLOYMENT_LINK'),
1010

1111
/**
1212
* The primary build folder
13-
* This folder is where all deployments ran and ultimately copied to a deployment directory
13+
* This folder is where all deployments ran and ultimately copied to a deployment directory.
1414
*/
1515
'build-path' => env('ATM_BUILD'),
1616

1717
/**
1818
* Production build directory
1919
* Builds are copied here and linked for deployment
20-
* Ensure this directory has the required permissions to allow php and your webserver to run your application here
20+
* Ensure this directory has the required permissions to allow php and your webserver to run your application here.
2121
*/
2222
'deployments-path' => env('ATM_DEPLOYMENTS'),
2323

2424
/**
2525
* Max number of build directories allowed
26-
* Once limit is hit, old deployments will be removed automatically after a successful build
26+
* Once limit is hit, old deployments will be removed automatically after a successful build.
2727
*/
2828
'build-limit' => 10,
2929

3030
/**
31-
* Migrate files|folders from the outgoing production build to your new release using a relative path and pattern
31+
* Migrate files|folders from the outgoing production build to your new release using a relative path and pattern.
32+
*
3233
* @see https://www.php.net/manual/en/function.glob.php
3334
*/
3435
'migrate' => [
35-
// 'storage/framework/sessions/*',
36-
]
36+
// 'storage/framework/sessions/*',
37+
],
3738

3839
];

src/AtomicDeploymentsServiceProvider.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,31 @@
33
namespace JTMcC\AtomicDeployments;
44

55
use Illuminate\Support\ServiceProvider;
6-
76
use JTMcC\AtomicDeployments\Commands\DeployCommand;
87
use JTMcC\AtomicDeployments\Commands\ListCommand;
98

109
class AtomicDeploymentsServiceProvider extends ServiceProvider
1110
{
12-
1311
public function boot()
1412
{
15-
$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
13+
$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
1614
}
1715

1816
public function register()
1917
{
2018
$this->registerPublishables();
21-
$this->mergeConfigFrom(__DIR__ . '/../config/atomic-deployments.php', 'atomic-deployments');
19+
$this->mergeConfigFrom(__DIR__.'/../config/atomic-deployments.php', 'atomic-deployments');
2220
$this->registerCommands();
2321
}
2422

2523
protected function registerPublishables(): void
2624
{
2725
$this->publishes([
28-
__DIR__ . '/../config/atomic-deployments.php' => config_path('atomic-deployments.php'),
26+
__DIR__.'/../config/atomic-deployments.php' => config_path('atomic-deployments.php'),
2927
], 'atm-config');
3028

3129
$this->publishes([
32-
__DIR__.'/../database/migrations/' =>database_path('migrations'),
30+
__DIR__.'/../database/migrations/' => database_path('migrations'),
3331
], 'atm-migrations');
3432
}
3533

@@ -42,5 +40,4 @@ protected function registerCommands(): void
4240
]);
4341
}
4442
}
45-
4643
}

src/Commands/BaseCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace JTMcC\AtomicDeployments\Commands;
44

55
use Illuminate\Console\Command;
6+
use JTMcC\AtomicDeployments\Helpers\ConsoleOutput;
67
use Symfony\Component\Console\Input\InputInterface;
78
use Symfony\Component\Console\Output\OutputInterface;
8-
use JTMcC\AtomicDeployments\Helpers\ConsoleOutput;
99

1010
class BaseCommand extends Command
1111
{
@@ -15,4 +15,4 @@ public function run(InputInterface $input, OutputInterface $output): int
1515

1616
return parent::run($input, $output);
1717
}
18-
}
18+
}

src/Commands/DeployCommand.php

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@
33
namespace JTMcC\AtomicDeployments\Commands;
44

55
use JTMcC\AtomicDeployments\Events\DeploymentSuccessful;
6-
use JTMcC\AtomicDeployments\Services\AtomicDeployments;
7-
6+
use JTMcC\AtomicDeployments\Helpers\ConsoleOutput;
87
use JTMcC\AtomicDeployments\Models\AtomicDeployment;
8+
use JTMcC\AtomicDeployments\Services\AtomicDeployments;
99
use JTMcC\AtomicDeployments\Services\Output;
1010

11-
use JTMcC\AtomicDeployments\Helpers\ConsoleOutput;
12-
1311
class DeployCommand extends BaseCommand
1412
{
15-
1613
protected $signature = 'atomic-deployments:deploy
1714
{--hash= : Specify a previous deployments commit hash/deploy-dir to deploy }
1815
{--directory= : Define your deploy folder name. Defaults to current HEAD hash }
@@ -22,7 +19,7 @@ class DeployCommand extends BaseCommand
2219

2320
public function handle()
2421
{
25-
Output::alert("Running Atomic Deployment");
22+
Output::alert('Running Atomic Deployment');
2623

2724
$buildPath = config('atomic-deployments.build-path');
2825
$deploymentLink = config('atomic-deployments.deployment-link');
@@ -57,22 +54,18 @@ public function handle()
5754
$atomicDeployment->rollback();
5855
}
5956
}
60-
6157
} else {
6258
Output::info('Running Deployment...');
6359

64-
if($deployDir = trim($this->option('directory'))) {
60+
if ($deployDir = trim($this->option('directory'))) {
6561
Output::info("Deployment directory option set. Deployment will use {$deployDir}");
6662
$atomicDeployment->setDeploymentDirectory($deployDir);
6763
}
6864

69-
$atomicDeployment->deploy(fn() => $atomicDeployment->cleanBuilds(config('atomic-deployments.build-limit')));
65+
$atomicDeployment->deploy(fn () => $atomicDeployment->cleanBuilds(config('atomic-deployments.build-limit')));
7066
}
7167

72-
Output::info("Finished");
68+
Output::info('Finished');
7369
ConsoleOutput::line('');
74-
7570
}
76-
77-
7871
}

src/Commands/ListCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
namespace JTMcC\AtomicDeployments\Commands;
44

5-
use JTMcC\AtomicDeployments\Models\AtomicDeployment;
65
use JTMcC\AtomicDeployments\Helpers\ConsoleOutput;
6+
use JTMcC\AtomicDeployments\Models\AtomicDeployment;
77
use JTMcC\AtomicDeployments\Models\Enums\DeploymentStatus;
88

99
class ListCommand extends BaseCommand
1010
{
11-
1211
protected $signature = 'atomic-deployments:list';
1312

1413
protected $description = 'List currently available deployments';
@@ -25,14 +24,16 @@ public function handle()
2524
'deployment_link',
2625
'deployment_status',
2726
'created_at',
28-
)->get()->map(function($deployment) {
27+
)->get()->map(function ($deployment) {
2928
$deployment->append('isCurrentlyDeployed');
3029
$deployment->deployment_status = DeploymentStatus::getNameFromValue($deployment->deployment_status);
30+
3131
return $deployment;
3232
});
3333

3434
if (!$deployments->count()) {
3535
ConsoleOutput::info('No deployments found');
36+
3637
return;
3738
}
3839

@@ -41,5 +42,4 @@ public function handle()
4142
ConsoleOutput::table($titles, $deployments);
4243
ConsoleOutput::line('');
4344
}
44-
4545
}

src/Events/DeploymentFailed.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,21 @@
1010

1111
class DeploymentFailed implements ShouldQueue
1212
{
13-
use Dispatchable, SerializesModels;
13+
use Dispatchable;
14+
use SerializesModels;
1415

1516
public AtomicDeployments $deploymentService;
1617
public ?AtomicDeployment $deployment = null;
1718

1819
/**
1920
* DeploymentSuccessful constructor.
21+
*
2022
* @param AtomicDeployments $deploymentService
21-
* @param mixed $deployment
23+
* @param mixed $deployment
2224
*/
2325
public function __construct(AtomicDeployments $deploymentService, ?AtomicDeployment $deployment = null)
2426
{
2527
$this->deploymentService = $deploymentService;
2628
$this->deployment = $deployment;
2729
}
28-
2930
}

src/Events/DeploymentSuccessful.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,21 @@
1010

1111
class DeploymentSuccessful implements ShouldQueue
1212
{
13-
use Dispatchable, SerializesModels;
13+
use Dispatchable;
14+
use SerializesModels;
1415

1516
public AtomicDeployments $deploymentService;
1617
public ?AtomicDeployment $deployment = null;
1718

1819
/**
1920
* DeploymentSuccessful constructor.
21+
*
2022
* @param AtomicDeployments $deploymentService
21-
* @param mixed $deployment
23+
* @param mixed $deployment
2224
*/
2325
public function __construct(AtomicDeployments $deploymentService, ?AtomicDeployment $deployment = null)
2426
{
2527
$this->deploymentService = $deploymentService;
2628
$this->deployment = $deployment;
2729
}
28-
2930
}

src/Exceptions/AreYouInsaneException.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
class AreYouInsaneException extends Exception
99
{
10-
public function __construct($message = "", $code = 0, Throwable $previous = null) {
10+
public function __construct($message = '', $code = 0, Throwable $previous = null)
11+
{
1112
parent::__construct("(╯°□°)╯︵ ┻━┻: {$message}", $code, $previous);
1213
}
1314
}

src/Exceptions/ExecuteFailedException.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
class ExecuteFailedException extends Exception
99
{
10-
public function __construct($message = "", $code = 0, Throwable $previous = null) {
10+
public function __construct($message = '', $code = 0, Throwable $previous = null)
11+
{
1112
parent::__construct("exec failed: {$message}", $code, $previous);
1213
}
1314
}

src/Exceptions/InvalidPathException.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
class InvalidPathException extends Exception
99
{
10-
public function __construct($message = "", $code = 0, Throwable $previous = null) {
10+
public function __construct($message = '', $code = 0, Throwable $previous = null)
11+
{
1112
parent::__construct("Invalid Path: {$message}", $code, $previous);
1213
}
1314
}

0 commit comments

Comments
 (0)