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
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,31 @@ module SC
# tool itself when it runs.
#
class Tools < ::Thor
check_unknown_options!

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


# All sproutcore tools can take some standard options. These are
# processed automatically when the tool is loaded
method_options({ '--project' => :string,
'--library' => :string, # deprecated
'--mode' => :string,
'--environment' => :string, # deprecated
'--logfile' => :string,
'--build' => :string,
['--verbose', '-v'] => false,
['--very-verbose', '-V'] => false })
def initialize(options, *args)
class_option "project", :type => :string
class_option "mode", :type => :string
class_option "logfile", :type => :string
class_option "build", :type => :string
class_option "verbose", :type => :boolean, :aliases => "-v"
class_option "very-verbose", :type => :boolean, :aliases => "-V"
class_option "library", :type => :string #deprecated
class_option "environment", :type => :string #deprecated

# 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
prepare_logger!
prepare_mode!
prepare_build_numbers!
end

no_tasks do
Expand Down Expand Up @@ -84,16 +91,6 @@ def warn(description)
## 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
# as a method
def options; @tool_options ||= HashStruct.new(super); end
Expand Down

0 comments on commit f468d87

Please sign in to comment.