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
a1131886
Commit
a1131886
authored
Feb 07, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improving bundle workflow.
parent
aa53dc70
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
102 additions
and
36 deletions
+102
-36
application.php
application/config/application.php
+30
-10
bundle.php
laravel/bundle.php
+58
-25
core.php
laravel/core.php
+1
-1
helpers.php
laravel/helpers.php
+12
-0
.gitignore
storage/cache/.gitignore
+1
-0
No files found.
application/config/application.php
View file @
a1131886
...
...
@@ -21,7 +21,6 @@ return array(
|--------------------------------------------------------------------------
|
| If you are including the "index.php" in your URLs, you can ignore this.
|
| However, if you are using mod_rewrite to get cleaner URLs, just set
| this option to an empty string and we'll take care of the rest.
|
...
...
@@ -73,13 +72,13 @@ return array(
| SSL Link Generation
|--------------------------------------------------------------------------
|
| Many sites use SSL to protect their users data. However, you may not
| a
lways be able to use SSL on your development machine, meaning all HTTPS
|
will be
broken during development.
| Many sites use SSL to protect their users data. However, you may not
be
| a
ble to use SSL on your development machine, meaning all HTTPS will be
| broken during development.
|
| For this reason, you may wish to disable the generation of HTTPS links
| throughout your application. This option does just that. All attempts
to
| generate HTTPS links will generate regular HTTP links instead.
| throughout your application. This option does just that. All attempts
|
to
generate HTTPS links will generate regular HTTP links instead.
|
*/
...
...
@@ -90,7 +89,7 @@ return array(
| Application Timezone
|--------------------------------------------------------------------------
|
| The default timezone of your application. Th
is
timezone will be used when
| The default timezone of your application. Th
e
timezone will be used when
| Laravel needs a date, such as when writing to a log file or travelling
| to a distant star at warp speed.
|
...
...
@@ -98,20 +97,41 @@ return array(
'timezone'
=>
'UTC'
,
/*
|--------------------------------------------------------------------------
| Bundle Options
|--------------------------------------------------------------------------
|
| Here you may specify options related to application bundles, such as the
| amount of time the bundle manifest is cached. Each option is detailed
| below with suggestions for sensible values.
|
| Cache:
|
| All bundles have a "bundle.info" file which contains information such
| as the name of a bundle and the URIs it responds to. This value is
| the number of that bundle info is cached.
|
*/
'bundle'
=>
array
(
'cache'
=>
0
,
),
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| Here, you can specify any class aliases that you would like registered
| when Laravel loads. Aliases are lazy-loaded, so
add as many as you want.
| when Laravel loads. Aliases are lazy-loaded, so
feel free to add!
|
| Aliases make it more convenient to use namespaced classes. Instead of
| referring to the class using its full namespace, you may simply use
| the alias defined here.
|
| We have already aliased common Laravel classes to make life easier.
|
*/
'aliases'
=>
array
(
...
...
laravel/bundle.php
View file @
a1131886
<?php
namespace
Laravel
;
defined
(
'DS'
)
or
die
(
'No direct script access.'
);
use
FilesystemIterator
as
fIterator
;
class
Bundle
{
/**
...
...
@@ -31,43 +33,74 @@ class Bundle {
public
static
$routed
=
array
();
/**
*
Register a bundle for the application
.
*
Detect all of the installed bundles from disk
.
*
* @param string $bundle
* @param mixed $config
* @return void
* @param string $path
* @return array
*/
public
static
function
register
(
$bundle
,
$config
=
array
()
)
public
static
function
detect
(
$path
)
{
$defaults
=
array
(
'handles'
=>
null
,
'auto'
=>
false
);
$bundles
=
array
();
$items
=
new
fIterator
(
$path
);
// If the given config is actually a string, we will assume it is a location
// and convert it to an array so that the developer may conveniently add
// bundles to the configuration without making an array for each one.
if
(
is_string
(
$config
))
foreach
(
$items
as
$item
)
{
$config
=
array
(
'location'
=>
$config
);
}
// If the item is a directory, we'll search for a bundle.info file.
// If one exists, we will add it to the bundle array. We will set
// the location automatically since we know it.
if
(
$item
->
isDir
())
{
$path
=
$item
->
getRealPath
()
.
DS
.
'bundle.info'
;
if
(
!
isset
(
$config
[
'location'
]))
// If we found a file, we'll require in the array it contains
// and add it to the directory. The info array will contain
// basic info like the bundle name and any URIs it may
// handle incoming requests for.
if
(
file_exists
(
$path
))
{
$config
[
'location'
]
=
$bundle
;
$info
=
require
$path
;
$info
[
'location'
]
=
dirname
(
$path
)
.
DS
;
$bundles
[
$info
[
'name'
]]
=
$info
;
continue
;
}
// If a bundle.info file doesn't exist within a directory,
// we'll recurse into the directory to keep searching in
// the bundle directory for nested bundles.
else
{
$recurse
=
static
::
detect
(
$item
->
getRealPath
());
// We will trim the trailing slash from the location and add it back so
// we don't have to worry about the developer adding or not adding it
// to the location path for the bundle.
$config
[
'location'
]
=
path
(
'bundle'
)
.
rtrim
(
$config
[
'location'
],
DS
)
.
DS
;
$bundles
=
array_merge
(
$bundles
,
$recurse
);
}
}
}
return
$bundles
;
}
/**
* Register a bundle for the application.
*
* @param array $config
* @return void
*/
public
static
function
register
(
$config
)
{
$defaults
=
array
(
'handles'
=>
null
,
'auto'
=>
false
);
// If
the handles clause is set, we will append a trailing slash so
//
that it is not ultra-greedy. Otherwise, bundles that handle "s"
//
would handle all bundles that start
with "s".
// If
a handles clause has been specified, we will cap it with a trailing
//
slash so the bundle is not extra greedy with its routes. Otherwise a
//
bundle that handles "s" would handle all routes beginning
with "s".
if
(
isset
(
$config
[
'handles'
]))
{
$config
[
'handles'
]
=
$config
[
'handles'
]
.
'/'
;
$config
[
'handles'
]
=
str_finish
(
$config
[
'handles'
],
'/'
)
;
}
static
::
$bundles
[
$
bundle
]
=
array_merge
(
$defaults
,
$config
);
static
::
$bundles
[
$
config
[
'name'
]
]
=
array_merge
(
$defaults
,
$config
);
}
/**
...
...
@@ -82,7 +115,7 @@ class Bundle {
{
if
(
static
::
started
(
$bundle
))
return
;
if
(
$bundle
!==
DEFAULT_BUNDLE
and
!
static
::
exists
(
$bundle
))
if
(
!
static
::
exists
(
$bundle
))
{
throw
new
\Exception
(
"Bundle [
$bundle
] has not been installed."
);
}
...
...
laravel/core.php
View file @
a1131886
...
...
@@ -53,7 +53,7 @@ Autoloader::namespaces(array('Laravel' => path('sys')));
*/
$bundles
=
Cache
::
remember
(
'laravel.bundle.manifest'
,
function
()
{
return
Bundle
::
detect
();
return
Bundle
::
detect
(
path
(
'bundle'
)
);
},
Config
::
get
(
'application.bundle.cache'
));
...
...
laravel/helpers.php
View file @
a1131886
...
...
@@ -351,6 +351,18 @@ function str_contains($haystack, $needle)
return
strpos
(
$haystack
,
$needle
)
!==
false
;
}
/**
* Cap a string with a single instance of the given string.
*
* @param string $value
* @param string $cap
* @return string
*/
function
str_finish
(
$value
,
$cap
)
{
return
rtrim
(
$value
,
$cap
)
.
$cap
;
}
/**
* Return the value of the given item.
*
...
...
storage/cache/.gitignore
View file @
a1131886
laravel.bundle.manifest
\ 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