Fixed 'cd' command for windows
This commit is contained in:
parent
39477678d2
commit
18701544a0
|
@ -127,7 +127,7 @@ class CommandExecutor
|
|||
}
|
||||
|
||||
// Use "where" for windows and "which" for other OS
|
||||
$findCmd = (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') ? 'which' : 'where';
|
||||
$findCmd = IS_WIN ? 'which' : 'where';
|
||||
$findCmdResult = trim(shell_exec($findCmd . ' ' . $bin));
|
||||
|
||||
if (!empty($findCmdResult)) {
|
||||
|
|
|
@ -67,7 +67,11 @@ class RemoteGitBuild extends Build
|
|||
$success = $builder->executeCommand('git clone -b %s %s "%s"', $this->getBranch(), $this->getCloneUrl(), $cloneTo);
|
||||
|
||||
if (!empty($commit) && $commit != 'Manual') {
|
||||
$builder->executeCommand('cd "%s" && git checkout %s', $cloneTo, $this->getCommitId());
|
||||
$cmd = 'cd "%s" && git checkout %s';
|
||||
if (IS_WIN) {
|
||||
$cmd = 'cd /d "%s" && git checkout %s';
|
||||
}
|
||||
$builder->executeCommand($cmd, $cloneTo, $this->getCommitId());
|
||||
}
|
||||
|
||||
return $success;
|
||||
|
@ -97,7 +101,11 @@ class RemoteGitBuild extends Build
|
|||
$commit = $this->getCommitId();
|
||||
|
||||
if (!empty($commit) && $commit != 'Manual') {
|
||||
$builder->executeCommand('cd "%s" && git checkout %s', $cloneTo, $this->getCommitId());
|
||||
$cmd = 'cd "%s" && git checkout %s';
|
||||
if (IS_WIN) {
|
||||
$cmd = 'cd /d "%s" && git checkout %s';
|
||||
}
|
||||
$builder->executeCommand($cmd, $cloneTo, $this->getCommitId());
|
||||
}
|
||||
|
||||
// Remove the key file:
|
||||
|
|
|
@ -70,6 +70,9 @@ class Codeception implements \PHPCI\Plugin
|
|||
}
|
||||
|
||||
$cmd = 'cd "%s" && ' . $codecept . ' run -c "%s"';
|
||||
if (IS_WIN) {
|
||||
$cmd = 'cd /d "%s" && ' . $codecept . ' run -c "%s"';
|
||||
}
|
||||
$success = $this->phpci->executeCommand($cmd, $this->phpci->buildPath, $this->phpci->buildPath . $configPath);
|
||||
|
||||
return $success;
|
||||
|
|
|
@ -46,7 +46,7 @@ class Composer implements \PHPCI\Plugin
|
|||
return false;
|
||||
}
|
||||
$cmd = '';
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
if (IS_WIN) {
|
||||
$cmd = 'php ';
|
||||
}
|
||||
$cmd .= $composerLocation . ' --no-ansi --no-interaction ';
|
||||
|
|
|
@ -60,12 +60,19 @@ class Grunt implements \PHPCI\Plugin
|
|||
public function execute()
|
||||
{
|
||||
// if npm does not work, we cannot use grunt, so we return false
|
||||
if (!$this->phpci->executeCommand('cd %s && npm install', $this->directory)) {
|
||||
$cmd = 'cd %s && npm install';
|
||||
if (IS_WIN) {
|
||||
$cmd = 'cd /d %s && npm install';
|
||||
}
|
||||
if (!$this->phpci->executeCommand($cmd, $this->directory)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// build the grunt command
|
||||
$cmd = 'cd %s && ' . $this->grunt;
|
||||
if (IS_WIN) {
|
||||
$cmd = 'cd /d %s && ' . $this->grunt;
|
||||
}
|
||||
$cmd .= ' --no-color';
|
||||
$cmd .= ' --gruntfile %s';
|
||||
$cmd .= ' %s'; // the task that will be executed
|
||||
|
|
Loading…
Reference in a new issue