Class: Webroar::Command::CommandRunner
- Inherits:
-
Object
- Object
- Webroar::Command::CommandRunner
- Defined in:
- lib/command_runner.rb
Instance Method Summary collapse
-
#initialize ⇒ CommandRunner
constructor
A new instance of CommandRunner.
- #run ⇒ Object
Constructor Details
#initialize ⇒ CommandRunner
Returns a new instance of CommandRunner.
262 263 264 265 266 |
# File 'lib/command_runner.rb', line 262 def initialize @options = {} @options[:include_paths] = "" @options[:library_paths] = "" end |
Instance Method Details
#run ⇒ Object
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'lib/command_runner.rb', line 268 def run return unless parse_args if ARGV.length == 0 if @options[:version] Installer.new.version else puts HELP end return end cmd = ARGV[0] if @options[:help] Help.new.run(cmd) return end case cmd when "help"; Help.new.run(ARGV[1]) when "install"; # When installation is interrupted on administrator account password input, terminal # is set to echo the character begin Installer.new.install(@options) ensure system('stty echo') end when "uninstall"; Installer.new.uninstall when "clear"; WebroarCommand.new.clear when "start", "stop", "restart" ; WebroarCommand.new.operation(ARGV, cmd) when "add" ; WebroarCommand.new.add(@options, ARGV) when "remove" ; WebroarCommand.new.remove(ARGV) when "test"; Installer.new.test(@options) else puts "ERROR: Invalid command: #{cmd}. See 'webroar help'." end end |