Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

Commit a7bafd6

Browse files
authored
Merge pull request #6 from lucid-architecture/master
implement support for lucid microservice installations
2 parents b85d28d + f6b396f commit a7bafd6

13 files changed

+138
-34
lines changed

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,45 @@
1+
# Lucid • Console
12
The Console companion for the Lucid Architecture.
3+
4+
## Command Line Interface
5+
The console ships with a command line interface called `lucid` that you can find in `vendor/bin/lucid` and use as
6+
```
7+
lucid make:feature ListUsers Api
8+
```
9+
10+
> To be able to address the `lucid` cli directly you need to have `./vendor/bin` as part of your `$PATH`.
11+
To do that, put this in your shell profile (~/.bash_profile, ~/.zshrc, ~/bashrc) `export PATH="$PATH:./vendor/bin`"
12+
13+
### Available Commands
14+
15+
- `help` Displays help for a command
16+
- `list` Lists commands
17+
- **make**
18+
- `make:controller` Create a new resource Controller class in a service
19+
- `make:feature ` Create a new Feature in a service
20+
- `make:job ` Create a new Job in a domain
21+
- `make:service ` Create a new Service
22+
- **list**
23+
- `list:features` List the features.
24+
- `list:services` List the services in this project.
25+
- **delete**
26+
- `delete:feature` Delete an existing Feature in a service
27+
- `delete:job ` Delete an existing Job in a domain
28+
- `delete:service` Delete an existing Service
29+
30+
### Commands Usage
31+
32+
#### Make
33+
- `make:controller <controller> [<service>]`
34+
- `make:feature <feature> [<service>]`
35+
- `make:job <job> <domain>`
36+
- `make:service <name>`
37+
38+
#### List
39+
- `list:services`
40+
- `list:features [<service>]`
41+
42+
#### Delete
43+
- `delete:service <name>`
44+
- `delete:feature <feature> [<service>]`
45+
- `delete:job <job> <domain>`

TODO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
- [ ] Specifying Laravel version on installation
1+
- [x] Specifying Laravel version on installation
22
- [ ] Documentation
33
- [ ] Change namespace using CLI
44
- > By extending `Illuminate\Foundation\Console\AppNameCommand`

lucid

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $commands = [
2121
new Lucid\Console\Commands\FeaturesListCommand(),
2222
];
2323

24-
$app = new Symfony\Component\Console\Application('Lucid Console', '0.4.1');
24+
$app = new Symfony\Component\Console\Application('Lucid Console', '0.5.0');
2525
array_walk($commands, [$app, 'add']);
2626

2727
$app->run();

src/Commands/ControllerMakeCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function fire()
6767
$this->info('Controller class created successfully.'.
6868
"\n".
6969
"\n".
70-
'Find it at <comment>'.strstr($controller, 'src/').'</comment>'."\n"
70+
'Find it at <comment>'.$controller.'</comment>'."\n"
7171
);
7272
} catch (Exception $e) {
7373
$this->error($e->getMessage());
@@ -82,8 +82,8 @@ public function fire()
8282
protected function getArguments()
8383
{
8484
return [
85-
['service', InputArgument::REQUIRED, 'The service in which the controller should be generated.'],
8685
['controller', InputArgument::REQUIRED, 'The controller\'s name.'],
86+
['service', InputArgument::OPTIONAL, 'The service in which the controller should be generated.'],
8787
];
8888
}
8989

src/Commands/FeatureDeleteCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class FeatureDeleteCommand extends SymfonyCommand
5656
public function fire()
5757
{
5858
try {
59-
$service = studly_case($this->argument('service'));
59+
$service = Str::service($this->argument('service'));
6060
$title = $this->parseName($this->argument('feature'));
6161

6262
if (!$this->exists($feature = $this->findFeaturePath($service, $title))) {
@@ -79,8 +79,8 @@ public function fire()
7979
protected function getArguments()
8080
{
8181
return [
82-
['service', InputArgument::REQUIRED, 'The service in which the feature should be deleted from.'],
8382
['feature', InputArgument::REQUIRED, 'The feature\'s name.'],
83+
['service', InputArgument::OPTIONAL, 'The service from which the feature should be deleted.'],
8484
];
8585
}
8686

src/Commands/FeatureMakeCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function fire()
6767
'Feature class '.$feature->title.' created successfully.'.
6868
"\n".
6969
"\n".
70-
'Find it at <comment>'.strstr($feature->relativePath, 'src/').'</comment>'."\n"
70+
'Find it at <comment>'.$feature->relativePath.'</comment>'."\n"
7171
);
7272
} catch (Exception $e) {
7373
$this->error($e->getMessage());
@@ -82,8 +82,8 @@ public function fire()
8282
protected function getArguments()
8383
{
8484
return [
85-
['service', InputArgument::REQUIRED, 'The service in which the feature should be implemented.'],
8685
['feature', InputArgument::REQUIRED, 'The feature\'s name.'],
86+
['service', InputArgument::OPTIONAL, 'The service in which the feature should be implemented.'],
8787
];
8888
}
8989

src/Commands/JobDeleteCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ public function fire()
7878
public function getArguments()
7979
{
8080
return [
81-
['domain', InputArgument::REQUIRED, 'The domain from which the job will be deleted.'],
8281
['job', InputArgument::REQUIRED, 'The job\'s name.'],
82+
['domain', InputArgument::REQUIRED, 'The domain from which the job will be deleted.'],
8383
];
8484
}
8585

src/Commands/JobMakeCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ public function fire()
7878
public function getArguments()
7979
{
8080
return [
81-
['domain', InputArgument::REQUIRED, 'The domain to be responsible for the job.'],
8281
['job', InputArgument::REQUIRED, 'The job\'s name.'],
82+
['domain', InputArgument::REQUIRED, 'The domain to be responsible for the job.'],
8383
];
8484
}
8585

src/Commands/ServiceDeleteCommand.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Lucid\Console\Commands;
1313

14+
use Lucid\Console\Str;
1415
use Lucid\Console\Finder;
1516
use Lucid\Console\Command;
1617
use Lucid\Console\Filesystem;
@@ -71,18 +72,22 @@ protected function getStub()
7172
*/
7273
public function fire()
7374
{
75+
if ($this->isMicroservice()) {
76+
return $this->error('This functionality is disabled in a Microservice');
77+
}
78+
7479
try {
75-
$name = ucfirst($this->argument('name'));
80+
$name = Str::service($this->argument('name'));
7681

7782
if (!$this->exists($service = $this->findServicePath($name))) {
78-
$this->error('Service '.$name.' cannot be found.');
79-
} else {
80-
$this->delete($service);
83+
return $this->error('Service '.$name.' cannot be found.');
84+
}
8185

82-
$this->info('Service <comment>'.$name.'</comment> deleted successfully.'."\n");
86+
$this->delete($service);
8387

84-
$this->info('Please remove your registered service providers, if any.');
85-
}
88+
$this->info('Service <comment>'.$name.'</comment> deleted successfully.'."\n");
89+
90+
$this->info('Please remove your registered service providers, if any.');
8691
} catch (\Exception $e) {
8792
dd($e->getMessage(), $e->getFile(), $e->getLine());
8893
}

src/Components/Feature.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
class Feature extends Component
1818
{
19-
public function __construct($title, $file, $realPath, $relativePath, Service $service, $content = '')
19+
public function __construct($title, $file, $realPath, $relativePath, Service $service = null, $content = '')
2020
{
2121
$className = str_replace(' ', '', $title).'Feature';
2222

0 commit comments

Comments
 (0)