lib/ro_commands/base.rb in ro_commands-0.0.1 vs lib/ro_commands/base.rb in ro_commands-0.0.2

- old
+ new

@@ -3,10 +3,12 @@ require "ro_commands/core_ext/string" require "ro_commands/core_ext/hash" require "ro_commands/helpers/out" require "ro_commands/helpers/bash" +require "active_support/all" +require "ro_commands/core_ext/thor" #Thor.class_eval do # # def self.desc(usage, description, options={}) # if options[:for] @@ -21,10 +23,20 @@ module RoCommands class Base < Thor protected class << self + def start(given_args=ARGV, config={}) + given_args.flatten! + opt = given_args.extract_options! + if opt and opt[:pwd] + Out.out("Current working path is #{opt[:pwd]}") + Dir.chdir opt[:pwd] + end + given_args = given_args - [{pwd: opt[:pwd]}] + super + end def method_added(method) super unless method.match(%r{drb_}) meths << method @@ -46,11 +58,10 @@ end end include ::Bash - def get_options(args) h = {} args.select do |a| a.match ":" end.each do |a| @@ -86,10 +97,10 @@ r = options.split(":") opts[:"#{r[0]}"] = to_boolean r[1] opts end - def handle_drb_out(result) + def handle_drb_out Out.msgs end end end