+ * Download remote source
+ * @param string $source
+ * @return string local source
+ */
+ private function download($source) {
+ if ($this->args->git) {
+ $task = new Task\GitClone($source);
+ } else {
+ $task = new Task\StreamFetch($source, function($bytes_pct) {
+ $this->info(" %3d%% [%s>%s] \r%s",
+ floor($bytes_pct*100),
+ str_repeat("=", round(50*$bytes_pct)),
+ str_repeat(" ", round(50*(1-$bytes_pct))),
+ $bytes_pct == 1 ? "\n":""
+ );
+ });
+ }
+ $local = $task->run($this->verbosity());
+
+ $this->cleanup[] = new Task\Cleanup($local);
+ return $local;
+ }
+
+ /**
+ * Extract local archive
+ * @param stirng $source
+ * @return string extracted directory
+ */
+ private function extract($source) {
+ $task = new Task\Extract($source);
+ $dest = $task->run($this->verbosity());
+
+ $this->cleanup[] = new Task\Cleanup($dest);
+ return $dest;
+ }
+
+ /**
+ * Localize a possibly remote source
+ * @param string $source
+ * @return string local source directory