Class: Rant::Generators::Rcov
- Defined in:
- lib/gems/rcov-0.8.1.2.0/lib/rcov/rant.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#libs ⇒ Object
Returns the value of attribute libs.
-
#output_dir ⇒ Object
Directory where to put the generated XHTML reports.
-
#pattern ⇒ Object
Returns the value of attribute pattern.
-
#rcov_opts ⇒ Object
Returns the value of attribute rcov_opts.
-
#test_dirs ⇒ Object
Returns the value of attribute test_dirs.
-
#test_files ⇒ Object
Returns the value of attribute test_files.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Class Method Summary collapse
Instance Method Summary collapse
- #filelist ⇒ Object
-
#initialize(app, cinf, name = :rcov, prerequisites = []) {|_self| ... } ⇒ Rcov
constructor
A new instance of Rcov.
Constructor Details
#initialize(app, cinf, name = :rcov, prerequisites = []) {|_self| ... } ⇒ Rcov
Returns a new instance of Rcov.
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.(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 |
Instance Attribute Details
#libs ⇒ Object
Returns the value of attribute libs.
21 22 23 |
# File 'lib/gems/rcov-0.8.1.2.0/lib/rcov/rant.rb', line 21 def libs @libs end |
#output_dir ⇒ Object
Directory where to put the generated XHTML reports
27 28 29 |
# File 'lib/gems/rcov-0.8.1.2.0/lib/rcov/rant.rb', line 27 def output_dir @output_dir end |
#pattern ⇒ Object
Returns the value of attribute pattern.
23 24 25 |
# File 'lib/gems/rcov-0.8.1.2.0/lib/rcov/rant.rb', line 23 def pattern @pattern end |
#rcov_opts ⇒ Object
Returns the value of attribute rcov_opts.
25 26 27 |
# File 'lib/gems/rcov-0.8.1.2.0/lib/rcov/rant.rb', line 25 def rcov_opts @rcov_opts end |
#test_dirs ⇒ Object
Returns the value of attribute test_dirs.
22 23 24 |
# File 'lib/gems/rcov-0.8.1.2.0/lib/rcov/rant.rb', line 22 def test_dirs @test_dirs end |
#test_files ⇒ Object
Returns the value of attribute test_files.
24 25 26 |
# File 'lib/gems/rcov-0.8.1.2.0/lib/rcov/rant.rb', line 24 def test_files @test_files end |
#verbose ⇒ Object
Returns the value of attribute verbose.
20 21 22 |
# File 'lib/gems/rcov-0.8.1.2.0/lib/rcov/rant.rb', line 20 def verbose @verbose end |
Class Method Details
.rant_gen(app, ch, args, &block) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/gems/rcov-0.8.1.2.0/lib/rcov/rant.rb', line 7 def self.rant_gen(app, ch, args, &block) if !args || args.empty? self.new(app, ch, &block) elsif args.size == 1 name, pre = app.normalize_task_arg(args.first, ch) self.new(app, ch, name, pre, &block) else app.abort_at(ch, "Rcov takes only one additional argument, " + "which should be like one given to the `task' command.") end end |
Instance Method Details
#filelist ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/gems/rcov-0.8.1.2.0/lib/rcov/rant.rb', line 71 def filelist return @rac.sys[@rac.var['TEST']] if @rac.var['TEST'] filelist = @test_files || [] if filelist.empty? if @test_dirs && !@test_dirs.empty? @test_dirs.each { |dir| filelist.concat(@rac.sys[File.join(dir, @pattern)]) } else filelist.concat(@rac.sys[@pattern]) if @pattern end end filelist end |