lemon 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,29 +0,0 @@
1
- module Lemon
2
- module Command
3
- require 'optparse'
4
-
5
- # Lemon Command-line tool base class.
6
- class Abstract
7
-
8
- # Used to map command-line options to command classes.
9
- # This must be overridden in subclasses, and return an
10
- # array of of options, e.g. [ '-g', '--generate'].
11
- def self.options
12
- raise "not implemented"
13
- end
14
-
15
- # Stores a list of command classes.
16
- def self.commands
17
- @commands ||= []
18
- end
19
-
20
- # When this class is inherited, it is registered to the commands list.
21
- def self.inherited(command_class)
22
- commands << command_class
23
- end
24
-
25
- end
26
-
27
- end
28
- end
29
-
@@ -1,102 +0,0 @@
1
- module Lemon
2
- module Command
3
- require 'lemon/command/abstract'
4
-
5
- # Lemon Coverage Command-line tool.
6
- class Coverage < Abstract
7
- require 'yaml'
8
- require 'lemon/coverage'
9
-
10
- def self.subcommand
11
- 'coverage' #['-c', '--coverage']
12
- end
13
-
14
- # Initialize and run.
15
- def self.run
16
- new.run
17
- end
18
-
19
- # New Command instance.
20
- def initialize
21
- @requires = []
22
- @includes = []
23
- @namespaces = []
24
- @public_only = false
25
- end
26
-
27
- #
28
- attr_accessor :public_only
29
-
30
- #
31
- def public_only?
32
- @public_only
33
- end
34
-
35
- # Get or set librarires to pre-require.
36
- def requires(*paths)
37
- @requires.concat(paths) unless paths.empty?
38
- @requires
39
- end
40
-
41
- # Get or set paths to include in $LOAD_PATH.
42
- def includes(*paths)
43
- @includes.concat(paths) unless paths.empty?
44
- @includes
45
- end
46
-
47
- # Get or set paths to include in $LOAD_PATH.
48
- def namespaces(*names)
49
- @namespaces.concat(names) unless names.empty?
50
- @namespaces
51
- end
52
-
53
- # Instance of OptionParser.
54
- def parser
55
- @parser ||= OptionParser.new do |opt|
56
- opt.banner = "lemon coverage [OPTIONS]"
57
- opt.separator("Produce test coverage report.")
58
- opt.on('--namespace', '-n [NAME]', "limit coverage to this namespace") do |name|
59
- namespaces(name)
60
- end
61
- opt.on('--public', '-p', "only include public methods") do
62
- self.public_only = true
63
- end
64
- opt.on("-r [FILES]" , 'library files to require') do |files|
65
- files = files.split(/[:;]/)
66
- requires(*files)
67
- end
68
- opt.on("-I [PATH]" , 'include in $LOAD_PATH') do |path|
69
- path = path.split(/[:;]/)
70
- includes(*path)
71
- end
72
- opt.on("--debug" , 'turn on debugging mode') do
73
- $DEBUG = true
74
- end
75
- opt.on_tail('--help', '-h', 'show this help message') do
76
- puts opt
77
- exit
78
- end
79
- end
80
- end
81
-
82
- #
83
- def run
84
- parser.parse!
85
-
86
- test_files = ARGV.dup
87
- load_files = []
88
-
89
- includes.each{ |path| $LOAD_PATH.unshift(path) }
90
- requires.each{ |path| require(path) }
91
-
92
- suite = Lemon::Test::Suite.new(test_files, :cover=>true)
93
- coverage = Lemon::Coverage.new(suite, namespaces, :public => public_only?)
94
-
95
- puts coverage.checklist.to_yaml
96
- end
97
-
98
- end
99
-
100
- end
101
- end
102
-
@@ -1,124 +0,0 @@
1
- module Lemon
2
- module Command
3
- require 'lemon/command/abstract'
4
-
5
- # Lemon Generate Command-line tool.
6
- class Generate < Abstract
7
- require 'lemon/coverage'
8
-
9
- #
10
- def self.subcommand
11
- 'generate' #['-g', '--generate']
12
- end
13
-
14
- # Initialize and run.
15
- def self.run
16
- new.run
17
- end
18
-
19
- # New Command instance.
20
- def initialize
21
- @requires = []
22
- @includes = []
23
- @namespaces = []
24
- @public_only = false
25
- @uncovered = false
26
- end
27
-
28
- # TODO: Support output ? perhaps complex scaffolding
29
- #attr_accessor :output
30
-
31
- #
32
- attr_accessor :public_only
33
-
34
- #
35
- attr_accessor :uncovered
36
-
37
- #
38
- def public_only?
39
- @public_only
40
- end
41
-
42
- #
43
- def uncovered_only?
44
- @uncovered
45
- end
46
-
47
- # Get or set librarires to pre-require.
48
- def requires(*paths)
49
- @requires.concat(paths) unless paths.empty?
50
- @requires
51
- end
52
-
53
- # Get or set paths to include in $LOAD_PATH.
54
- def includes(*paths)
55
- @includes.concat(paths) unless paths.empty?
56
- @includes
57
- end
58
-
59
- #
60
- def namespaces(*names)
61
- @namespaces.concat(names) unless names.empty?
62
- @namespaces
63
- end
64
-
65
- # Instance of OptionParser.
66
- def parser
67
- @parser ||= OptionParser.new do |opt|
68
- opt.banner = "lemon generate [OPTIONS]"
69
- opt.separator("Generate unit test scaffolding.")
70
- opt.on("--namespace", "-n [NAME]", "limit tests to this namespace") do |name|
71
- namespaces(name)
72
- end
73
- opt.on("--public", "-p", "only include public methods") do
74
- self.public_only = true
75
- end
76
- opt.on("--uncovered", "-u", "only include uncovered methods") do
77
- self.uncovered = true
78
- end
79
- #opt.on("--output", "-o [PATH]", "output directory") do |path|
80
- # self.output = path
81
- #end
82
- opt.on("-r [FILES]" , "library files to require") do |files|
83
- files = files.split(/[:;]/)
84
- requires(*files)
85
- end
86
- opt.on("-I [PATH]" , "include in $LOAD_PATH") do |path|
87
- path = path.split(/[:;]/)
88
- includes(*path)
89
- end
90
- opt.on("--debug" , "turn on debugging mode") do
91
- $DEBUG = true
92
- end
93
- opt.on_tail("--help", "-h", "show this help message") do
94
- puts opt
95
- exit
96
- end
97
- end
98
- end
99
-
100
- # Generate test skeletons.
101
- def run
102
- parser.parse!
103
-
104
- test_files = ARGV.dup
105
-
106
- includes.each{ |path| $LOAD_PATH.unshift(path) }
107
- requires.each{ |path| require(path) }
108
-
109
- suite = Lemon::Test::Suite.new(test_files, :cover=>true)
110
- cover = Lemon::Coverage.new(suite, namespaces, :public=>public_only?)
111
- #cover = Lemon::Coverage.new([], namespaces, :public=>public_only?, :uncovered=>uncovered_only?)
112
-
113
- if uncovered_only?
114
- puts cover.generate_uncovered #(output)
115
- else
116
- puts cover.generate #(output)
117
- end
118
- end
119
-
120
- end
121
-
122
- end
123
- end
124
-
@@ -1,109 +0,0 @@
1
- module Lemon
2
- module Command
3
- require 'lemon/command/abstract'
4
-
5
- # Lemon Test Command-line tool.
6
- class Test < Abstract
7
- require 'lemon/runner'
8
-
9
- def self.subcommand
10
- 'test'
11
- end
12
-
13
- # Initialize and run.
14
- def self.run
15
- new.run
16
- end
17
-
18
- # New Command instance.
19
- def initialize
20
- @format = nil
21
- @cover = false
22
- @requires = []
23
- @includes = []
24
- @namespaces = []
25
- end
26
-
27
- #
28
- attr_accessor :format
29
-
30
- #
31
- attr_accessor :cover
32
-
33
- # Get or set librarires to pre-require.
34
- def requires(*paths)
35
- @requires.concat(paths) unless paths.empty?
36
- @requires
37
- end
38
-
39
- # Get or set paths to include in $LOAD_PATH.
40
- def includes(*paths)
41
- @includes.concat(paths) unless paths.empty?
42
- @includes
43
- end
44
-
45
- #
46
- def namespaces(*names)
47
- @namespaces.concat(names) unless names.empty?
48
- @namespaces
49
- end
50
-
51
- # Instance of OptionParser.
52
- def parser
53
- @parser ||= OptionParser.new do |opt|
54
- opt.banner = "lemon [options] [test-files ...]"
55
- opt.separator("Run unit tests.")
56
- opt.separator("OPTIONS:")
57
- opt.on('--coverage', '-c', "include coverage informarton") do
58
- self.cover = true
59
- end
60
- opt.on('--verbose', '-v', "select verbose report format") do |type|
61
- self.format = :verbose
62
- end
63
- opt.on('--outline', '-o', "select outline report format") do |type|
64
- self.format = :outline
65
- end
66
- opt.on('--format', '-f [TYPE]', "select report format") do |type|
67
- self.format = type
68
- end
69
- opt.on("--namespace", "-n [NAME]", "limit testing to this namespace") do |name|
70
- namespaces(name)
71
- end
72
- opt.on("-r [FILES]" , 'library files to require') do |files|
73
- files = files.split(/[:;]/)
74
- requires(*files)
75
- end
76
- opt.on("-I [PATH]" , 'include in $LOAD_PATH') do |path|
77
- paths = path.split(/[:;]/)
78
- includes(*paths)
79
- end
80
- opt.on("--debug" , 'turn on debugging mode') do
81
- $DEBUG = true
82
- end
83
- opt.on_tail('--help', '-h', 'show this help message') do
84
- puts opt
85
- exit
86
- end
87
- end
88
- end
89
-
90
- # Run unit tests.
91
- def run
92
- parser.parse!
93
-
94
- files = ARGV.dup
95
-
96
- includes.each{ |path| $LOAD_PATH.unshift(path) }
97
- requires.each{ |path| require(path) }
98
-
99
- suite = Lemon::Test::Suite.new(files, :cover=>cover)
100
- runner = Lemon::Runner.new(suite, :format=>format, :cover=>cover, :namespaces=>namespaces)
101
-
102
- runner.run
103
- end
104
-
105
- end
106
-
107
- end
108
- end
109
-
data/meta/authors DELETED
@@ -1 +0,0 @@
1
- Thomas Sawyer
data/meta/contact DELETED
@@ -1 +0,0 @@
1
- proutils@librelist.com
data/meta/copyright DELETED
@@ -1 +0,0 @@
1
- Copyright 2009 Thomas Sawyer
data/meta/description DELETED
@@ -1,2 +0,0 @@
1
- Lemon is a unit testing framework that tightly correlates
2
- class to test case and method to test unit.
data/meta/homepage DELETED
@@ -1 +0,0 @@
1
- http://proutils.github.com/lemon
data/meta/license DELETED
@@ -1 +0,0 @@
1
- LGPL
data/meta/name DELETED
@@ -1 +0,0 @@
1
- lemon
data/meta/repository DELETED
@@ -1 +0,0 @@
1
- git://github.com/proutils/lemon.git
data/meta/suite DELETED
@@ -1 +0,0 @@
1
- proutils
data/meta/summary DELETED
@@ -1 +0,0 @@
1
- Pucker-tight Unit Testing
data/meta/title DELETED
@@ -1 +0,0 @@
1
- Lemon
data/meta/version DELETED
@@ -1 +0,0 @@
1
- 0.7.0