| 1 |
# frozen_string_literal: true |
| 2 |
|
| 3 |
require_relative "../vendored_thor" |
| 4 |
module Bundler |
| 5 |
class CLI::Plugin < Thor |
| 6 |
desc "install PLUGINS", "Install the plugin from the source" |
| 7 |
long_desc <<-D |
| 8 |
Install plugins either from the rubygems source provided (with --source option), from a git source provided with --git, or a local path provided with --path. If no sources are provided, it uses Gem.sources |
| 9 |
D |
| 10 |
method_option "source", type: :string, default: nil, banner: "URL of the RubyGems source to fetch the plugin from" |
| 11 |
method_option "version", type: :string, default: nil, banner: "The version of the plugin to fetch" |
| 12 |
method_option "git", type: :string, default: nil, banner: "URL of the git repo to fetch from" |
| 13 |
method_option "local_git", type: :string, default: nil, banner: "Path of the local git repo to fetch from (deprecated)" |
| 14 |
method_option "branch", type: :string, default: nil, banner: "The git branch to checkout" |
| 15 |
method_option "ref", type: :string, default: nil, banner: "The git revision to check out" |
| 16 |
method_option "path", type: :string, default: nil, banner: "Path of a local gem to directly use" |
| 17 |
def install(*plugins) |
| 18 |
Bundler::Plugin.install(plugins, options) |
| 19 |
end |
| 20 |
|
| 21 |
desc "uninstall PLUGINS", "Uninstall the plugins" |
| 22 |
long_desc <<-D |
| 23 |
Uninstall given list of plugins. To uninstall all the plugins, use -all option. |
| 24 |
D |
| 25 |
method_option "all", type: :boolean, default: nil, banner: "Uninstall all the installed plugins. If no plugin is installed, then it does nothing." |
| 26 |
def uninstall(*plugins) |
| 27 |
Bundler::Plugin.uninstall(plugins, options) |
| 28 |
end |
| 29 |
|
| 30 |
desc "list", "List the installed plugins and available commands" |
| 31 |
def list |
| 32 |
Bundler::Plugin.list |
| 33 |
end |
| 34 |
end |
| 35 |
end |