/** * Clones the source code for this project. */ public function init($path) { $wrapper = new GitWrapper(); $wrapper->streamOutput(); $wrapper->clone($this->environment->source_url, $path); chdir($path); $wrapper->git('branch'); $wrapper->git('status'); $this->loadConfig(); // Save config to director apps registry. // @TODO: Improve config saving system. $this->director->config['apps'][$this->app]['environments'][$this->name]['config'] = $this->getConfig(); $this->director->saveData(); // Run the build hooks if (!empty($this->config['hooks']['build'])) { chdir($this->getSourcePath()); $process = new Process($this->config['hooks']['build']); $process->run(function ($type, $buffer) { if (Process::ERR === $type) { echo $buffer; } else { echo $buffer; } }); } }
/** * Clones the source code for this project. */ public function init($path) { $wrapper = new GitWrapper(); $wrapper->streamOutput(); $wrapper->clone($this->app->source_url, $path, array('bare' => TRUE)); chdir($path); $wrapper->git('branch'); }
/** * Update the vulnerability database (returning any output from the git wrapper) * * @throws \Exception */ public function updateDatabase() { $wrapper = new GitWrapper(); $repositoryPath = __DIR__ . self::REPOSITORY_PATH; if (!file_exists($repositoryPath . '/.git')) { $git = $wrapper->clone(self::REPOSITORY_URL, $repositoryPath); $git->getOutput(); } else { $wrapper->git('pull', $repositoryPath); } $this->replaceJsonFiles(); }
/** * Clones the source code for this project. */ public function init($path = NULL) { $path = is_null($path) ? $this->environment->path : $path; // Check if clone already exists at this path. If so we can safely skip. if (file_exists($path)) { $wrapper = new GitWrapper(); $working_copy = new GitWorkingCopy($wrapper, $path); $output = $working_copy->remote('-v'); if (strpos($output, $this->app->repo) !== FALSE) { return TRUE; } else { return FALSE; } } try { $wrapper = new GitWrapper(); $wrapper->streamOutput(); $wrapper->clone($this->app->repo, $path); } catch (\GitWrapper\GitException $e) { return FALSE; } chdir($path); $wrapper->git('branch'); $wrapper->git('status'); $this->loadConfig(); // Run the build hooks if (!empty($this->config['hooks']['build'])) { chdir($this->getSourcePath()); $process = new Process($this->config['hooks']['build']); $process->run(function ($type, $buffer) { if (Process::ERR === $type) { echo $buffer; } else { echo $buffer; } }); } return $this->writeConfig(); }