Class: Commands::Install
Instance Method Summary collapse
-
#initialize(base_command) ⇒ Install
constructor
A new instance of Install.
- #options ⇒ Object
- #parse!(args) ⇒ Object
Constructor Details
#initialize(base_command) ⇒ Install
Returns a new instance of Install.
189 190 191 192 193 |
# File 'lib/commands/extension.rb', line 189 def initialize(base_command) @base_command = base_command @method = :http @options = { :quiet => false, :force => false } end |
Instance Method Details
#options ⇒ Object
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/commands/extension.rb', line 195 def OptionParser.new do |o| o.set_summary_indent(' ') o. = "Usage: #{@base_command.script_name} install EXTENSION [EXTENSION [EXTENSION] ...]" o.define_head "Install one or more extensions." o.separator "" o.separator "Options:" o.on( "-q", "--quiet", "Suppresses the output from installation.", "Ignored if -v is passed (./script/extension -v install ...)") { |v| @options[:quiet] = true } o.on( "-f", "--force", "Reinstalls an extension if it's already installed.") { |v| @options[:force] = true } o.separator "" o.separator "You must specify extensions as absolute URLs to a plugin repository." end end |
#parse!(args) ⇒ Object
212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/commands/extension.rb', line 212 def parse!(args) .parse!(args) environment = @base_command.environment install_method = :clone puts "Extensions will be installed using #{install_method}" if $verbose args.each do |name| ::Extension.new(name).install(@options) end rescue StandardError => e puts "Extension not found: #{args.inspect}" puts e.inspect if $verbose exit 1 end |