Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / consolidation / robo / src / Task / Gulp / Base.php
1 <?php
2
3 namespace Robo\Task\Gulp;
4
5 use Robo\Task\BaseTask;
6 use Robo\Exception\TaskException;
7 use Robo\Common\ProcessUtils;
8
9 abstract class Base extends BaseTask
10 {
11     use \Robo\Common\ExecOneCommand;
12
13     /**
14      * @var string
15      */
16     protected $command = '';
17
18     /**
19      * @var array
20      */
21     protected $opts = [];
22
23     /**
24      * @var string
25      */
26     protected $task = '';
27
28     /**
29      * adds `silent` option to gulp
30      *
31      * @return $this
32      */
33     public function silent()
34     {
35         $this->option('silent');
36         return $this;
37     }
38
39     /**
40      * adds `--no-color` option to gulp
41      *
42      * @return $this
43      */
44     public function noColor()
45     {
46         $this->option('no-color');
47         return $this;
48     }
49
50     /**
51      * adds `--color` option to gulp
52      *
53      * @return $this
54      */
55     public function color()
56     {
57         $this->option('color');
58         return $this;
59     }
60
61     /**
62      * adds `--tasks-simple` option to gulp
63      *
64      * @return $this
65      */
66     public function simple()
67     {
68         $this->option('tasks-simple');
69         return $this;
70     }
71
72     /**
73      * @param string $task
74      * @param null|string $pathToGulp
75      *
76      * @throws \Robo\Exception\TaskException
77      */
78     public function __construct($task, $pathToGulp = null)
79     {
80         $this->task = $task;
81         $this->command = $pathToGulp;
82         if (!$this->command) {
83             $this->command = $this->findExecutable('gulp');
84         }
85         if (!$this->command) {
86             throw new TaskException(__CLASS__, "Gulp executable not found.");
87         }
88     }
89
90     /**
91      * @return string
92      */
93     public function getCommand()
94     {
95         return "{$this->command} " . ProcessUtils::escapeArgument($this->task) . "{$this->arguments}";
96     }
97 }