added ability to install github bundles using zips.
This commit is contained in:
@@ -25,9 +25,9 @@ class Github extends Provider {
|
||||
*/
|
||||
protected function zipball($bundle)
|
||||
{
|
||||
$zip = "https://github.com/{$bundle['location']}/zipball/master";
|
||||
$url = "http://nodeload.github.com/{$bundle['location']}/zipball/master";
|
||||
|
||||
parent::zipball($zip, true);
|
||||
parent::zipball($bundle, $url, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,6 +38,7 @@ class Github extends Provider {
|
||||
*/
|
||||
protected function submodule($bundle)
|
||||
{
|
||||
die('here');
|
||||
$repository = "git@github.com:{$bundle['location']}.git";
|
||||
|
||||
$this->directory($bundle);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php namespace Laravel\CLI\Tasks\Bundle\Providers;
|
||||
|
||||
use Laravel\File;
|
||||
|
||||
abstract class Provider {
|
||||
|
||||
/**
|
||||
@@ -10,6 +12,42 @@ abstract class Provider {
|
||||
*/
|
||||
abstract public function install($bundle);
|
||||
|
||||
/**
|
||||
* Install a bundle from by downloading a Zip.
|
||||
*
|
||||
* @param array $bundle
|
||||
* @param string $url
|
||||
* @return void
|
||||
*/
|
||||
protected function zipball($bundle, $url)
|
||||
{
|
||||
// When installing a bundle from a Zip archive, we'll first clone
|
||||
// down the bundle zip into the bundles "working" directory.
|
||||
// This gives us a spot to all of our bundle extrations.
|
||||
$target = path('storage').'work/bundles/bundle.zip';
|
||||
|
||||
File::put($target, file_get_contents($url));
|
||||
|
||||
$zip = new \ZipArchive;
|
||||
|
||||
$zip->open($target);
|
||||
|
||||
// Once we have the Zip archive, we can open it and extract it
|
||||
// into the working directory. By convention, we expect the
|
||||
// archive to contain one root directory, and all of the
|
||||
// bundle contents should be stored in that directory.
|
||||
$zip->extractTo(path('storage').'work/bundles');
|
||||
|
||||
$latest = File::latest(dirname($target));
|
||||
|
||||
// Once we have the latest modified directory, we should be
|
||||
// able to move its contents over into the bundles folder
|
||||
// so the bundle will be usable by the develoepr.
|
||||
$path = $this->path($bundle);
|
||||
|
||||
File::cpdir($latest->getRealPath(), path('bundle').$path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the path to the bundle's dirname.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user