|
@@ -19,19 +19,33 @@ use Composer\Package\PackageInterface;
|
|
|
*/
|
|
|
class GitDownloader implements DownloaderInterface
|
|
|
{
|
|
|
- protected $clone;
|
|
|
+ /**
|
|
|
+ * {@inheritDoc}
|
|
|
+ */
|
|
|
+ public function download(PackageInterface $package, $path, $url, $checksum = null, $useSource = false)
|
|
|
+ {
|
|
|
+ system('git clone '.escapeshellarg($url).' -b master '.escapeshellarg($path));
|
|
|
+
|
|
|
+ // TODO non-source installs:
|
|
|
+ // system('git archive --format=tar --prefix='.escapeshellarg($package->getName()).' --remote='.escapeshellarg($url).' master | tar -xf -');
|
|
|
+ }
|
|
|
|
|
|
- public function __construct($clone = true)
|
|
|
+ /**
|
|
|
+ * {@inheritDoc}
|
|
|
+ */
|
|
|
+ public function update(PackageInterface $initial, PackageInterface $target, $path, $useSource = false)
|
|
|
{
|
|
|
- $this->clone = $clone;
|
|
|
+ $cwd = getcwd();
|
|
|
+ chdir($path);
|
|
|
+ system('git pull');
|
|
|
+ chdir($cwd);
|
|
|
}
|
|
|
|
|
|
- public function download(PackageInterface $package, $path, $url, $checksum = null)
|
|
|
+ /**
|
|
|
+ * {@inheritDoc}
|
|
|
+ */
|
|
|
+ public function remove(PackageInterface $package, $path, $useSource = false)
|
|
|
{
|
|
|
- if ($this->clone) {
|
|
|
- system('git clone '.escapeshellarg($url).' -b master '.escapeshellarg($path.'/'.$package->getName()));
|
|
|
- } else {
|
|
|
- system('git archive --format=tar --prefix='.escapeshellarg($package->getName()).' --remote='.escapeshellarg($url).' master | tar -xf -');
|
|
|
- }
|
|
|
+ echo 'rm -rf '.$path; // TODO
|
|
|
}
|
|
|
}
|