-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
179 changed files
with
1,972 additions
and
6,588 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
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 |
---|---|---|
@@ -1,60 +1,19 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
$workingPath = getcwd(); | ||
|
||
define('CANVAS_WORKING_PATH', $workingPath); | ||
define('CANVAS_WORKING_PATH', $workingPath = getcwd()); | ||
define('TESTBENCH_WORKING_PATH', $workingPath); | ||
|
||
require $_composer_autoload_path ?? __DIR__.'/vendor/autoload.php'; | ||
|
||
$config = ['preset' => Orchestra\Canvas\Canvas::presetFromEnvironment($workingPath)]; | ||
|
||
if (file_exists($workingPath.DIRECTORY_SEPARATOR.'canvas.yaml')) { | ||
$config = Symfony\Component\Yaml\Yaml::parseFile($workingPath.DIRECTORY_SEPARATOR.'canvas.yaml'); | ||
} | ||
|
||
$files = new Illuminate\Filesystem\Filesystem(); | ||
|
||
$preset = Orchestra\Canvas\Canvas::preset( | ||
$config, $workingPath, $files | ||
$config = Orchestra\Testbench\Foundation\Config::loadFromYaml( | ||
workingPath: $workingPath, | ||
defaults: [ | ||
'providers' => [], | ||
'dont-discover' => [], | ||
], | ||
); | ||
|
||
$app = new Symfony\Component\Console\Application('Canvas for Laravel'); | ||
|
||
$app->setVersion(Composer\InstalledVersions::getPrettyVersion('orchestra/canvas')); | ||
|
||
Illuminate\Support\Collection::make([ | ||
Orchestra\Canvas\Commands\Channel::class => true, | ||
Orchestra\Canvas\Commands\Component::class => true, | ||
Orchestra\Canvas\Commands\Console::class => true, | ||
Orchestra\Canvas\Commands\ConsoleGenerator::class => true, | ||
Orchestra\Canvas\Commands\Database\Cast::class => true, | ||
Orchestra\Canvas\Commands\Database\Eloquent::class => true, | ||
Orchestra\Canvas\Commands\Database\Factory::class => true, | ||
Orchestra\Canvas\Commands\Database\Migration::class => true, | ||
Orchestra\Canvas\Commands\Database\Observer::class => true, | ||
Orchestra\Canvas\Commands\Database\Seeder::class => $preset->is('laravel'), | ||
Orchestra\Canvas\Commands\Event::class => true, | ||
Orchestra\Canvas\Commands\Exception::class => true, | ||
Orchestra\Canvas\Commands\Job::class => true, | ||
Orchestra\Canvas\Commands\Listener::class => true, | ||
Orchestra\Canvas\Commands\Mail::class => true, | ||
Orchestra\Canvas\Commands\Notification::class => true, | ||
Orchestra\Canvas\Commands\Policy::class => true, | ||
Orchestra\Canvas\Commands\Preset::class => ! file_exists("{$workingPath}/canvas.yaml"), | ||
Orchestra\Canvas\Commands\Provider::class => true, | ||
Orchestra\Canvas\Commands\Request::class => true, | ||
Orchestra\Canvas\Commands\Resource::class => true, | ||
Orchestra\Canvas\Commands\Routing\Controller::class => true, | ||
Orchestra\Canvas\Commands\Routing\Middleware::class => true, | ||
Orchestra\Canvas\Commands\Rule::class => true, | ||
Orchestra\Canvas\Commands\Testing::class => true, | ||
Orchestra\Canvas\Commands\StubPublish::class => true, | ||
Orchestra\Canvas\Commands\View::class => true, | ||
])->filter(fn ($value) => $value === true) | ||
->keys() | ||
->each(fn ($command) => $app->add(new $command($preset))); | ||
|
||
$preset->addAdditionalCommands($app); | ||
$commander = new Orchestra\Canvas\Console\Commander($config->getAttributes(), $workingPath); | ||
|
||
$app->run(); | ||
$commander->handle(); |
This file was deleted.
Oops, something went wrong.
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,11 @@ | ||
parameters: | ||
ignoreErrors: | ||
- | ||
message: "#^Unable to resolve the template type TMakeKey in call to method static method Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\),mixed\\>\\:\\:make\\(\\)$#" | ||
count: 1 | ||
path: src/Console/Commander.php | ||
|
||
- | ||
message: "#^Unable to resolve the template type TMakeValue in call to method static method Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\),mixed\\>\\:\\:make\\(\\)$#" | ||
count: 1 | ||
path: src/Console/Commander.php |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
includes: | ||
- phpstan-baseline.neon | ||
parameters: | ||
|
||
paths: | ||
|
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
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,78 @@ | ||
<?php | ||
|
||
namespace Orchestra\Canvas; | ||
|
||
use Illuminate\Console\Generators\PresetManager; | ||
use Illuminate\Contracts\Foundation\Application; | ||
use Illuminate\Contracts\Support\DeferrableProvider; | ||
use Illuminate\Support\Arr; | ||
use Illuminate\Support\ServiceProvider; | ||
use Symfony\Component\Yaml\Yaml; | ||
|
||
class CanvasServiceProvider extends ServiceProvider implements DeferrableProvider | ||
{ | ||
/** | ||
* Register services. | ||
* | ||
* @return void | ||
*/ | ||
public function register(): void | ||
{ | ||
if (class_exists(PresetManager::class)) { | ||
$this->callAfterResolving(PresetManager::class, function ($manager, $app) { | ||
$manager->extend('canvas', function ($app) { | ||
return new GeneratorPreset($app); | ||
}); | ||
|
||
$manager->setDefaultDriver('canvas'); | ||
}); | ||
} | ||
|
||
$this->app->singleton('orchestra.canvas', function (Application $app) { | ||
$workingPath = \defined('CANVAS_WORKING_PATH') ? CANVAS_WORKING_PATH : $this->app->basePath(); | ||
|
||
$filesystem = $app->make('files'); | ||
|
||
$config = ['preset' => 'laravel']; | ||
|
||
if (file_exists($workingPath.DIRECTORY_SEPARATOR.'canvas.yaml')) { | ||
$config = Yaml::parseFile($workingPath.DIRECTORY_SEPARATOR.'canvas.yaml'); | ||
} else { | ||
Arr::set($config, 'testing.extends', [ | ||
'unit' => 'PHPUnit\Framework\TestCase', | ||
'feature' => 'Tests\TestCase', | ||
]); | ||
|
||
$config['namespace'] = rescue(fn () => rtrim($this->app->getNamespace(), '\\'), null, false); | ||
} | ||
|
||
return Canvas::preset($config, $workingPath); | ||
}); | ||
} | ||
|
||
/** | ||
* Bootstrap services. | ||
*/ | ||
public function boot(): void | ||
{ | ||
if ($this->app->runningInConsole()) { | ||
$this->commands([ | ||
Console\CodeMakeCommand::class, | ||
Console\FactoryMakeCommand::class, | ||
Console\GeneratorMakeCommand::class, | ||
Console\TestMakeCommand::class, | ||
Console\ViewMakeCommand::class, | ||
]); | ||
} | ||
} | ||
|
||
/** | ||
* Get the services provided by the provider. | ||
* | ||
* @return array<int, string> | ||
*/ | ||
public function provides() | ||
{ | ||
return ['orchestra.canvas']; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.