Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
14ab7c4e
Commit
14ab7c4e
authored
Feb 02, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweaking github provider.
parent
a6c083f3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
13 deletions
+61
-13
github.php
laravel/cli/tasks/bundle/providers/github.php
+29
-11
provider.php
laravel/cli/tasks/bundle/providers/provider.php
+32
-2
No files found.
laravel/cli/tasks/bundle/providers/github.php
View file @
14ab7c4e
<?php
namespace
Laravel\CLI\Tasks\Bundle\Providers
;
class
Github
implement
s
Provider
{
class
Github
extend
s
Provider
{
/**
* Install the given bundle into the application.
...
...
@@ -10,25 +10,43 @@ class Github implements Provider {
*/
public
function
install
(
$bundle
)
{
$
repository
=
"git@github.com:
{
$bundle
[
'location'
]
}
.git"
;
$
method
=
(
Request
::
server
(
'cli.zip'
))
?
'zipball'
:
'submodule'
;
$path
=
array_get
(
$bundle
,
'path'
,
$bundle
[
'name'
]);
$this
->
$method
(
$bundle
);
}
// 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
)))
/**
* Install a Github hosted bundle from Zip.
*
* @param string $bundle
* @return void
*/
protected
function
zipball
(
$bundle
)
{
mkdir
(
$target
,
0777
,
true
);
$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"
;
$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
// a location outside of the Git repository, so we don't need
// 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'
);
}
...
...
laravel/cli/tasks/bundle/providers/provider.php
View file @
14ab7c4e
<?php
namespace
Laravel\CLI\Tasks\Bundle\Providers
;
interface
Provider
{
abstract
class
Provider
{
/**
* Install the given bundle into the application.
...
...
@@ -8,6 +8,36 @@ interface Provider {
* @param string $bundle
* @return void
*/
public
function
install
(
$bundle
);
abstract
public
function
install
(
$bundle
);
/**
* Create the path to the bundle's dirname.
*
* @param array $bundle
* @return void
*/
protected
function
directory
(
$bundle
)
{
// If the installation target directory doesn't exist, we will create
// it recursively so that we can properly install the bundle to the
// correct path in the application.
$target
=
dirname
(
path
(
'bundle'
)
.
$this
->
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment