Sha256: 7707a1d31176a4019906aa730993af2bcc58a030654ce375f57db11350e9ea04

Contents?: true

Size: 1.63 KB

Versions: 240

Compression:

Stored size: 1.63 KB

Contents

class A < Thor
  include Thor::Actions

  desc "one", "invoke one"
  def one
    p 1
    invoke :two
    invoke :three
  end

  desc "two", "invoke two"
  def two
    p 2
    invoke :three
  end

  desc "three", "invoke three"
  def three
    p 3
  end

  desc "four", "invoke four"
  def four
    p 4
    invoke "defined:five"
  end

  desc "five N", "check if number is equal 5"
  def five(number)
    number == 5
  end

  desc "invoker", "invoke a b task"
  def invoker(*args)
    invoke :b, :one, ["Jose"]
  end
end

class B < Thor
  class_option :last_name, :type => :string

  desc "one FIRST_NAME", "invoke one"
  def one(first_name)
    "#{options.last_name}, #{first_name}"
  end

  desc "two", "invoke two"
  def two
    options
  end

  desc "three", "invoke three"
  def three
    self
  end
end

class C < Thor::Group
  include Thor::Actions

  def one
    p 1
  end

  def two
    p 2
  end

  def three
    p 3
  end
end

class Defined < Thor::Group
  class_option :unused, :type => :boolean, :desc => "This option has no use"

  def one
    p 1
    invoke "a:two"
    invoke "a:three"
    invoke "a:four"
    invoke "defined:five"
  end

  def five
    p 5
  end

  def print_status
    say_status :finished, :counting
  end
end

class E < Thor::Group
  invoke Defined
end

class F < Thor::Group
  invoke "b:one" do |instance, klass, task|
    instance.invoke klass, task, [ "Jose" ], :last_name => "Valim"
  end
end

class G < Thor::Group
  class_option :invoked, :type => :string, :default => "defined"
  invoke_from_option :invoked
end

class H < Thor::Group
  class_option :defined, :type => :boolean, :default => true
  invoke_from_option :defined
end

Version data entries

240 entries across 167 versions & 29 rubygems

Version Path
arcabouco-0.2.13 vendor/bundle/gems/thor-0.14.6/spec/fixtures/invoke.thor
classiccms-0.7.5 vendor/bundle/gems/thor-0.15.2/spec/fixtures/invoke.thor
classiccms-0.7.5 vendor/bundle/gems/thor-0.14.6/spec/fixtures/invoke.thor
classiccms-0.7.4 vendor/bundle/gems/thor-0.14.6/spec/fixtures/invoke.thor
classiccms-0.7.4 vendor/bundle/gems/thor-0.15.2/spec/fixtures/invoke.thor
classiccms-0.7.3 vendor/bundle/gems/thor-0.15.2/spec/fixtures/invoke.thor
classiccms-0.7.3 vendor/bundle/gems/thor-0.14.6/spec/fixtures/invoke.thor
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/thor-0.17.0/spec/fixtures/invoke.thor
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/thor-0.17.0/spec/fixtures/invoke.thor
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/thor-0.14.6/spec/fixtures/invoke.thor
mango-0.7.0 vendor/bundler/ruby/2.0.0/gems/thor-0.14.6/spec/fixtures/invoke.thor
wijet-thor-0.14.10 spec/fixtures/invoke.thor
torquebox-console-0.3.0 vendor/bundle/jruby/1.9/gems/thor-0.17.0/spec/fixtures/invoke.thor
classiccms-0.7.2 vendor/bundle/gems/thor-0.15.2/spec/fixtures/invoke.thor
classiccms-0.7.2 vendor/bundle/gems/thor-0.14.6/spec/fixtures/invoke.thor
classiccms-0.7.1 vendor/bundle/gems/thor-0.15.2/spec/fixtures/invoke.thor
classiccms-0.7.1 vendor/bundle/gems/thor-0.14.6/spec/fixtures/invoke.thor
active_mailer-0.0.9 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/thor-0.17.0/spec/fixtures/invoke.thor
active_mailer-0.0.8 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/thor-0.17.0/spec/fixtures/invoke.thor
active_mailer-0.0.7 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/thor-0.17.0/spec/fixtures/invoke.thor