Skip to content

Commit

Permalink
Feat: create a facade for the executor pool
Browse files Browse the repository at this point in the history
  • Loading branch information
komtcho committed Jul 27, 2024
1 parent 6db50a4 commit 269f6aa
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 4 deletions.
25 changes: 25 additions & 0 deletions src/Classes/ExecutorPoolClass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Pharaonic\Laravel\Executor\Classes;

class ExecutorPoolClass
{
private array $paths = [];

public function __construct()
{
$this->paths = [
base_path('executors'),
];
}

public function getPaths()
{
return $this->paths;
}

public function addPath($path)
{
array_push($this->paths, $path);
}
}
14 changes: 11 additions & 3 deletions src/ExecutorServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,32 @@
namespace Pharaonic\Laravel\Executor;

use Illuminate\Support\ServiceProvider;
use Pharaonic\Laravel\Executor\Classes\ExecutorPoolClass;
use Pharaonic\Laravel\Executor\Console\ExecuteCommand;
use Pharaonic\Laravel\Executor\Console\ExecuteFreshCommand;
use Pharaonic\Laravel\Executor\Console\ExecuteMakeCommand;
use Pharaonic\Laravel\Executor\Console\ExecuteRollbackCommand;
use Pharaonic\Laravel\Executor\Console\ExecuteStatusCommand;
use Pharaonic\Laravel\Executor\ExecutorPool;

class ExecutorServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
$this->app->singleton('pharaonic.executor.executorPool', ExecutorPoolClass::class);
}

/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
ExecutorPool::addPath(base_path('executors'));

if ($this->app->runningInConsole()) {
// Publish Migrations
$this->publishes(
Expand Down
13 changes: 13 additions & 0 deletions src/Facades/ExecutorPool.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Pharaonic\Laravel\Executor\Facades;

use Illuminate\Support\Facades\Facade;

class ExecutorPool extends Facade
{
protected static function getFacadeAccessor()
{
return 'pharaonic.executor.executorPool';
}
}
2 changes: 1 addition & 1 deletion src/Services/ExecutorService.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Pharaonic\Laravel\Executor\Services;

use Illuminate\Support\Facades\File;
use Pharaonic\Laravel\Executor\ExecutorPool;
use Pharaonic\Laravel\Executor\Facades\ExecutorPool;
use Pharaonic\Laravel\Executor\Models\Executor;
use ReflectionClass;

Expand Down

0 comments on commit 269f6aa

Please sign in to comment.