| Class | Bundler::Thor::Group |
| In: |
lib/bundler/vendor/thor/lib/thor/group.rb
|
| Parent: | Object |
Bundler::Thor has a special class called Bundler::Thor::Group. The main difference to Bundler::Thor class is that it invokes all commands at once. It also include some methods that allows invocations to be done at the class method, which are not available to Bundler::Thor commands.
| printable_commands | -> | printable_tasks |
| self_command | -> | self_task |
| create_command | -> | create_task |
The description for this Bundler::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.
| description<String>: | The description for this Bundler::Thor::Group. |
Invoke the given namespace or class given. It adds an instance method that will invoke the klass and command. 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.
class GemGenerator < Bundler::Thor::Group
class_option :test_framework, :type => :string
invoke_from_option :test_framework
end
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.
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 command.
You can also supply a block to customize how the option is going to be invoked. The block receives two parameters, an instance of the current class and the klass to be invoked.