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
# File 'lib/appraisal/task.rb', line 8

def initialize
  namespace :appraisal do
    desc "Generate a Gemfile for each appraisal"
    task :gemfiles do
      File.each do |appraisal|
        appraisal.write_gemfile
      end
    end

    desc "Resolve and install dependencies for each appraisal"
    task :install => :gemfiles do
      File.each do |appraisal|
        appraisal.install
      end
    end

    File.each do |appraisal|
      desc "Run the given task for appraisal #{appraisal.name}"
      task appraisal.name do
        Command.from_args(appraisal.gemfile_path).exec
      end
    end

    task :all do
      File.each do |appraisal|
        Command.from_args(appraisal.gemfile_path).run
      end
      exit
    end
  end

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