class Scheman::CommandBuilder
Public Class Methods
call(*args)
click to toggle source
# File lib/scheman/command_builder.rb, line 3 def self.call(*args) new(*args).call end
new(argv)
click to toggle source
@param argv [Array] ARGV
# File lib/scheman/command_builder.rb, line 8 def initialize(argv) @argv = argv end
Public Instance Methods
call()
click to toggle source
@return [Scheman::Commands::Base]
# File lib/scheman/command_builder.rb, line 13 def call command_class.new(@argv) rescue Errors::CommandNotFound terminate end
Private Instance Methods
command_class()
click to toggle source
# File lib/scheman/command_builder.rb, line 21 def command_class case command_name when "diff" Commands::Diff else raise Errors::CommandNotFound end end
command_name()
click to toggle source
@note You must pass a command name like “scheman diff”
# File lib/scheman/command_builder.rb, line 31 def command_name @argv[0] end
terminate()
click to toggle source
# File lib/scheman/command_builder.rb, line 39 def terminate warn usage exit(1) end
usage()
click to toggle source
# File lib/scheman/command_builder.rb, line 35 def usage "Usage: #{$0} <command> [options]" end