Fix git downloader
parent
7cf86e7ea0
commit
c7af918caa
|
@ -19,19 +19,33 @@ use Composer\Package\PackageInterface;
|
||||||
*/
|
*/
|
||||||
class GitDownloader implements DownloaderInterface
|
class GitDownloader implements DownloaderInterface
|
||||||
{
|
{
|
||||||
protected $clone;
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
public function __construct($clone = true)
|
*/
|
||||||
|
public function download(PackageInterface $package, $path, $url, $checksum = null, $useSource = false)
|
||||||
{
|
{
|
||||||
$this->clone = $clone;
|
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 download(PackageInterface $package, $path, $url, $checksum = null)
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function update(PackageInterface $initial, PackageInterface $target, $path, $useSource = false)
|
||||||
{
|
{
|
||||||
if ($this->clone) {
|
$cwd = getcwd();
|
||||||
system('git clone '.escapeshellarg($url).' -b master '.escapeshellarg($path.'/'.$package->getName()));
|
chdir($path);
|
||||||
} else {
|
system('git pull');
|
||||||
system('git archive --format=tar --prefix='.escapeshellarg($package->getName()).' --remote='.escapeshellarg($url).' master | tar -xf -');
|
chdir($cwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function remove(PackageInterface $package, $path, $useSource = false)
|
||||||
|
{
|
||||||
|
echo 'rm -rf '.$path; // TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue