Class: Lemon::CLI::Generate

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

Overview

Generate Command

Instance Method Summary collapse

Methods inherited from Base

#initialize, #option_all, #option_covered, #option_format, #option_loadpath, #option_namespaces, #option_output, #option_parser, #option_private, #option_requires, #option_uncovered, #option_verbose, #option_zealous, #options, #run

Constructor Details

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

Instance Method Details

#command_parse(argv) ⇒ Object



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

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

  option_namespaces
  option_covered
  option_uncovered
  option_all
  option_private
  option_loadpath
  option_requires

  option_parser.parse!(argv)
end

#command_run(test_files) ⇒ Object

Generate test templates.



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

def command_run(test_files)
  require 'lemon/generator'

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

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

  #cover = options[:uncovered]
  #suite = Lemon::TestSuite.new(test_files, :cover=>cover) #, :cover_all=>true)
  generator = Lemon::Generator.new(test_files, options)

  #if uncovered
  #  puts cover.generate_uncovered #(output)
  #else
    puts generator.generate #(output)
  #end
end