Skip to content

Commit f1151f6

Browse files
committed
fix: point to executable but use build directory as working directory
1 parent 85b20cb commit f1151f6

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/Build/EnsurePluginIsInstalledStep.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@
2020
class EnsurePluginIsInstalledStep implements BuildStepInterface
2121
{
2222
/**
23-
* The bin directory where the WP-CLI was installed.
23+
* The build directory where the project files are copied to.
2424
*
2525
* @var string
2626
*/
27-
private $binDirectory;
27+
private $buildDirectory;
2828

2929
/**
3030
* Constructor.
3131
*/
3232
public function __construct(string $buildDirectory)
3333
{
34-
$this->binDirectory = rtrim($buildDirectory, '/').'/bin';
34+
$this->buildDirectory = rtrim($buildDirectory, '/');
3535
}
3636

3737
/**
@@ -47,7 +47,7 @@ public function getDescription(): string
4747
*/
4848
public function perform(string $environment, ProjectConfiguration $projectConfiguration)
4949
{
50-
if (!WpCli::isYmirPluginInstalled($this->binDirectory.'/wp')) {
50+
if (!WpCli::isYmirPluginInstalled($this->buildDirectory, $this->buildDirectory.'/bin/wp')) {
5151
throw new RuntimeException('Ymir plugin not found');
5252
}
5353
}

src/WpCli.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ public static function isInstalledGlobally(): bool
3030
/**
3131
* Checks if the Ymir plugin is installed.
3232
*/
33-
public static function isYmirPluginInstalled(string $executable = ''): bool
33+
public static function isYmirPluginInstalled(string $cwd = null, string $executable = ''): bool
3434
{
35-
return self::listPlugins($executable)->contains(function (array $plugin) {
35+
return self::listPlugins($cwd, $executable)->contains(function (array $plugin) {
3636
return !empty($plugin['file']) && 1 === preg_match('/\/ymir\.php$/', $plugin['file']);
3737
});
3838
}
3939

4040
/**
4141
* List all the installed plugins.
4242
*/
43-
public static function listPlugins(string $executable = ''): Enumerable
43+
public static function listPlugins(string $cwd = null, string $executable = ''): Enumerable
4444
{
45-
$process = Process::fromShellCommandline(sprintf('%s plugin list --fields=name,status,version,file --format=json', self::getExecutable($executable)));
45+
$process = Process::fromShellCommandline(sprintf('%s plugin list --fields=name,status,version,file --format=json', self::getExecutable($executable)), $cwd);
4646
$process->run();
4747

4848
if (!$process->isSuccessful()) {

0 commit comments

Comments
 (0)