Skip to content

Commit 329016e

Browse files
committed
Fixed bug with manager.
Signed-off-by: Jason Lewis <jason.lewis1991@gmail.com>
1 parent 70b5f11 commit 329016e

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

components/gear/manager.php

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ class Manager {
1111
*
1212
* @var array
1313
*/
14-
protected $gears = array();
14+
public $gears = array();
1515

1616
/**
1717
* Started Gears.
1818
*
1919
* @var array
2020
*/
21-
protected $started = array();
21+
public $started = array();
2222

2323
/**
2424
* Register a Gear with the manager.
@@ -31,9 +31,18 @@ public function register(Gear $gear)
3131
if(!$gear instanceof Gear)
3232
{
3333
throw new InvalidArgumentException('Supplied Gear is a not supported type.');
34-
}
34+
}
35+
36+
if(starts_with($gear->location, 'path: '))
37+
{
38+
$path = substr($gear->location, 6);
39+
}
40+
else
41+
{
42+
$path = path('gears') . $gear->location;
43+
}
3544

36-
if(file_exists($path = path('gears') . $gear->location))
45+
if(file_exists($path))
3746
{
3847
$this->gears[$gear->identifier] = $gear;
3948

@@ -80,7 +89,16 @@ public function start($gear)
8089
// Spin through all the files within the gears directory and those that have
8190
// the .gear.php suffix we'll require and hopefully be able to instantiate
8291
// a new object.
83-
foreach(new FilesystemIterator(path('gears') . $this->gears[$gear]->location) as $file)
92+
if(starts_with($this->gears[$gear]->location, 'path: '))
93+
{
94+
$path = substr($this->gears[$gear]->location, 6);
95+
}
96+
else
97+
{
98+
$path = path('gears') . $this->gears[$gear]->location;
99+
}
100+
101+
foreach(new FilesystemIterator($path) as $file)
84102
{
85103
if(ends_with($file->getFilename(), '.gear.php'))
86104
{

0 commit comments

Comments
 (0)