示例#1
0
 public function update()
 {
     if (isset($this->config['build'])) {
         OS::run('cd ' . OS::bashize($this->directory) . ';git pull');
         $this->readConfig();
     }
 }
示例#2
0
文件: Deps.php 项目: Rhoban/deps
 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);
 }
示例#3
0
文件: Package.php 项目: Rhoban/deps
 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();
 }
示例#4
0
文件: Deps.php 项目: RemiFabre/deps
 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);
 }