Skip to content

Commit

Permalink
Deprecate invoke() without arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Jul 25, 2010
1 parent 6a9478b commit db85b66
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/thor/invocation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ def initialize(args=[], options={}, config={}, &block) #:nodoc:
# invoke Rspec::RR, [], :style => :foo
#
def invoke(name=nil, *args)
if name.nil?
warn "[Thor] Calling invoke() without argument is deprecated. Please use invoke_all instead.\n#{caller.join("\n")}"
return invoke_all
end

args.unshift(nil) if Array === args.first || NilClass === args.first
task, args, opts, config = args

Expand Down
2 changes: 1 addition & 1 deletion spec/invocation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@

it "raises Thor::UndefinedTaskError if the task can't be found even if all tasks where already executed" do
base = C.new
silence(:stdout){ base.invoke }
silence(:stdout){ base.invoke_all }

lambda do
base.invoke("foo:bar")
Expand Down

0 comments on commit db85b66

Please sign in to comment.