Esempio n. 1
0
    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $plugin_name = $this->argument('plugin');
        $error_line = <<<EOF
Sorry but the plugin: '{$plugin_name}' doenst exists!
EOF;
        $confirm_line = <<<EOF
The plugin: '{$plugin_name}' doenst exists do you whish to sync plugins? [y|N]
EOF;
        $success_line = <<<EOF
<comment>{$plugin_name} installed success</comment>
EOF;
        $this->pluginManager->init();
        if ($plugin = $this->pluginManager->getPluginCollection()->get($plugin_name)) {
            $plugin->install();
            $this->line($success_line);
        } else {
            if ($this->confirm($confirm_line, 'y')) {
                $this->pluginManager->sync();
                if ($plugin = $this->pluginManager->getPluginCollection()->get($plugin_name)) {
                    $plugin->install();
                    $this->line($success_line);
                } else {
                    $this->error($error_line);
                }
            }
        }
    }