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
89313696
Commit
89313696
authored
Sep 21, 2012
by
vtalbot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add task bundle:uninstall, bundle:unpublish, migrate:rollback bundle, migrate:reset bundle.
parent
6c55f9cf
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
94 additions
and
2 deletions
+94
-2
bundler.php
laravel/cli/tasks/bundle/bundler.php
+50
-0
publisher.php
laravel/cli/tasks/bundle/publisher.php
+20
-0
help.json
laravel/cli/tasks/help.json
+8
-0
migrator.php
laravel/cli/tasks/migrate/migrator.php
+16
-2
No files found.
laravel/cli/tasks/bundle/bundler.php
View file @
89313696
...
...
@@ -61,6 +61,43 @@ class Bundler extends Task {
}
}
/**
* Uninstall the given bundles from the application.
*
* @param array $bundles
* @return void
*/
public
function
uninstall
(
$bundles
)
{
if
(
count
(
$bundles
)
==
0
)
{
throw
new
\Exception
(
"Tell me what bundle to uninstall."
);
}
foreach
(
$bundles
as
$name
)
{
if
(
!
Bundle
::
exists
(
$name
))
{
echo
"Bundle [
{
$name
}
] is not installed."
;
continue
;
}
echo
"Uninstalling [
{
$name
}
]..."
.
PHP_EOL
;
$migrator
=
IoC
::
resolve
(
'task: migrate'
);
$migrator
->
reset
(
$name
);
$publisher
=
IoC
::
resolve
(
'bundle.publisher'
);
$publisher
->
unpublish
(
$name
);
$location
=
Bundle
::
path
(
$name
);
File
::
rmdir
(
$location
);
echo
"Bundle [
{
$name
}
] has been uninstalled!"
.
PHP_EOL
;
}
echo
"Now, you have to remove those bundle from your application/bundles.php"
.
PHP_EOL
;
}
/**
* Upgrade the given bundles for the application.
*
...
...
@@ -159,6 +196,19 @@ class Bundler extends Task {
array_walk
(
$bundles
,
array
(
IoC
::
resolve
(
'bundle.publisher'
),
'publish'
));
}
/**
* Delete bundle assets from the public directory.
*
* @param array $bundles
* @return void
*/
public
function
unpublish
(
$bundles
)
{
if
(
count
(
$bundles
)
==
0
)
$bundles
=
Bundle
::
names
();
array_walk
(
$bundles
,
array
(
IoC
::
resolve
(
'bundle.publisher'
),
'unpublish'
));
}
/**
* Install a bundle using a provider.
*
...
...
laravel/cli/tasks/bundle/publisher.php
View file @
89313696
...
...
@@ -28,6 +28,26 @@ class Publisher {
echo
"Assets published for bundle [
$bundle
]."
.
PHP_EOL
;
}
/**
* Delete a bundle's assets from the public directory
*
* @param string $bundle
* @return void
*/
public
function
unpublish
(
$bundle
)
{
if
(
!
Bundle
::
exists
(
$bundle
))
{
echo
"Bundle [
$bundle
] is not registered."
;
return
;
}
File
::
rmdir
(
path
(
'public'
)
.
'bundles'
.
DS
.
$bundle
);
echo
"Assets deleted for bundle [
$bundle
]."
.
PHP_EOL
;
}
/**
* Copy the contents of a bundle's assets to the public folder.
*
...
...
laravel/cli/tasks/help.json
View file @
89313696
...
...
@@ -38,6 +38,10 @@
"description"
:
"Install a bundle."
,
"command"
:
"php artisan bundle:install swiftmailer"
},
"bundle:uninstall"
:
{
"description"
:
"Uninstall a bundle, delete its public, rollback its migrations."
,
"command"
:
"php artisan bundle:uninstall swiftmailer"
},
"bundle:upgrade"
:
{
"description"
:
"Upgrade a bundle."
,
"command"
:
"php artisan bundle:upgrade swiftmailer"
...
...
@@ -45,6 +49,10 @@
"bundle:publish"
:
{
"description"
:
"Publish all bundles' assets."
,
"command"
:
"php artisan bundle:publish"
},
"bundle:unpublish"
:
{
"description"
:
"Delete all bundles' assets from the public directory."
,
"command"
:
"php artisan bundle:unpublish"
}
},
"Unit Testing"
:
{
...
...
laravel/cli/tasks/migrate/migrator.php
View file @
89313696
...
...
@@ -103,9 +103,23 @@ class Migrator extends Task {
{
$migrations
=
$this
->
resolver
->
last
();
// If bundles supplied, filter migrations to rollback only bundles'
// migrations.
if
(
count
(
$arguments
)
>
0
)
{
$bundles
=
$arguments
;
if
(
!
is_array
(
$bundles
))
$bundles
=
array
(
$bundles
);
$migrations
=
array_filter
(
$migrations
,
function
(
$migration
)
use
(
$bundles
)
{
return
in_array
(
$migration
[
'bundle'
],
$bundles
);
});
}
if
(
count
(
$migrations
)
==
0
)
{
echo
"Nothing to rollback."
;
echo
"Nothing to rollback."
.
PHP_EOL
;
return
false
;
}
...
...
@@ -136,7 +150,7 @@ class Migrator extends Task {
*/
public
function
reset
(
$arguments
=
array
())
{
while
(
$this
->
rollback
())
{};
while
(
$this
->
rollback
(
$arguments
))
{};
}
/**
...
...
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