Skip to content
This repository has been archived by the owner on Jan 26, 2025. It is now read-only.

Commit

Permalink
Add InstallWorkflowCommand.php to the project, which allows for the i…
Browse files Browse the repository at this point in the history
…nstallation of Fuelviews packages and running their install commands. The command copies a workflow file from a stub to the desired destination, creating any necessary directories along the way. (#18)

* Add InstallWorkflowCommand.php to the project, which allows for the installation of Fuelviews packages and running their install commands. The command copies a workflow file from a stub to the desired destination, creating any necessary directories along the way.

* Fix styling

---------

Co-authored-by: thejmitchener <[email protected]>
  • Loading branch information
thejmitchener and thejmitchener authored Jun 9, 2024
1 parent ecbc14e commit 73ade35
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Empty file removed resources/views/.gitkeep
Empty file.
35 changes: 35 additions & 0 deletions src/Commands/InstallWorkflowCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace Fuelviews\CpanelAutoDeploy\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;

class InstallWorkflowCommand extends Command
{
protected $signature = 'deploy:install';

protected $description = 'Install all Fuelviews packages and run their install commands';

public function __construct()
{
parent::__construct();
}

public function handle()
{
$source = resource_path('workflows/cpanel-auto-deploy.yml.stub');
$destination = base_path('.github/workflows/cpanel-auto-deploy.yml');

$directory = dirname($destination);
if (! File::exists($directory)) {
File::makeDirectory($directory);
}

if (File::copy($source, $destination)) {
$this->info('Workflow file copied successfully.');
} else {
$this->error('Failed to copy workflow file.');
}
}
}

0 comments on commit 73ade35

Please sign in to comment.