Sha256: 76c1de75f4ac5d7bd5c69dc4b7dfc301192b93ef34db468b0ef7528d3cbbc0d5

Contents?: true

Size: 1018 Bytes

Versions: 3

Compression:

Stored size: 1018 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'webgen/cli/utils'
require 'rubygems/dependency_installer'

module Webgen
  module CLI

    # The CLI command for installing extension bundles.
    class InstallBundleCommand < CmdParse::Command

      def initialize # :nodoc:
        super('install', false, false, true)
        self.short_desc = 'Install an extension bundle'
        self.description = Utils.format_command_desc(<<DESC)
Installs an extension bundle via Rubygems. You can either provide the name
of a webgen extension bundle, the name of a Rubygem or a local file name.
DESC
      end

      def execute(args) # :nodoc:
        raise CmdParse::InvalidArgumentError.new("Bundle name needed but none given") if args.length == 0
        name = args.first
        name = "webgen-#{name}-bundle" unless name =~ /\.gem$/ || name =~ /webgen-.*-bundle/

        inst = Gem::DependencyInstaller.new(:domain => :both, :force => false)
        inst.install(name)
        puts "Installed #{name}"
      end

    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
webgen-1.0.0.beta3 lib/webgen/cli/install_bundle_command.rb
webgen-1.0.0.beta2 lib/webgen/cli/install_bundle_command.rb
webgen-1.0.0.beta1 lib/webgen/cli/install_bundle_command.rb