Skip to content
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

Load extra commands from home directory #153

Merged
merged 2 commits into from May 27, 2022
Merged

Conversation

github-actions[bot]
Copy link

@github-actions github-actions bot commented May 27, 2022

This PR closes #152 and adds the ability to load extra commands from home directory. It also adds support to run all commands in the site:create:* namespace after site:create command.

Extra Commands

Suppose the following PHP file is in ~/.joomlatools/console/commands/CertCreate.php :

<?php
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

use Joomlatools\Console\Command\Site\AbstractSite;

class CertCreate extends AbstractSite
{
    protected function configure()
    {
        parent::configure();

        $this
            ->setName('cert:create')
            ->setAliases(['site:create:cert'])
            ->setDescription('Creates a new Minica certificate')
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        parent::execute($input, $output);

        return 0;
    }
}

This file will be loaded automatically as the cert:create command so that you can do joomla cert:create foo

Running extra commands after site:create

Note that the above file has this line in the configure method: ->setAliases(['site:create:cert'])

When the site:create command runs it'll run all commands that has a name or alias that starts with site:create:. So having this alias automatically runs cert:create after site:create command with the same site name.

@github-actions github-actions bot added this to the 2.0 milestone May 27, 2022
ercanozkaya added a commit to joomlatools/joomlatools-server that referenced this pull request May 27, 2022
…matically

* It tries to create a new certificate for the site first.
* If it exists (returning 409 Conflict) it tries to renew the certificate if it's close to expiry.
* See: joomlatools/joomlatools-console#153 for details
@ercanozkaya ercanozkaya merged commit 820297d into master May 27, 2022
@ercanozkaya ercanozkaya deleted the feature/152-commands branch May 27, 2022 10:39
johanjanssens pushed a commit to joomlatools/joomlatools-server that referenced this pull request May 30, 2022
…matically

* It tries to create a new certificate for the site first.
* If it exists (returning 409 Conflict) it tries to renew the certificate if it's close to expiry.
* See: joomlatools/joomlatools-console#153 for details
@ercanozkaya ercanozkaya modified the milestones: 2.0, v2.0.0 Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Load extra commands from home directory
1 participant