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
8cfb6d62
Commit
8cfb6d62
authored
Jan 23, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring the cli.
parent
611f8d7e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
41 deletions
+62
-41
artisan.php
laravel/cli/artisan.php
+1
-25
command.php
laravel/cli/command.php
+4
-1
dependencies.php
laravel/cli/dependencies.php
+57
-0
bundler.php
laravel/cli/tasks/bundle/bundler.php
+0
-15
No files found.
laravel/cli/artisan.php
View file @
8cfb6d62
...
@@ -17,31 +17,7 @@ Bundle::start(DEFAULT_BUNDLE);
...
@@ -17,31 +17,7 @@ Bundle::start(DEFAULT_BUNDLE);
* us to seamlessly add tasks to the CLI so that the Task class
* us to seamlessly add tasks to the CLI so that the Task class
* doesn't have to worry about how to resolve core tasks.
* doesn't have to worry about how to resolve core tasks.
*/
*/
require
SYS_PATH
.
'cli/dependencies'
.
EXT
;
/**
* The bundle task is responsible for the installation of bundles
* and their dependencies. It utilizes the bundles API to get the
* meta-data for the available bundles.
*/
IoC
::
register
(
'task: bundle'
,
function
()
{
return
new
Tasks\Bundle\Bundler
;
});
/**
* The migrate task is responsible for running database migrations
* as well as migration rollbacks. We will also create an instance
* of the migration resolver and database classes, which are used
* to perform various support functions for the migrator.
*/
IoC
::
register
(
'task: migrate'
,
function
()
{
$database
=
new
Tasks\Migrate\Database
;
$resolver
=
new
Tasks\Migrate\Resolver
(
$database
);
return
new
Tasks\Migrate\Migrator
(
$resolver
,
$database
);
});
/**
/**
* We will wrap the command execution in a try / catch block and
* We will wrap the command execution in a try / catch block and
...
...
laravel/cli/command.php
View file @
8cfb6d62
...
@@ -27,6 +27,9 @@ class Command {
...
@@ -27,6 +27,9 @@ class Command {
// via the container instead of by this class.
// via the container instead of by this class.
if
(
Bundle
::
exists
(
$bundle
))
Bundle
::
start
(
$bundle
);
if
(
Bundle
::
exists
(
$bundle
))
Bundle
::
start
(
$bundle
);
// Once the bundle has been started, we will attempt to resolve the
// task instance. Tasks may be resolved through the file system or
// through the application IoC container.
if
(
is_null
(
$task
=
static
::
resolve
(
$bundle
,
$task
)))
if
(
is_null
(
$task
=
static
::
resolve
(
$bundle
,
$task
)))
{
{
throw
new
\Exception
(
"Sorry, I can't find that task."
);
throw
new
\Exception
(
"Sorry, I can't find that task."
);
...
@@ -47,7 +50,7 @@ class Command {
...
@@ -47,7 +50,7 @@ class Command {
// Extract the task method from the task string. Methods are called
// Extract the task method from the task string. Methods are called
// on tasks by separating the task and method with a single colon.
// on tasks by separating the task and method with a single colon.
// If no task is specified, "run" is used as the default
method
.
// If no task is specified, "run" is used as the default.
if
(
str_contains
(
$task
,
':'
))
if
(
str_contains
(
$task
,
':'
))
{
{
list
(
$task
,
$method
)
=
explode
(
':'
,
$task
);
list
(
$task
,
$method
)
=
explode
(
':'
,
$task
);
...
...
laravel/cli/dependencies.php
0 → 100644
View file @
8cfb6d62
<?php
/**
* The migrate task is responsible for running database migrations
* as well as migration rollbacks. We will also create an instance
* of the migration resolver and database classes, which are used
* to perform various support functions for the migrator.
*/
IoC
::
register
(
'task: migrate'
,
function
()
{
$database
=
new
Tasks\Migrate\Database
;
$resolver
=
new
Tasks\Migrate\Resolver
(
$database
);
return
new
Tasks\Migrate\Migrator
(
$resolver
,
$database
);
});
/**
* The bundle task is responsible for the installation of bundles
* and their dependencies. It utilizes the bundles API to get the
* meta-data for the available bundles.
*/
IoC
::
register
(
'task: bundle'
,
function
()
{
return
new
Tasks\Bundle\Bundler
;
});
/**
* The bundle repository is responsible for communicating with
* the Laravel bundle sources to get information regarding any
* bundles that are requested for installation.
*/
IoC
::
singleton
(
'bundle.repository'
,
function
()
{
return
new
Repository
;
});
/**
* The bundle publisher is responsible for publishing bundle
* assets and tests to their correct directories within the
* application, such as the web accessible directory.
*/
IoC
::
singleton
(
'bundle.publisher'
,
function
()
{
return
new
Publisher
;
});
/**
* The Github bundle provider installs bundles that live on
* Github. This provider will add the bundle as a submodule
* and will update the submodule so that the bundle is
* installed into the bundle directory.
*/
IoC
::
singleton
(
'bundle.provider: github'
,
function
()
{
return
new
Providers\Github
;
});
\ No newline at end of file
laravel/cli/tasks/bundle/bundler.php
View file @
8cfb6d62
...
@@ -4,21 +4,6 @@ use Laravel\IoC;
...
@@ -4,21 +4,6 @@ use Laravel\IoC;
use
Laravel\Bundle
;
use
Laravel\Bundle
;
use
Laravel\CLI\Tasks\Task
;
use
Laravel\CLI\Tasks\Task
;
IoC
::
singleton
(
'bundle.repository'
,
function
()
{
return
new
Repository
;
});
IoC
::
singleton
(
'bundle.publisher'
,
function
()
{
return
new
Publisher
;
});
IoC
::
singleton
(
'bundle.provider: github'
,
function
()
{
return
new
Providers\Github
;
});
class
Bundler
extends
Task
{
class
Bundler
extends
Task
{
/**
/**
...
...
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