Piwik\Plugins\CoreConsole\Commands\GeneratePlugin::execute PHP Method

execute() protected method

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $isTheme = $this->isTheme($input);
        $pluginName = $this->getPluginName($input, $output);
        $description = $this->getPluginDescription($input, $output);
        $version = $this->getPluginVersion($input, $output);
        $this->generatePluginFolder($pluginName);
        $plugin = new ExamplePlugin();
        $info = $plugin->getInformation();
        $exampleDescription = $info['description'];
        if ($isTheme) {
            $exampleFolder = PIWIK_INCLUDE_PATH . '/plugins/ExampleTheme';
            $replace = array('ExampleTheme' => $pluginName, $exampleDescription => $description, '0.1.0' => $version, '3.0.0-b1' => Version::VERSION);
            $whitelistFiles = array();
        } else {
            $exampleFolder = PIWIK_INCLUDE_PATH . '/plugins/ExamplePlugin';
            $replace = array('ExamplePlugin' => $pluginName, $exampleDescription => $description, '0.1.0' => $version, '3.0.0-b1' => Version::VERSION);
            $whitelistFiles = array('/ExamplePlugin.php', '/plugin.json', '/README.md', '/CHANGELOG.md', '/screenshots', '/screenshots/.gitkeep', '/docs', '/docs/faq.md', '/docs/index.md');
        }
        $this->copyTemplateToPlugin($exampleFolder, $pluginName, $replace, $whitelistFiles);
        $this->checkAndUpdateRequiredPiwikVersion($pluginName, new NullOutput());
        if ($isTheme) {
            $this->writeSuccessMessage($output, array(sprintf('Theme %s %s generated.', $pluginName, $version), 'If you have not done yet check out our Theming guide <comment>http://developer.piwik.org/guides/theming</comment>', 'Enjoy!'));
        } else {
            $this->writeSuccessMessage($output, array(sprintf('Plugin %s %s generated.', $pluginName, $version), 'Our developer guides will help you developing this plugin, check out <comment>http://developer.piwik.org/guides</comment>', 'To see a list of available generators execute <comment>./console list generate</comment>', 'Enjoy!'));
        }
    }