1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace MadWeb\Initializer; |
4
|
|
|
|
5
|
|
|
use Illuminate\Console\Command; |
6
|
|
|
use MadWeb\Initializer\ExecutorActions\Artisan; |
7
|
|
|
use MadWeb\Initializer\ExecutorActions\Publish; |
8
|
|
|
use MadWeb\Initializer\ExecutorActions\Callback; |
9
|
|
|
use MadWeb\Initializer\ExecutorActions\Dispatch; |
10
|
|
|
use MadWeb\Initializer\ExecutorActions\External; |
11
|
|
|
use MadWeb\Initializer\Contracts\Runner as RunnerContract; |
12
|
|
|
|
13
|
|
|
class Run implements RunnerContract |
14
|
|
|
{ |
15
|
|
|
protected $artisanCommand; |
16
|
|
|
|
17
|
144 |
|
public function __construct(Command $artisanCommand) |
18
|
|
|
{ |
19
|
144 |
|
$this->artisanCommand = $artisanCommand; |
20
|
144 |
|
} |
21
|
|
|
|
22
|
6 |
|
public function artisan(string $command, array $arguments = []): RunnerContract |
23
|
|
|
{ |
24
|
6 |
|
value(new Artisan($this->artisanCommand, $command, $arguments))(); |
25
|
|
|
|
26
|
6 |
|
return $this; |
27
|
|
|
} |
28
|
|
|
|
29
|
66 |
|
public function publish($providers, bool $force = false): RunnerContract |
30
|
|
|
{ |
31
|
66 |
|
value(new Publish($this->artisanCommand, $providers, $force))(); |
32
|
|
|
|
33
|
60 |
|
return $this; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function publishForce($providers): RunnerContract |
37
|
|
|
{ |
38
|
|
|
return $this->publish($providers, true); |
39
|
|
|
} |
40
|
|
|
|
41
|
12 |
|
public function external(string $command, ...$arguments): RunnerContract |
42
|
|
|
{ |
43
|
12 |
|
value(new External($this->artisanCommand, $command, $arguments))(); |
44
|
|
|
|
45
|
12 |
|
return $this; |
46
|
|
|
} |
47
|
|
|
|
48
|
6 |
|
public function callable(callable $function, ...$arguments): RunnerContract |
49
|
|
|
{ |
50
|
6 |
|
value(new Callback($this->artisanCommand, $function, $arguments))(); |
51
|
|
|
|
52
|
6 |
|
return $this; |
53
|
|
|
} |
54
|
|
|
|
55
|
48 |
|
public function dispatch($job): RunnerContract |
56
|
|
|
{ |
57
|
48 |
|
value(new Dispatch($this->artisanCommand, $job))(); |
58
|
|
|
|
59
|
48 |
|
return $this; |
60
|
|
|
} |
61
|
|
|
|
62
|
12 |
|
public function dispatchNow($job): RunnerContract |
63
|
|
|
{ |
64
|
12 |
|
value(new Dispatch($this->artisanCommand, $job, true))(); |
65
|
|
|
|
66
|
12 |
|
return $this; |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|