Sha256: 1a0726518986097ebf3a090d0d1f973deb0d34ab50a828c64ece0044a13f991f

Contents?: true

Size: 655 Bytes

Versions: 5

Compression:

Stored size: 655 Bytes

Contents

require 'open3'

module Kontena::Cli::Plugins
  class InstallCommand < Kontena::Command
    include Kontena::Util

    parameter 'NAME', 'Plugin name'

    def execute
      install_plugin(name)
    end

    def install_plugin(name)
      plugin = "kontena-plugin-#{name}"
      gem_bin = which('gem')
      install_command = "#{gem_bin} install --no-ri --no-doc #{plugin}"
      success = false
      spinner "Installing plugin #{name.colorize(:cyan)}" do
        stdout, stderr, status = Open3.capture3(install_command)
        unless stderr.empty?
          raise stderr
        end
      end
    rescue => exc
      puts exc.message
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kontena-cli-0.16.0.pre5 lib/kontena/cli/plugins/install_command.rb
kontena-cli-0.16.0.pre4 lib/kontena/cli/plugins/install_command.rb
kontena-cli-0.16.0.pre3 lib/kontena/cli/plugins/install_command.rb
kontena-cli-0.16.0.pre2 lib/kontena/cli/plugins/install_command.rb
kontena-cli-0.16.0.pre1 lib/kontena/cli/plugins/install_command.rb