Class: Lemon::CLI::Coverage

Inherits:
Base
  • Object
show all
Defined in:
lib/lemon/cli/coverage.rb

Overview

Coverage Command

Instance Method Summary collapse

Methods inherited from Base

#initialize, #option_coverage, #option_dryrun, #option_format, #option_loadpath, #option_namespaces, #option_output, #option_parser, #option_private, #option_requires, #option_verbose, #option_zealous, #options, run, #run

Constructor Details

This class inherits a constructor from Lemon::CLI::Base

Instance Method Details

#command_parse(argv) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/lemon/cli/coverage.rb', line 33

def command_parse(argv)
  option_parser.banner = "Usage: lemonade coverage [options] [files ...]"
  #option_parser.separator("Check test coverage.")

  option_namespaces
  option_private
  option_zealous
  option_output
  option_format
  option_loadpath
  option_requires

  option_parser.parse!(argv)
end

#command_run(test_files) ⇒ Object

Ouput coverage report.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/lemon/cli/coverage.rb', line 11

def command_run(test_files)
  require 'lemon/coverage/analyzer'

  #loadpath = options[:loadpath] || []
  #requires = options[:requires] || []

  #loadpath.each{ |path| $LOAD_PATH.unshift(path) }
  #requires.each{ |path| require(path) }

  $stderr.print "Calculating... "
  $stderr.flush

  cover = Lemon::CoverageAnalyzer.new(test_files, options)

  cover.calculate  # this just helps calcs get done up front

  $stderr.puts

  cover.render
end