Ejemplo n.º 1
0
 private function warn_if_outdated()
 {
     if ($source_version_data = $this->outdated()) {
         Spark_utils::warning("Your installed version of spark is outdated (current version: {$source_version_data->spark_manager})");
         Spark_utils::warning("To upgrade now, use `tools/spark upgrade-system`");
     }
 }
Ejemplo n.º 2
0
 private function warn_if_outdated()
 {
     if ($this->outdated()) {
         Spark_utils::warning("Your installed version of spark is outdated (current version: " . $this->outdated() . " / latest: " . $this->version . ")");
         Spark_utils::warning("To upgrade now, use `php tools/spark upgrade-system`");
     }
 }
 static function get_spark($data)
 {
     if (self::git_installed()) {
         return new Git_spark($data);
     } else {
         Spark_utils::warning('Git not found - reverting to archived copy');
         return new Zip_spark($data);
     }
 }
Ejemplo n.º 4
0
 private function remove($args)
 {
     list($flats, $flags) = $this->prep_args($args);
     if (count($flats) != 1) {
         return $this->failtown('Which spark do you want to remove?');
     }
     $spark_name = $flats[0];
     $version = array_key_exists('v', $flags) ? $flags['v'] : null;
     // figure out what to remove and make sure its isntalled
     $dir_to_remove = SPARK_PATH . ($version == null ? "/{$spark_name}" : "/{$spark_name}/{$version}");
     if (!file_exists($dir_to_remove)) {
         return Spark_utils::warning('Looks like that spark isn\'t installed');
     }
     if ($version == null && !array_key_exists('f', $flags)) {
         throw new Spark_exception("Please specify a version (spark remove -v1.0.0 foo) or remove all with -f");
     }
     Spark_utils::notice("Removing {$spark_name} (" . ($version ? $version : 'ALL') . ") from {$dir_to_remove}");
     if (Spark_utils::remove_full_directory($dir_to_remove, true)) {
         Spark_utils::notice('Spark removed successfully!');
     } else {
         Spark_utils::warning('Looks like that spark isn\'t installed');
     }
     // attempt to clean up - will not remove unless empty
     @rmdir(SPARK_PATH . "/{$spark_name}");
 }
Ejemplo n.º 5
0
 function verify($break_on_already_installed = true)
 {
     // see if this is deactivated
     if ($this->data->is_deactivated) {
         $msg = 'Woah there - it seems the spark you want has been deactivated';
         if ($this->data->spark_home) {
             $msg .= "\nLook for different versions at: " . $this->data->spark_home;
         }
         throw new Spark_exception($msg);
     }
     // see if this is unsupported
     if ($this->data->is_unsupported) {
         Spark_utils::warning('This spark is no longer supported.');
         Spark_utils::warning('You can keep using it, or look for an alternate');
     }
     // tell the user if its already installed and throw an error
     $this->installation_path = SPARK_PATH . "/{$this->name}/{$this->version}";
     if (is_dir($this->installation_path)) {
         if ($break_on_already_installed) {
             throw new Spark_exception("Already installed.  Try `php tools/spark reinstall {$this->name}`");
         }
         return false;
     } else {
         return true;
     }
 }