diff --git a/lib/thor/invocation.rb b/lib/thor/invocation.rb index 9aa1f87d8..6315dd429 100644 --- a/lib/thor/invocation.rb +++ b/lib/thor/invocation.rb @@ -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 diff --git a/spec/invocation_spec.rb b/spec/invocation_spec.rb index 1a9c70fc2..943710f60 100644 --- a/spec/invocation_spec.rb +++ b/spec/invocation_spec.rb @@ -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")