Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4.0582 |
Changes | 0 |
1 | <?php |
||
58 | 2 | public function execute() |
|
59 | { |
||
60 | 2 | $cmd = 'cd ' . escapeshellarg($this->directory) . ' && npm install'; |
|
61 | 2 | if (isset($this->options['silent']) && $this->options['silent']) { |
|
62 | 2 | $cmd .= ' --silent'; // supress warnings |
|
63 | 2 | } |
|
64 | 2 | $command = new Exec(); |
|
65 | 2 | $command->setCommand($cmd); |
|
66 | 2 | $result = $command->execute(); |
|
67 | 2 | if ($result->getResult() !== 0) { |
|
68 | $this->error(sprintf('Installation of node modules for package in dir "%s" failed.', $this->directory)); |
||
69 | } |
||
70 | 2 | $this->log("Npm installed modules successfully."); |
|
71 | 2 | return $result; |
|
72 | } |
||
73 | |||
74 | } |