pantheon-systems / terminus

The Pantheon CLI — a standalone utility for performing operations on the Pantheon Platform
https://pantheon.io
Other
318 stars 196 forks source link

Plugin installation workflow #1728

Open greg-1-anderson opened 7 years ago

greg-1-anderson commented 7 years ago

Copying this report over from https://github.com/pantheon-systems/terminus-build-tools-plugin/issues/49:

I'm not a fan of the plugin installation workflow. Installation in $HOME/.terminus adds a local dependency that is a barrier to onboarding devs with a single composer.json manifest. I would prefer to add the plugins as I add terminus itself with a composer require command so that composer install takes care of the installation.

stevector commented 7 years ago

I would prefer this method for plugins too. I think it is confusing to tell people to make two directories within $HOME: $HOME/terminus for Terminus and $HOME/.terminus for plugins.

iamEAP commented 7 years ago

I'm interested in helping move this along. Sounds like a "one-true-approach" to installing plugins is desired, and it sounds like per #1498 that a composer-based approach is desired over a terminus-based approach?

Would be great to nail down a direction that we can start building toward.

greg-1-anderson commented 7 years ago

@thom8 had a good idea in https://github.com/acquia/blt/issues/1793

greg-1-anderson commented 7 years ago

a composer-based approach is desired over a terminus-based approach?

One of the initial driving requirements for Terminus plugins was that it had to be possible for someone to just drop a couple of files in the right location in the filesystem in order to get started.

The plugin manager added the additional requirement that a plugin must use Composer and be registered with Packagist in order to be shared.

With the above-mentioned idea, it would probably be possible to just composer require plugins into the Terminus directory itself. Would be worth trying, anyway.

stevector commented 7 years ago

With the above-mentioned idea, it would probably be possible to just composer require plugins into the Terminus directory itself. Would be worth trying, anyway.

The installer currently creates the file ~/terminus/composer.json

{
    "require": {
        "pantheon-systems/terminus": "^1.4"
    }
}

I think the most straightforward way to manage additional plugins is to simply add them to the require list in this file.

greg-1-anderson commented 7 years ago

See https://github.com/consolidation/Robo/pull/604, implemented for Robo & BLT. This would work well with the ~/terminus/composer.json file described above.

If that Robo PR is merged, Terminus would just need to define a well-known namespace, e.g. TerminusPlugin\\, and inject this value into the Runner() along with the Composer autoloader from the autoload file.

This would be really easy to implement, but does not meet the initial requirements for Terminus plugins, as mentioned above. I'm not sure if supporting two plugin mechanisms in Terminus would be desired.