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
ec5c08a7
Commit
ec5c08a7
authored
Feb 02, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added ability to install github bundles using zips.
parent
87424c73
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
8 deletions
+73
-8
artisan.php
laravel/cli/artisan.php
+7
-5
github.php
laravel/cli/tasks/bundle/providers/github.php
+3
-2
provider.php
laravel/cli/tasks/bundle/providers/provider.php
+38
-0
file.php
laravel/file.php
+25
-1
No files found.
laravel/cli/artisan.php
View file @
ec5c08a7
...
@@ -15,7 +15,9 @@ Bundle::start(DEFAULT_BUNDLE);
...
@@ -15,7 +15,9 @@ Bundle::start(DEFAULT_BUNDLE);
* retrieve them from the various parts of the CLI code. We can use
* retrieve them from the various parts of the CLI code. We can use
* the Request class to access them conveniently.
* the Request class to access them conveniently.
*/
*/
list
(
$arguments
,
$_SERVER
[
'cli'
])
=
Console
::
options
(
$_SERVER
[
'argv'
]);
list
(
$arguments
,
$_SERVER
[
'CLI'
])
=
Console
::
options
(
$_SERVER
[
'argv'
]);
$_SERVER
[
'CLI'
]
=
array_change_key_case
(
$_SERVER
[
'CLI'
],
CASE_UPPER
);
/**
/**
* The Laravel environment may be specified on the CLI using the "env"
* The Laravel environment may be specified on the CLI using the "env"
...
@@ -23,9 +25,9 @@ list($arguments, $_SERVER['cli']) = Console::options($_SERVER['argv']);
...
@@ -23,9 +25,9 @@ list($arguments, $_SERVER['cli']) = Console::options($_SERVER['argv']);
* files from the CLI since the environment is usually controlled
* files from the CLI since the environment is usually controlled
* by server environmenet variables.
* by server environmenet variables.
*/
*/
if
(
isset
(
$_SERVER
[
'
cli'
][
'env
'
]))
if
(
isset
(
$_SERVER
[
'
CLI'
][
'ENV
'
]))
{
{
$_SERVER
[
'LARAVEL_ENV'
]
=
$_SERVER
[
'
cli'
][
'env
'
];
$_SERVER
[
'LARAVEL_ENV'
]
=
$_SERVER
[
'
CLI'
][
'ENV
'
];
}
}
/**
/**
...
@@ -33,9 +35,9 @@ if (isset($_SERVER['cli']['env']))
...
@@ -33,9 +35,9 @@ if (isset($_SERVER['cli']['env']))
* for the "database" CLI option. This allows migrations to be run
* for the "database" CLI option. This allows migrations to be run
* conveniently for a test or staging database.
* conveniently for a test or staging database.
*/
*/
if
(
isset
(
$_SERVER
[
'
cli'
][
'db
'
]))
if
(
isset
(
$_SERVER
[
'
CLI'
][
'DB
'
]))
{
{
Config
::
set
(
'database.default'
,
$_SERVER
[
'
cli'
][
'db
'
]);
Config
::
set
(
'database.default'
,
$_SERVER
[
'
CLI'
][
'DB
'
]);
}
}
/**
/**
...
...
laravel/cli/tasks/bundle/providers/github.php
View file @
ec5c08a7
...
@@ -25,9 +25,9 @@ class Github extends Provider {
...
@@ -25,9 +25,9 @@ class Github extends Provider {
*/
*/
protected
function
zipball
(
$bundle
)
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 {
...
@@ -38,6 +38,7 @@ class Github extends Provider {
*/
*/
protected
function
submodule
(
$bundle
)
protected
function
submodule
(
$bundle
)
{
{
die
(
'here'
);
$repository
=
"git@github.com:
{
$bundle
[
'location'
]
}
.git"
;
$repository
=
"git@github.com:
{
$bundle
[
'location'
]
}
.git"
;
$this
->
directory
(
$bundle
);
$this
->
directory
(
$bundle
);
...
...
laravel/cli/tasks/bundle/providers/provider.php
View file @
ec5c08a7
<?php
namespace
Laravel\CLI\Tasks\Bundle\Providers
;
<?php
namespace
Laravel\CLI\Tasks\Bundle\Providers
;
use
Laravel\File
;
abstract
class
Provider
{
abstract
class
Provider
{
/**
/**
...
@@ -10,6 +12,42 @@ abstract class Provider {
...
@@ -10,6 +12,42 @@ abstract class Provider {
*/
*/
abstract
public
function
install
(
$bundle
);
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.
* Create the path to the bundle's dirname.
*
*
...
...
laravel/file.php
View file @
ec5c08a7
...
@@ -191,7 +191,7 @@ class File {
...
@@ -191,7 +191,7 @@ class File {
// from the installed bundle's source directory.
// from the installed bundle's source directory.
if
(
!
is_dir
(
$destination
))
if
(
!
is_dir
(
$destination
))
{
{
mkdir
(
$destination
);
mkdir
(
$destination
,
0777
,
true
);
}
}
$items
=
new
FilesystemIterator
(
$source
,
FilesystemIterator
::
SKIP_DOTS
);
$items
=
new
FilesystemIterator
(
$source
,
FilesystemIterator
::
SKIP_DOTS
);
...
@@ -227,4 +227,28 @@ class File {
...
@@ -227,4 +227,28 @@ class File {
if
(
$delete
)
rmdir
(
$source
);
if
(
$delete
)
rmdir
(
$source
);
}
}
/**
* Get the most recently modified file in a directory.
*
* @param string $directory
* @return SplFileInfo
*/
public
static
function
latest
(
$directory
)
{
$time
=
0
;
$items
=
new
FilesystemIterator
(
$directory
,
FilesystemIterator
::
SKIP_DOTS
);
// To get the latest created file, we'll simply spin through the
// directory, setting the latest file if we encounter a file
// with a UNIX timestamp greater than the latest one we
// have encountered thus far in the loop.
foreach
(
$items
as
$item
)
{
if
(
$item
->
getMTime
()
>
$time
)
$latest
=
$item
;
}
return
$latest
;
}
}
}
\ 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