dropped submodule support. added upgrade command for bundles.
This commit is contained in:
parent
ea42fe75f2
commit
91518db6bd
|
@ -33,4 +33,4 @@
|
|||
|
|
||||
*/
|
||||
|
||||
return array();
|
||||
return array('gravitas');
|
|
@ -1,6 +1,7 @@
|
|||
<?php namespace Laravel\CLI\Tasks\Bundle; defined('DS') or die('No direct script access.');
|
||||
|
||||
use Laravel\IoC;
|
||||
use Laravel\File;
|
||||
use Laravel\Bundle;
|
||||
use Laravel\CLI\Tasks\Task;
|
||||
|
||||
|
@ -34,7 +35,7 @@ public function install($bundles)
|
|||
{
|
||||
foreach ($this->get($bundles) as $bundle)
|
||||
{
|
||||
if (is_dir(path('bundle').$bundle['name']))
|
||||
if (Bundle::exists($bundle['name']))
|
||||
{
|
||||
echo "Bundle {$bundle['name']} is already installed.";
|
||||
|
||||
|
@ -48,7 +49,9 @@ public function install($bundles)
|
|||
// Each bundle provider implements the Provider interface and
|
||||
// is repsonsible for retrieving the bundle source from its
|
||||
// hosting party and installing it into the application.
|
||||
$this->download($bundle, $this->path($bundle));
|
||||
$path = path('bundle').$this->path($bundle);
|
||||
|
||||
$this->download($bundle, $path);
|
||||
|
||||
echo "Bundle [{$bundle['name']}] has been installed!".PHP_EOL;
|
||||
}
|
||||
|
@ -64,25 +67,38 @@ public function upgrade($bundles)
|
|||
{
|
||||
foreach ($bundles as $name)
|
||||
{
|
||||
$bundle = Bundle::get($name);
|
||||
|
||||
if (is_nulL($bundle))
|
||||
if ( ! Bundle::exists($name))
|
||||
{
|
||||
throw new \Exception("Bundle [{$name}] is not installed!");
|
||||
echo "Bundle [{$name}] is not installed!";
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$data = $this->retrieve($bundle);
|
||||
// First we want to retrieve the information for the bundle,
|
||||
// such as where it is currently installed. This will let
|
||||
// us upgrade the bundle into the same path in which it
|
||||
// is already installed.
|
||||
$bundle = Bundle::get($name);
|
||||
|
||||
// If the bundle exists, we will grab the data about the
|
||||
// bundle from the API so we can make the right bundle
|
||||
// provider for the bundle, since we have no way of
|
||||
// knowing which provider was used to install.
|
||||
$response = $this->retrieve($name);
|
||||
|
||||
if ($response['status'] == 'not-found')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Once we have the bundle information from the API,
|
||||
// we'll simply recursively delete the bundle and
|
||||
// then re-download it using the provider.
|
||||
File::rmdir($bundle->location);
|
||||
|
||||
$this->download($bundle, $bundle->location);
|
||||
$this->download($response['bundle'], $bundle->location);
|
||||
|
||||
echo "Bundle [{$bundle['name']}] has been upgraded!".PHP_EOL;
|
||||
echo "Bundle [{$name}] has been upgraded!".PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,9 +110,9 @@ public function upgrade($bundles)
|
|||
*/
|
||||
public function publish($bundles)
|
||||
{
|
||||
// If no bundles are passed to the command, we'll just gather all
|
||||
// of the installed bundle names and publish the assets for each
|
||||
// of the bundles to the public directory.
|
||||
// If no bundles are passed to the command, we'll just gather
|
||||
// all of the installed bundle names and publish the assets
|
||||
// for each of the bundles to the public directory.
|
||||
if (count($bundles) == 0) $bundles = Bundle::names();
|
||||
|
||||
$publisher = IoC::resolve('bundle.publisher');
|
||||
|
@ -138,7 +154,9 @@ protected function get($bundles)
|
|||
|
||||
$responses[] = $bundle;
|
||||
|
||||
$responses = array_merge($responses, $this->get($bundle['dependencies']));
|
||||
$dependencies = $this->get($bundle['dependencies']);
|
||||
|
||||
$responses = array_merge($responses, $dependencies);
|
||||
}
|
||||
|
||||
return $responses;
|
||||
|
@ -151,7 +169,7 @@ protected function get($bundles)
|
|||
* @param string $path
|
||||
* @return void
|
||||
*/
|
||||
protected function download($bundlem, $path)
|
||||
protected function download($bundle, $path)
|
||||
{
|
||||
$provider = "bundle.provider: {$bundle['provider']}";
|
||||
|
||||
|
|
|
@ -49,9 +49,7 @@ protected function zipball($url, $bundle, $path)
|
|||
// 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::mvdir($latest, path('bundle').$path);
|
||||
File::mvdir($latest, $path);
|
||||
|
||||
@unlink($target);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue