function retrieve() { // check out the right tag `git clone $this->base_location $this->temp_path`; `cd $this->temp_path; git checkout $this->tag -b $this->temp_token`; // remove the git directory SparkUtils::remove_full_directory("$this->temp_path/.git"); return file_exists($this->temp_path); }
private function remove($args) { $flats = array(); $flags = array(); foreach($args as $arg) { preg_match('/^(\-?[a-zA-Z])([^\s]*)$/', $arg, $matches); if (count($matches) != 3) continue; $matches[0][0] == '-' ? $flags[$matches[1][1]] = $matches[2] : $flats[] = $matches[0]; } 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 SparkUtils::notice('Looks like that spark isn\'t installed'); if ($version == null && !array_key_exists('f', $flags)) throw new SparkException("Please specify a version of remove all with -f"); SparkUtils::notice("Removing $spark_name (" . ($version ? $version : 'ALL') . ") from $dir_to_remove"); if (SparkUtils::remove_full_directory($dir_to_remove, true)) SparkUtils::notice('Spark removed successfully!'); else SparkUtils::notice('Looks like that spark isn\'t installed'); // attempt to clean up - will not remove unless empty @rmdir(SPARK_PATH . "/$spark_name"); }
function retrieve() { `hg clone -r$this->tag $this->base_location $this->temp_path`; // remove the mercurial directory SparkUtils::remove_full_directory("$this->temp_path/.hg"); return file_exists($this->temp_path); }