Ejemplo n.º 1
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.");
     }
 }
Ejemplo n.º 2
0
 private function get_spark($data)
 {
     if ($data->repository_type == 'hg') {
         return Mercurial_spark::get_spark($data);
     } else {
         if ($data->repository_type == 'git') {
             return Git_spark::get_spark($data);
         } else {
             if ($data->repository_type == 'zip') {
                 return new Zip_spark($data);
             } else {
                 throw new Exception('Unknown repository type: ' . $data->repository_type);
             }
         }
     }
 }