Skip to content

Commit 352dd38

Browse files
committed
Attempt to install relevant binary if it does not exist
1 parent 19ff44e commit 352dd38

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/HCLParser.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,26 @@ public function __construct($hcl)
2222
$this->hcl = $hcl;
2323
}
2424

25+
/**
26+
* @return string
27+
*/
28+
private function getBinaryPath()
29+
{
30+
$binaryPath = __DIR__.'/../bin/'.Installer::getBinaryFilename();
31+
32+
if (!file_exists($binaryPath)) {
33+
Installer::installBinaries();
34+
}
35+
36+
return $binaryPath;
37+
}
38+
2539
/**
2640
* @return string
2741
*/
2842
private function getJSONString()
2943
{
30-
$command = __DIR__.'/../bin/'.Installer::getBinaryFilename().' --reverse <<\'EOF\''.PHP_EOL.$this->hcl.PHP_EOL.'EOF';
44+
$command = $this->getBinaryPath().' --reverse <<\'EOF\''.PHP_EOL.$this->hcl.PHP_EOL.'EOF';
3145

3246
exec($command, $lines);
3347

0 commit comments

Comments
 (0)