From a4a443f255960263cc78ee9d4bd19a91a673c3d0 Mon Sep 17 00:00:00 2001 From: Gabriel Baker Date: Wed, 15 May 2013 21:53:36 +0100 Subject: [PATCH] fix symlink check and build dir --- PHPCI/Builder.php | 24 ++++++++++++++---------- PHPCI/build/.gitkeep | 0 2 files changed, 14 insertions(+), 10 deletions(-) create mode 100644 PHPCI/build/.gitkeep diff --git a/PHPCI/Builder.php b/PHPCI/Builder.php index 9ba46fad..58c50d70 100644 --- a/PHPCI/Builder.php +++ b/PHPCI/Builder.php @@ -106,7 +106,7 @@ class Builder } $this->log .= $prefix . $item . PHP_EOL; - }, $message); + }, $message); } else { @@ -153,8 +153,8 @@ class Builder switch ($type) { case 'local': - $this->buildPath = $this->ciDir . 'build/' . $buildId; - + $this->buildPath = substr($this->buildPath, 0, -1); + if(!is_file($reference . '/phpci.yml')) { $this->logFailure('Project does not contain a phpci.yml file.'); @@ -163,7 +163,7 @@ class Builder $yamlFile = file_get_contents($reference . '/phpci.yml'); $this->config = $yamlParser->parse($yamlFile); - + if(array_key_exists('build_settings', $this->config) && is_array($this->config['build_settings']) && array_key_exists('prefer_symlink', $this->config['build_settings']) @@ -175,20 +175,24 @@ class Builder } $this->log(sprintf('Symlinking: %s to %s',$reference, $this->buildPath)); - symlink($reference, $this->buildPath); + if ( !symlink($reference, $this->buildPath) ) + { + $this->logFailure('Failed to symlink.'); + return false; + } } else { $this->executeCommand(sprintf("cp -Rf %s %s/", $reference, $this->buildPath)); } - + $this->buildPath .= '/'; break; case 'github': case 'bitbucket': mkdir($this->buildPath, 0777, true); - + if(!empty($key)) { // Do an SSH clone: @@ -276,7 +280,7 @@ class Builder $this->success = false; } } - + continue; } @@ -295,7 +299,7 @@ class Builder $this->success = false; } } - + $this->logFailure('PLUGIN STATUS: FAILED'); continue; } @@ -322,7 +326,7 @@ class Builder { $this->plugins[$plugin] = true; } - + $this->logSuccess('PLUGIN STATUS: SUCCESS!'); } } diff --git a/PHPCI/build/.gitkeep b/PHPCI/build/.gitkeep new file mode 100644 index 00000000..e69de29b