Module: Thor::RakeCompat

### Home Classes Methods

### In Files

- lib/thor/rake_compat.rb

### Methods

- ::included
- ::rake_classes

### Included Modules

- Rake::DSL

### Class/Module Index

Quicksearch

- Thor
- Thor::Actions
- Thor::Actions::ClassMethods
- Thor::Base
- Thor::Base::ClassMethods
- Thor::Command
- Thor::DynamicCommand
- Thor::DynamicTask
- Thor::Error
- Thor::Group
- Thor::HiddenCommand
- Thor::HiddenTask
- Thor::InvocationError
- Thor::MalformattedArgumentError
- Thor::RakeCompat
- Thor::RequiredArgumentMissingError
- Thor::Shell
- Thor::Shell::Basic
- Thor::Shell::Color
- Thor::Shell::HTML
- Thor::Task
- Thor::UndefinedCommandError
- Thor::UndefinedTaskError
- Thor::UnknownArgumentError
- Thor::Util
- Object

No matching classes.

# Thor::RakeCompat

Adds a compatibility layer to your Thor classes which allows you to use rake package tasks. For example, to use rspec rake tasks, one can do:

    require 'thor/rake_compat'
    require 'rspec/core/rake_task'

    class Default < Thor
      include Thor::RakeCompat

      RSpec::Core::RakeTask.new(:spec) do |t|
        t.spec_opts = ['--options', "./.rspec"]
        t.spec_files = FileList['spec/**/*_spec.rb']
      end
    end

### Public Class Methods

included(base) click to toggle source

    # File lib/thor/rake_compat.rb, line 27
    def self.included(base)
      # Hack. Make rakefile point to invoker, so rdoc task is generated properly.
      rakefile = File.basename(caller[0].match(/(.*):\d+/)[1])
      Rake.application.instance_variable_set(:@rakefile, rakefile)
      self.rake_classes << base
    end

rake_classes() click to toggle source

    # File lib/thor/rake_compat.rb, line 23
    def self.rake_classes
      @rake_classes ||= []
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.