Class: RightSupport::CI::RakeTask

Inherits:
Rake::TaskLib
  • Object
show all
Includes:
Rake::DSL
Defined in:
lib/right_support/ci/rake_task.rb

Overview

A Rake task definition that creates a CI namespace with appropriate tests.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) {|_self| ... } ⇒ RakeTask

Returns a new instance of RakeTask.

Yields:

  • (_self)

Yield Parameters:



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/right_support/ci/rake_task.rb', line 44

def initialize(*args)
  @ci_namespace = args.shift || :ci

  yield self if block_given?

  @output_path ||= 'measurement'

  namespace @ci_namespace do
    task :prep do
      FileUtils.mkdir_p(@output_path)
      FileUtils.mkdir_p(File.join(@output_path, 'rspec'))
      FileUtils.mkdir_p(File.join(@output_path, 'cucumber'))
    end

    if require_succeeds?('rspec/core/rake_task')
      # RSpec 2
      desc "Run RSpec examples"
      RSpec::Core::RakeTask.new(:spec => :prep) do |t|
        t.rspec_opts = ['-r', 'right_support/ci',
                        '-f', JavaSpecFormatter.name,
                        '-o', File.join(@output_path, 'rspec', 'rspec.xml')]
      end
    elsif require_succeeds?('spec/rake/spectask')
      # RSpec 1
      Spec::Rake::SpecTask.new(:spec => :prep) do |t|
        desc "Run RSpec Examples"
        t.spec_opts = ['-r', 'right_support/ci',
                       '-f', JavaSpecFormatter.name + ":" + File.join(@output_path, 'rspec', 'rspec.xml')]
      end
    end

    if require_succeeds?('cucumber/rake/task')
      desc "Run Cucumber features"
      Cucumber::Rake::Task.new do |t|
        t.cucumber_opts = ['--no-color',
                           '--format', JavaCucumberFormatter.name,
                           '--out', File.join(@output_path, 'cucumber')]
      end
      task :cucumber => [:prep]
    end
  end
end

Instance Attribute Details

#ci_namespaceObject

The namespace in which to define the continuous integration tasks.

Default :ci



37
38
39
# File 'lib/right_support/ci/rake_task.rb', line 37

def ci_namespace
  @ci_namespace
end

#output_pathObject

The base directory for output files.

Default ‘measurement’



42
43
44
# File 'lib/right_support/ci/rake_task.rb', line 42

def output_path
  @output_path
end