New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command plugins #56

Closed
yosymfony opened this Issue Sep 6, 2015 · 0 comments

Comments

Projects
None yet
1 participant
@yosymfony
Copy link
Member

yosymfony commented Sep 6, 2015

Spress 2 can be extended with command plugins a new kind of plugin which provides subcommand for spress executable. These kind of plugin is not available with Spress core only CLI. Each command plugin must extends Yosymfony\Spress\Plugin\CommandPlugin and must implements getCommandDefinition and executeCommand methods. Command plugins are only available if you run spress at root site folder.

namespace Yosymfony\Spress\Plugin;

use Yosymfony\Spress\Core\IO\IOInterface;
use Yosymfony\Spress\Core\Plugin\EventSubscriber;

/**
 * Base class for a command plugin.
 *
 * @author Victor Puertas <vpgugr@gmail.com>
 */
class CommandPlugin implements CommandPluginInterface
{
   /**
     * Gets the command's definition.
     *
     * @return \Yosymfony\Spress\Plugin\CommandDefinition Definition of the command.
     */
    public function getCommandDefinition()
    {
    }

   /**
     * Executes the current command.
     *
     * @param \Yosymfony\Spress\Core\IO\IOInterface $io Input/output interface.
     * @param array $arguments Arguments passed to the command.
     * @param array $options Options passed to the command.
     *
     * @return null|int null or 0 if everything went fine, or an error code.
     */
    public function executeCommand(IOInterface $io, array $arguments, array $options)
    {
    }

    /**
     * Method from Yosymfony\Spress\Core\Plugin\PluginInterface
     */
    public function getMetas()
    {
        return [];
    }

    /**
     * Method from Yosymfony\Spress\Core\Plugin\PluginInterface.
     *
     * Override this method in case you need a regular plugin behavior.
     */
    public function initialize(EventSubscriber $subscriber)
    {
    }
}

@yosymfony yosymfony added the 2.0 label Sep 6, 2015

@yosymfony yosymfony added this to the Spress 2.0.0 beta milestone Sep 6, 2015

yosymfony added a commit that referenced this issue Sep 7, 2015

yosymfony referenced this issue Sep 7, 2015

yosymfony referenced this issue Sep 7, 2015

yosymfony referenced this issue Sep 7, 2015

@yosymfony yosymfony closed this Sep 23, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment