Class: Appraisal::Task

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/appraisal/task.rb

Overview

Defines tasks for installing appraisal dependencies and running other tasks for a given appraisal.

Instance Method Summary collapse

Constructor Details

#initializeTask

Returns a new instance of Task.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/appraisal/task.rb', line 8

def initialize
  namespace :appraisal do
    desc "DEPRECATED: Generate a Gemfile for each appraisal"
    task :gemfiles do
      warn "`rake appraisal:gemfile` task is deprecated and will be removed soon. " +
        "Please use `appraisal generate`."
      exec 'bundle exec appraisal generate'
    end

    desc "DEPRECATED: Resolve and install dependencies for each appraisal"
    task :install do
      warn "`rake appraisal:install` task is deprecated and will be removed soon. " +
        "Please use `appraisal install`."
      exec 'bundle exec appraisal install'
    end

    desc "DEPRECATED: Remove all generated gemfiles from gemfiles/ folder"
    task :cleanup do
      warn "`rake appraisal:cleanup` task is deprecated and will be removed soon. " +
        "Please use `appraisal clean`."
      exec 'bundle exec appraisal clean'
    end

    begin
      AppraisalFile.each do |appraisal|
        desc "DEPRECATED: Run the given task for appraisal #{appraisal.name}"
        task appraisal.name do
          ARGV.shift
          warn "`rake appraisal:#{appraisal.name}` task is deprecated and will be removed soon. " +
            "Please use `appraisal #{appraisal.name} rake #{ARGV.join(' ')}`."
          exec "bundle exec appraisal #{appraisal.name} rake #{ARGV.join(' ')}"
        end
      end
    rescue AppraisalsNotFound
    end

    task :all do
      ARGV.shift
      exec "bundle exec appraisal rake #{ARGV.join(' ')}"
    end
  end

  desc "Run the given task for all appraisals"
  task :appraisal => "appraisal:all"
end