module Lemon

Public Class Methods

cli(*argv) click to toggle source

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.

# 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) click to toggle source

Access to project metadata as constants.

Calls superclass method
# File lib/lemon.rb, line 12
def self.const_missing(name)
  key = name.to_s.downcase
  metadata[key] || super(name)
end
ignore_callers() click to toggle source
# 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
metadata() click to toggle source

Access to metadata.

# File lib/lemon.rb, line 4
def self.metadata
  @metadata ||= (
    require 'yaml'
    YAML.load(File.new(File.dirname(__FILE__) + '/lemon.yml'))
  )
end
setup_ignore_callers() click to toggle source
# File lib/lemon/ignore_callers.rb, line 11
def self.setup_ignore_callers
  $RUBY_IGNORE_CALLERS ||= []
  $RUBY_IGNORE_CALLERS.concat(ignore_callers)
end