This repository has been archived by the owner on Apr 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
387 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the lucid-console project. | ||
* | ||
* (c) Vinelab <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Lucid\Console\Commands; | ||
|
||
use Lucid\Console\Finder; | ||
use Illuminate\Console\Command; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
|
||
/** | ||
* @author Abed Halawi <[email protected]> | ||
*/ | ||
class FeaturesListCommand extends Command | ||
{ | ||
use Finder; | ||
|
||
/** | ||
* The console command name. | ||
* | ||
* @var string | ||
*/ | ||
protected $name = 'list:features'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'List the services in this project.'; | ||
|
||
public function fire() | ||
{ | ||
foreach ($this->listFeatures($this->argument('service')) as $service => $features) { | ||
$this->comment("\n$service\n"); | ||
$this->table(['Feature', 'Service', 'File', 'Path'], $features); | ||
} | ||
} | ||
|
||
/** | ||
* Get the console command arguments. | ||
* | ||
* @return array | ||
*/ | ||
protected function getArguments() | ||
{ | ||
return [ | ||
['service', InputArgument::OPTIONAL, 'The service to list the features of.'], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the lucid-console project. | ||
* | ||
* (c) Vinelab <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Lucid\Console\Commands; | ||
|
||
use Lucid\Console\Finder; | ||
use Illuminate\Console\Command; | ||
|
||
/** | ||
* @author Abed Halawi <[email protected]> | ||
*/ | ||
class ServicesListCommand extends Command | ||
{ | ||
use Finder; | ||
|
||
/** | ||
* The console command name. | ||
* | ||
* @var string | ||
*/ | ||
protected $name = 'list:services'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'List the services in this project.'; | ||
|
||
public function fire() | ||
{ | ||
$this->table(['Service', 'Slug', 'Path'], $this->listServices()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the lucid-console project. | ||
* | ||
* (c) Vinelab <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Lucid\Console\Components; | ||
|
||
use Illuminate\Contracts\Support\Arrayable; | ||
|
||
class Component implements Arrayable | ||
{ | ||
protected $attributes = []; | ||
|
||
/** | ||
* Get the array representation of this instance. | ||
* | ||
* @return array | ||
*/ | ||
public function toArray() | ||
{ | ||
return $this->attributes; | ||
} | ||
|
||
/** | ||
* Set the attributes for this component. | ||
* | ||
* @param array $attributes | ||
*/ | ||
protected function setAttributes(array $attributes) | ||
{ | ||
$this->attributes = $attributes; | ||
} | ||
|
||
/** | ||
* Get an attribute's value if found. | ||
* | ||
* @param string $key | ||
* | ||
* @return mixed | ||
*/ | ||
public function __get($key) | ||
{ | ||
if (isset($this->attributes[$key])) { | ||
return $this->attributes[$key]; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the lucid-console project. | ||
* | ||
* (c) Vinelab <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Lucid\Console\Components; | ||
|
||
/** | ||
* @author Abed Halawi <[email protected]> | ||
*/ | ||
class Feature extends Component | ||
{ | ||
public function __construct($title, $file, $realPath, $relativePath, Service $service) | ||
{ | ||
$this->setAttributes([ | ||
'title' => $title, | ||
'service' => $service, | ||
'file' => $file, | ||
'realPath' => $realPath, | ||
'relativePath' => $relativePath, | ||
]); | ||
} | ||
|
||
public function toArray() | ||
{ | ||
$attributes = parent::toArray(); | ||
|
||
// real path not needed | ||
unset($attributes['realPath']); | ||
|
||
// map the service object to its name | ||
$attributes['service'] = $attributes['service']->name; | ||
|
||
return $attributes; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the lucid-console project. | ||
* | ||
* (c) Vinelab <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Lucid\Console\Components; | ||
|
||
/** | ||
* @author Abed Halawi <[email protected]> | ||
*/ | ||
class Service extends Component | ||
{ | ||
public function __construct($name, $realPath, $relativePath) | ||
{ | ||
$this->setAttributes([ | ||
'name' => $name, | ||
'slug' => snake_case($name), | ||
'realPath' => $realPath, | ||
'relativePath' => $relativePath, | ||
]); | ||
} | ||
|
||
public function toArray() | ||
{ | ||
$attributes = parent::toArray(); | ||
|
||
unset($attributes['realPath']); | ||
|
||
return $attributes; | ||
} | ||
} |
Oops, something went wrong.