From 14ab7c4e05bb0e089d05cf60d25a784e885f609f Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 2 Feb 2012 13:46:33 -0600 Subject: [PATCH] tweaking github provider. --- laravel/cli/tasks/bundle/providers/github.php | 40 ++++++++++++++----- .../cli/tasks/bundle/providers/provider.php | 34 +++++++++++++++- 2 files changed, 61 insertions(+), 13 deletions(-) diff --git a/laravel/cli/tasks/bundle/providers/github.php b/laravel/cli/tasks/bundle/providers/github.php index dd086e9a..5ccea0d6 100644 --- a/laravel/cli/tasks/bundle/providers/github.php +++ b/laravel/cli/tasks/bundle/providers/github.php @@ -1,6 +1,6 @@ $method($bundle); + } + + /** + * Install a Github hosted bundle from Zip. + * + * @param string $bundle + * @return void + */ + protected function zipball($bundle) + { + $zip = "https://github.com/{$bundle['location']}/zipball/master"; + + parent::zipball($zip, true); + } + + /** + * Install a Github hosted bundle using submodules. + * + * @param string $bundle + * @return void + */ + protected function submodule($bundle) { $repository = "git@github.com:{$bundle['location']}.git"; - $path = array_get($bundle, 'path', $bundle['name']); - - // If the installation target directory doesn't exist, we will create - // it recursively so that we can properly add the Git submodule for - // the bundle when we install. - if ( ! is_dir($target = dirname(path('bundle').$path))) - { - mkdir($target, 0777, true); - } + $this->directory($bundle); // We need to just extract the basename of the bundle path when // adding the submodule. Of course, we can't add a submodule to @@ -28,7 +46,7 @@ public function install($bundle) // the full bundle path. $root = basename(path('bundle')).'/'; - passthru('git submodule add '.$repository.' '.$root.$path); + passthru('git submodule add '.$repository.' '.$root.$this->path($bundle)); passthru('git submodule update'); } diff --git a/laravel/cli/tasks/bundle/providers/provider.php b/laravel/cli/tasks/bundle/providers/provider.php index f4e5190e..4080aa56 100644 --- a/laravel/cli/tasks/bundle/providers/provider.php +++ b/laravel/cli/tasks/bundle/providers/provider.php @@ -1,6 +1,6 @@ path($bundle)); + + if ( ! is_dir($target)) + { + mkdir($target, 0777, true); + } + } + + /** + * Return the path for a given bundle. + * + * @param array $bundle + * @return string + */ + protected function path($bundle) + { + return array_get($bundle, 'path', $bundle['name']); + } } \ No newline at end of file