public function update() { if (isset($this->config['build'])) { OS::run('cd ' . OS::bashize($this->directory) . ';git pull'); $this->readConfig(); } }
public function install($dep, $rebuildDeps = true) { if (isset($this->installed[$dep])) { return; } $this->installed[$dep] = true; if (!$this->hasPackage($dep)) { Terminal::info("* Installing {$dep}...\n"); $target = $this->getPackageDirectory($dep); if (is_dir($target)) { OS::run("rm -rf {$target}"); } $btarget = OS::bashize($target); $remotes = $this->remotes->getRemotes(); $addr = $remotes[$this->remotes->getCurrent()]; $addr = sprintf($addr, $dep); $return = OS::run("git clone --depth=1 {$addr} {$btarget}"); if ($return != 0) { OS::run("rm -rf {$target}"); throw new \Exception("Unable to install package {$dep}"); } $package = new Package($target); if (!$package->hasConfig()) { OS::run("rm -rf {$btarget}"); throw new \Exception("{$dep} doesn't look like a deps package (no deps.json)"); } $package->updateRemotes($this->remotes, true); $this->packages[$package->getName()] = $package; } else { $this->update($dep); $package = $this->getPackage($dep); } $package->readConfig(); foreach ($package->getDependencies() as $sdep) { if ($rebuildDeps) { $this->install($sdep); } else { if (!$this->hasPackage($sdep)) { $this->install($sdep); } } } $this->build($dep); }
public function update(Remotes $remotes) { $branch = $this->getBranch(); $this->updateRemotes($remotes); $current = $remotes->getCurrent(); if (OS::run('cd ' . OS::bashize($this->directory) . ";git pull {$current} {$branch}") != 0) { throw new \Exception('Update of ' . $this->getName() . ' failed'); } else { Terminal::success('Updated ' . $this->getName() . "\n"); } OS::run('cd ' . OS::bashize($this->directory) . ";git branch -u {$current}/{$branch}"); $this->readConfig(); }
public function install($dep) { if (!$this->hasPackage($dep)) { echo "* Installing {$dep}...\n"; $target = $this->getPackageDirectory($dep); if (is_dir($target)) { OS::run("rm -rf {$target}"); } $btarget = OS::bashize($target); $return = OS::run("git clone --depth=1 https://github.com/{$dep} {$btarget}"); if ($return != 0) { OS::run("rm -rf {$target}"); throw new \Exception("Unable to install package {$dep}"); } $package = new Package($target); $this->packages[$package->getName()] = $package; } else { $this->update($dep); $package = $this->getPackage($dep); } $package->readConfig(); foreach ($package->getDependencies() as $sdep) { $this->install($sdep); } $this->build($dep); }