Method: Rant::Generators::Rcov#initialize

Defined in:
lib/gems/rcov-0.8.1.2.0/lib/rcov/rant.rb

#initialize(app, cinf, name = :rcov, prerequisites = []) {|_self| ... } ⇒ Rcov

Returns a new instance of Rcov.

Yields:

  • (_self)

Yield Parameters:



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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
# File 'lib/gems/rcov-0.8.1.2.0/lib/rcov/rant.rb', line 29

def initialize(app, cinf, name = :rcov, prerequisites = [], &block)
  @rac = app
  @name = name
  @pre = prerequisites
  #@block = block
  @verbose = nil
  cf = cinf[:file]
  @libs = []
  libdir = File.join(File.dirname(File.expand_path(cf)), 'lib')
  @libs << libdir if test(?d, libdir)
  @rcov_opts = ["--text-report"]
  @test_dirs = []
  @pattern = nil
  @test_files = nil
  yield self if block_given?
  @pattern = "test*.rb" if @pattern.nil? && @test_files.nil?
  @output_dir ||= "coverage"

  @pre ||= []
  # define the task
  app.task(:__caller__ => cinf, @name => @pre) { |t|
    args = []
    if @libs && !@libs.empty?
      args << "-I#{@libs.join File::PATH_SEPARATOR}"
    end
    if rcov_path = ENV['RCOVPATH'] 
      args << rcov_path
    else
      args << "-S" << "rcov"
    end
    args.concat rcov_opts
    args << "-o" << @output_dir
    if test(?d, "test")
      @test_dirs << "test" 
    elsif test(?d, "tests")
      @test_dirs << "tests"
    end
    args.concat filelist
    app.context.sys.ruby args
  }
end