module Protobox::Commands
Constants
- CUSTOM_COMMANDS
- STOCK_COMMANDS
Public Instance Methods
help(args)
click to toggle source
$ protobox help
# File lib/protobox/commands.rb, line 42 def help(args) require_relative 'command/help' Command::Help.execute(args) end
init(args)
click to toggle source
$ protobox init
# File lib/protobox/commands.rb, line 36 def init(args) require_relative 'command/init' Command::Init.execute(args) end
pass(args)
click to toggle source
pass through
# File lib/protobox/commands.rb, line 53 def pass(args) require_relative 'command/passthrough' Command::PassThrough.execute(args) end
run(args)
click to toggle source
# File lib/protobox/commands.rb, line 8 def run(args) args.unshift 'help' if args.empty? # get first argument cmd = args[0] # commands can have dashes cmd = cmd.gsub(/(\w)-/, '\1_') if STOCK_COMMANDS.include?(cmd) send("pass", args) elsif method_defined?(cmd) and cmd != 'run' and cmd != 'pass' args.shift send(cmd, args) else send("help", args) end rescue Errno::ENOENT if $!.message.include? "No such file or directory - vagrant" abort "Error: `vagrant` command not found" else raise end rescue Errors::Error => err abort "Error: #{err.message}" end
version(args)
click to toggle source
$ protobox version
# File lib/protobox/commands.rb, line 48 def version(args) puts Protobox::VERSION end