Module: Lemon

Defined in:
lib/lemon.rb,
lib/lemon.rb,
lib/lemon/cli.rb,
lib/lemon/cli/base.rb,
lib/lemon/cli/test.rb,
lib/lemon/test_case.rb,
lib/lemon/test_proc.rb,
lib/lemon/test_class.rb,
lib/lemon/test_scope.rb,
lib/lemon/test_setup.rb,
lib/lemon/test_world.rb,
lib/lemon/test_advice.rb,
lib/lemon/test_method.rb,
lib/lemon/test_module.rb,
lib/lemon/cli/coverage.rb,
lib/lemon/cli/generate.rb,
lib/lemon/cli/obrother.rb,
lib/lemon/cli/scaffold.rb,
lib/lemon/ignore_callers.rb,
lib/lemon/coverage/analyzer.rb,
lib/lemon/coverage/snapshot.rb,
lib/lemon/test_class_method.rb,
lib/lemon/coverage/generator.rb,
lib/lemon/coverage/cover_unit.rb,
lib/lemon/coverage/source_parser.rb

Defined Under Namespace

Modules: CLI, CoverReports, DSL Classes: CoverUnit, CoverageAnalyzer, Generator, Snapshot, SourceParser, TestAdvice, TestCase, TestClass, TestClassMethod, TestMethod, TestModule, TestProc, TestScope, TestSetup, World

Class Method Summary collapse

Class Method Details

.cli(*argv) ⇒ Object

Command line interface takes the first argument off ‘argv` to determine the subcommand: `test`, `cov` or `gen`. If `test`, then Lemon delegates control to Ruby Test.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/lemon/cli.rb', line 22

def self.cli(*argv)
  cmd = argv.shift
  case cmd
  when 't', 'test', 'run'
    require 'lemon'
    require 'rubytest'
    Test::Runner.cli(*ARGV)
    #Lemon::CLI::Test.new.run(argv)
  when 'g', 'gen', 'generate', 'generator'
    Lemon::CLI::Generate.run(argv)
  when 's', 'sca', 'scaffold'
    Lemon::CLI::Scaffold.run(argv)
  when 'c', 'cov', 'cover', 'coverage'
    Lemon::CLI::Coverage.run(argv)
  when 'are'
    Lemon::CLI::OBrother.run(argv)
  else
    # run tests instead?
    puts "invalid lemon command -- #{cmd}"
    exit -1
  end
end

.const_missing(name) ⇒ Object

Access to project metadata as constants.



12
13
14
15
# File 'lib/lemon.rb', line 12

def self.const_missing(name)
  key = name.to_s.downcase
  [key] || super(name)
end

.ignore_callersObject



4
5
6
7
8
# File 'lib/lemon/ignore_callers.rb', line 4

def self.ignore_callers
  ignore_path    = File.expand_path(File.join(__FILE__, '../../..'))
  ignore_regexp  = Regexp.new(Regexp.escape(ignore_path))
  [ ignore_regexp, /bin\/lemon/ ]
end

.metadataObject

Access to metadata.



4
5
6
7
8
9
# File 'lib/lemon.rb', line 4

def self.
  @metadata ||= (
    require 'yaml'
    YAML.load(File.new(File.dirname(__FILE__) + '/lemon.yml'))
  )
end

.setup_ignore_callersObject



11
12
13
14
# File 'lib/lemon/ignore_callers.rb', line 11

def self.setup_ignore_callers
  $RUBY_IGNORE_CALLERS ||= []
  $RUBY_IGNORE_CALLERS.concat(ignore_callers)
end