Ejemplo n.º 1
0
 private function install($args)
 {
     list($flats, $flags) = $this->prep_args($args);
     if (count($flats) != 1) {
         return $this->failtown('format: `spark install -v1.0.0 name`');
     }
     $spark_name = $flats[0];
     $version = array_key_exists('v', $flags) ? $flags['v'] : 'HEAD';
     // retrieve the spark details
     foreach ($this->spark_sources as $source) {
         Spark_utils::notice("Retrieving spark detail from " . $source->get_url());
         $spark = $source->get_spark_detail($spark_name, $version);
         if ($spark != null) {
             break;
         }
     }
     // did we find the details?
     if ($spark == null) {
         throw new Spark_exception("Unable to find spark: {$spark_name} ({$version}) in any sources");
     }
     // verify the spark, and put out warnings if needed
     $spark->verify();
     // retrieve the spark
     Spark_utils::notice("From Downtown! Retrieving spark from " . $spark->location_detail());
     $spark->retrieve();
     // Install it
     $spark->install();
     Spark_utils::notice('Spark installed to ' . $spark->installed_path() . ' - You\'re on fire!');
 }
Ejemplo n.º 2
0
 function install_dependency($dependency_data)
 {
     // Get the spark object
     $spark = null;
     if ($dependency_data->repository_type == 'hg') {
         $spark = Mercurial_spark::get_spark($dependency_data);
     } else {
         if ($dependency_data->repository_type == 'git') {
             $spark = Git_spark::get_spark($dependency_data);
         } else {
             if ($dependency_data->repository_type == 'zip') {
                 $spark = new Zip_spark($dependency_data);
             } else {
                 throw new Exception('Unknown repository type: ' . $dependency_data->repository_type);
             }
         }
     }
     // Install the spark
     if ($spark->verify(false)) {
         // if not installed, install
         $spark->retrieve();
         $spark->install();
         Spark_utils::notice("Installed dependency: {$spark->name} to " . $spark->installed_path());
     } else {
         Spark_utils::warning("Dependency {$spark->name} is already installed.");
     }
 }