Exemplo n.º 1
0
 public function update()
 {
     if (isset($this->config['build'])) {
         OS::run('cd ' . OS::bashize($this->directory) . ';git pull');
         $this->readConfig();
     }
 }
Exemplo n.º 2
0
 public function run(array $arguments)
 {
     foreach ($arguments as $dep) {
         echo "* Removing {$dep}...\n";
         $dir = $this->deps->getPackageDirectory($dep);
         OS::run("rm -rf {$dir}");
     }
     return true;
 }
Exemplo n.º 3
0
 public function run(array $arguments)
 {
     $json = $this->deps->nearestJson();
     $linkDir = dirname($json);
     $package = new Package(dirname($json));
     $name = $package->getName();
     if (!$name) {
         echo "Error: no name for package\n";
     } else {
         echo "* Linking package {$name} to {$linkDir}...\n";
         $dir = $this->deps->getPackageDirectory($package->getName());
         if (is_dir($dir)) {
             OS::run("rm -rf {$dir}");
         }
         OS::run("ln -s {$linkDir} {$dir}");
     }
 }
Exemplo n.º 4
0
 public function run(array $arguments)
 {
     $json = $this->deps->nearestJson();
     $linkDir = dirname($json);
     $package = new Package(dirname($json));
     $name = $package->getName();
     if (!$name) {
         echo "Error: no name for package\n";
     } else {
         echo "Do you want to create symlink from {$name} to {$linkDir}? (yes/no)\n";
         $l = readline();
         if (trim($l) == 'yes') {
             echo "* Linking package {$name} to {$linkDir}...\n";
             $dir = $this->deps->getPackageDirectory($package->getName());
             if (is_dir($dir)) {
                 OS::run("rm -rf {$dir}");
             }
             OS::run("ln -s {$linkDir} {$dir}");
         } else {
             echo "Aborting.\n";
         }
     }
 }
Exemplo n.º 5
0
Arquivo: Deps.php Projeto: 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);
 }
Exemplo n.º 6
0
 public function run(array $arguments)
 {
     Terminal::info("* Updating deps from git...\n");
     $dir = $this->deps->getDirectory();
     OS::run("cd {$dir}; git pull");
 }
Exemplo n.º 7
0
 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();
 }
Exemplo n.º 8
0
 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);
 }