Skip to content

Commit

Permalink
Fix tools.rb for Thor 0.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wycats committed Aug 20, 2010
1 parent 0f37e43 commit f468d87
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions lib/sproutcore/tools.rb
Expand Up @@ -24,24 +24,31 @@ module SC
# tool itself when it runs. # tool itself when it runs.
# #
class Tools < ::Thor class Tools < ::Thor
check_unknown_options!


def self.invoke(task_name) def self.invoke(task_name)
start([task_name.to_s] + ARGV) start([task_name.to_s] + ARGV)
end end



# All sproutcore tools can take some standard options. These are # All sproutcore tools can take some standard options. These are
# processed automatically when the tool is loaded # processed automatically when the tool is loaded
method_options({ '--project' => :string, class_option "project", :type => :string
'--library' => :string, # deprecated class_option "mode", :type => :string
'--mode' => :string, class_option "logfile", :type => :string
'--environment' => :string, # deprecated class_option "build", :type => :string
'--logfile' => :string, class_option "verbose", :type => :boolean, :aliases => "-v"
'--build' => :string, class_option "very-verbose", :type => :boolean, :aliases => "-V"
['--verbose', '-v'] => false, class_option "library", :type => :string #deprecated
['--very-verbose', '-V'] => false }) class_option "environment", :type => :string #deprecated
def initialize(options, *args)
# This is the core entry method used to run every tool. Extend this
# method with any standard preprocessing you want all tools to do before
# they do their specific thing.
def initialize(*)
super super
prepare_logger!
prepare_mode!
prepare_build_numbers!
end end


no_tasks do no_tasks do
Expand Down Expand Up @@ -84,16 +91,6 @@ def warn(description)
## GLOBAL OPTIONS ## GLOBAL OPTIONS
## ##


# This is the core entry method used to run every tool. Extend this
# method with any standard preprocessing you want all tools to do before
# they do their specific thing.
def invoke(*args)
prepare_logger!
prepare_mode!
prepare_build_numbers!
super
end

# Make the options hash a HashStruct so that we can access each variable # Make the options hash a HashStruct so that we can access each variable
# as a method # as a method
def options; @tool_options ||= HashStruct.new(super); end def options; @tool_options ||= HashStruct.new(super); end
Expand Down

0 comments on commit f468d87

Please sign in to comment.