Class Thor::Group
In: lib/thor/group.rb
Parent: Object

Thor has a special class called Thor::Group. The main difference to Thor class is that it invokes all tasks at once. It also include some methods that allows invocations to be done at the class method, which are not available to Thor tasks.

Methods

Included Modules

Thor::Base

Public Class methods

The descrition for this Thor::Group. If none is provided, but a source root exists, tries to find the USAGE one folder above it, otherwise searches in the superclass.

Parameters

description<String>:The description for this Thor::Group.

Prints help information.

Options

short:When true, shows only usage.

Invoke the given namespace or class given. It adds an instance method that will invoke the klass and task. You can give a block to configure how it will be invoked.

The namespace/class given will have its options showed on the help usage. Check invoke_from_option for more information.

Invoke a thor class based on the value supplied by the user to the given option named "name". A class option must be created before this method is invoked for each name given.

Examples

  class GemGenerator < Thor::Group
    class_option :test_framework, :type => :string
    invoke_from_option :test_framework
  end

Boolean options

In some cases, you want to invoke a thor class if some option is true or false. This is automatically handled by invoke_from_option. Then the option name is used to invoke the generator.

Preparing for invocation

In some cases you want to customize how a specified hook is going to be invoked. You can do that by overwriting the class method prepare_for_invocation. The class method must necessarily return a klass and an optional task.

Custom invocations

You can also supply a block to customize how the option is giong to be invoked. The block receives two parameters, an instance of the current class and the klass to be invoked.

Remove a previously added invocation.

Examples

  remove_invocation :test_framework

Start works differently in Thor::Group, it simply invokes all tasks inside the class.

Protected Class methods

The banner for this class. You can customize it if you are invoking the thor class by another ways which is not the Thor::Runner.

[Validate]