Class: Sashimi::Commands::Install

Inherits:
Object
  • Object
show all
Defined in:
lib/sashimi/commands.rb

Instance Method Summary collapse

Constructor Details

#initialize(base_command) ⇒ Install

Returns a new instance of Install.



87
88
89
# File 'lib/sashimi/commands.rb', line 87

def initialize(base_command)
  @base_command = base_command
end

Instance Method Details

#optionsObject



91
92
93
94
95
96
97
98
# File 'lib/sashimi/commands.rb', line 91

def options
  OptionParser.new do |o|
    o.set_summary_indent('  ')
    o.banner =    "Usage: #{@base_command.script_name} install [OPTIONS] URL [URL2, URL3]"
    o.define_head "Install plugin(s) from known URL(s)."
    o.on("-r", "--rails", "Install the plugin(s) in a Rails app.") { |@rails| }
  end
end

#parse!(args) ⇒ Object



100
101
102
103
104
105
106
107
108
109
# File 'lib/sashimi/commands.rb', line 100

def parse!(args)
  options.parse!(args)
  args.each do |url_or_name|
    if @rails
      Plugin.new(url_or_name).add
    else
      Plugin.new(nil, url_or_name).install
    end
  end
end