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
fb516f83
Commit
fb516f83
authored
Feb 08, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added bundle:make command
parent
fa4d54e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
17 deletions
+58
-17
bundler.php
laravel/cli/tasks/bundle/bundler.php
+58
-17
No files found.
laravel/cli/tasks/bundle/bundler.php
View file @
fb516f83
...
...
@@ -4,6 +4,7 @@ use Laravel\IoC;
use
Laravel\File
;
use
Laravel\Cache
;
use
Laravel\Bundle
;
use
Laravel\Request
;
use
Laravel\CLI\Tasks\Task
;
class
Bundler
extends
Task
{
...
...
@@ -79,16 +80,14 @@ class Bundler extends Task {
continue
;
}
// 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.
// First we want to retrieve the information for the bundle, such as
// where it is currently installed. This will allow us to upgrade
// the bundle into it's current installation path.
$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.
// 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 don't know the provider used to install.
$response
=
$this
->
retrieve
(
$name
);
if
(
$response
[
'status'
]
==
'not-found'
)
...
...
@@ -96,9 +95,9 @@ class Bundler extends Task {
continue
;
}
// Once we have the bundle information from the API,
//
we'll simply recursively delete the bundle and
// the
n re-download it using the provider
.
// Once we have the bundle information from the API,
we'll simply
//
recursively delete the bundle and then re-download it using
// the
correct provider assigned to the bundle
.
File
::
rmdir
(
$bundle
->
location
);
$this
->
download
(
$response
[
'bundle'
],
$bundle
->
location
);
...
...
@@ -117,17 +116,59 @@ class Bundler extends Task {
*/
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
(
count
(
$bundles
)
==
0
)
$bundles
=
Bundle
::
names
();
$publisher
=
IoC
::
resolve
(
'bundle.publisher'
);
array_walk
(
$bundles
,
array
(
IoC
::
resolve
(
'bundle.publisher'
),
'publish'
));
}
foreach
(
$bundles
as
$bundle
)
/**
* Create a new bundle stub.
*
* @param array $arguments
* @return void
*/
public
function
make
(
$arguments
)
{
if
(
!
isset
(
$arguments
[
0
]))
{
throw
new
\Exception
(
"We need to know the bundle name!"
);
}
// First we'll grab the name from the argument list and make sure a bundle
// with that name doesn't already exist. If it does, we'll bomb out and
// notify the developer of the problem. Bundle names must be unique
// since classes are prefixed with the name.
$options
[
'name'
]
=
$arguments
[
0
];
if
(
Bundle
::
exists
(
$options
[
'name'
]))
{
$publisher
->
publish
(
$bundle
);
throw
new
\Exception
(
"A bundle with that name already exists!"
);
}
// The developer may specify a location to which the bundle should be
// installed. If a location is not specified, the bundle name will
// be used as the default installation location.
$location
=
Request
::
server
(
'cli.location'
)
?:
$options
[
'name'
];
$location
=
path
(
'bundle'
)
.
$location
;
$options
[
'handles'
]
=
Request
::
server
(
'cli.handles'
);
// We'll create the actual PHP that should be inserted into the info
// file for the bundle. This contains the bundle's name as well as
// any URIs it is setup to handle.
$info
=
'<?php return '
.
var_export
(
$options
,
true
)
.
';'
;
mkdir
(
$location
,
0777
,
true
);
// Finally we can write the file to disk and clear the bundle cache.
// We clear the cache so that the new bundle will be recognized
// immediately and the developer can start using it.
File
::
put
(
$location
.
DS
.
'bundle'
.
EXT
,
$info
);
echo
"Bundle [
{
$options
[
'name'
]
}
] has been created!"
.
PHP_EOL
;
$this
->
refresh
();
}
/**
...
...
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