App\Console\Commands\PluginMake::fire PHP 메소드

fire() 공개 메소드

Execute the console command.
public fire ( ) : boolean | null
리턴 boolean | null
    public function fire()
    {
        // get plugin name, namespace, path
        $name = $this->getPluginName();
        $namespace = $this->getNamespace();
        $title = $this->getTitleInput();
        $path = app('xe.plugin')->getPluginsDir() . '/' . $name;
        if ($this->checkEnv($path, $name, $namespace, $title) === false) {
            return false;
        }
        try {
            // plugin.php 파일 생성
            $this->makePluginClass($path, $name, $namespace, $title);
            // composer.json 파일 생성
            $this->makeComposerJson($path, $name, $namespace, $title);
            // directory structure 생성
            $this->makeDirectoryStructure($path);
            // composer update
            $this->runComposerDump($path);
            // plugin activate
            $this->activatePlugin($name);
        } catch (\Exception $e) {
            $this->files->deleteDirectory($path);
            throw $e;
        }
        // print info
        $url = trim(config('app.url'), '/') . '/' . config('xe.routing.fixedPrefix') . '/' . $name;
        $this->info("Plugin is created and activated successfully.");
        $this->info("See ./plugins/{$name} directory. And open {$url} in your browser.");
        $this->info("Input and modify your plugin information in ./plugins/{$name}/composer.json file.");
    }