lemon 0.8.5 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/{lemon.gemspec → .gemspec} +0 -0
- data/.ruby +4 -11
- data/Assembly +5 -11
- data/HISTORY.rdoc +31 -0
- data/MANIFEST +45 -55
- data/PROFILE +6 -6
- data/README.md +113 -0
- data/Rakefile +12 -3
- data/VERSION +1 -1
- data/bin/lemonade +8 -0
- data/lib/lemon.rb +52 -2
- data/lib/lemon.yml +4 -11
- data/lib/lemon/{model/ae.rb → ae.rb} +0 -0
- data/lib/lemon/cli.rb +28 -279
- data/lib/lemon/cli/base.rb +139 -0
- data/lib/lemon/cli/coverage.rb +52 -0
- data/lib/lemon/cli/generate.rb +51 -0
- data/lib/lemon/cli/test.rb +50 -0
- data/lib/lemon/core_ext.rb +7 -0
- data/lib/lemon/core_ext/kernel.rb +20 -0
- data/lib/lemon/core_ext/omission.rb +18 -0
- data/lib/lemon/{controller/coverage_analyzer.rb → coverage/analyzer.rb} +41 -19
- data/lib/lemon/{model → coverage}/cover_unit.rb +0 -0
- data/lib/lemon/{view/cover_reports → coverage/formats}/abstract.rb +0 -0
- data/lib/lemon/{view/cover_reports → coverage/formats}/compact.rb +1 -1
- data/lib/lemon/{view/cover_reports → coverage/formats}/outline.rb +1 -1
- data/lib/lemon/{view/cover_reports → coverage/formats}/verbose.rb +1 -1
- data/lib/lemon/{view/cover_reports → coverage/formats}/yaml.rb +1 -1
- data/lib/lemon/{model → coverage}/snapshot.rb +0 -0
- data/lib/lemon/{model → coverage}/source_parser.rb +0 -0
- data/lib/lemon/{controller/scaffold_generator.rb → generator.rb} +53 -14
- data/lib/lemon/test_advice.rb +63 -0
- data/lib/lemon/test_case.rb +270 -0
- data/lib/lemon/test_class.rb +28 -0
- data/lib/lemon/test_method.rb +207 -0
- data/lib/lemon/test_module.rb +114 -0
- data/lib/lemon/test_proc.rb +140 -0
- data/lib/lemon/test_setup.rb +54 -0
- data/lib/lemon/test_world.rb +9 -0
- data/notes/{2010-05-06-files_not_classes.rdoc → 2010-05-06-files-not-classes.rdoc} +0 -0
- data/notes/{2010-07-11-acid_testing.rdoc → 2010-07-11-acid-testing.rdoc} +0 -0
- data/notes/2011-07-07-nailing-down-the-nomenclature.md +6 -0
- data/site/index.html +7 -6
- data/{qed → spec}/applique/fs.rb +0 -0
- data/{qed → spec}/coverage/01_complete.rdoc +26 -16
- data/{qed → spec}/coverage/02_incomplete.rdoc +10 -7
- data/{qed → spec}/coverage/03_extensions.rdoc +10 -6
- data/spec/coverage/applique/lemon.rb +1 -0
- data/try/.test +8 -0
- data/try/case_error.rb +18 -0
- data/try/case_fail.rb +19 -0
- data/try/case_pass.rb +42 -0
- data/try/case_pending.rb +18 -0
- data/try/case_singleton.rb +18 -0
- data/try/case_untested.rb +14 -0
- data/try/fixtures/calculator.rb +15 -0
- data/{demo/fixture → try/fixtures}/example-use.rb +0 -0
- data/{demo/fixture → try/fixtures}/example.rb +0 -0
- data/try/helpers/loadpath.rb +1 -0
- data/{.config → work/deprecated}/cucumber.yml +0 -0
- data/{features → work/deprecated/features}/coverage.feature +0 -0
- data/{features → work/deprecated/features}/generate.feature +0 -0
- data/{features → work/deprecated/features}/step_definitions/coverage_steps.rb +0 -0
- data/{features → work/deprecated/features}/support/ae.rb +0 -0
- data/{features → work/deprecated/features}/support/aruba.rb +0 -0
- data/{features → work/deprecated/features}/test.feature +0 -0
- data/work/deprecated/model/dsl/advice.rb +78 -0
- data/work/deprecated/model/dsl/subject.rb +40 -0
- data/{lib/lemon → work/deprecated}/model/main.rb +40 -29
- data/work/deprecated/model/test.rb +54 -0
- data/work/deprecated/model/test_base_dsl.rb +88 -0
- data/work/deprecated/model/test_clause.rb +112 -0
- data/{lib/lemon → work/deprecated}/model/test_context.rb +24 -24
- data/work/deprecated/model/test_feature.rb +128 -0
- data/work/deprecated/model/test_scenario.rb +137 -0
- data/{lib/lemon → work/deprecated}/model/test_suite.rb +113 -32
- data/work/deprecated/rake.rb +103 -0
- data/{test → work/deprecated/test}/case_coverage_analyzer.rb +0 -0
- data/{test → work/deprecated/test}/case_test_case_dsl.rb +2 -2
- data/{test → work/deprecated/test}/fixtures/case_complete.rb +0 -0
- data/{test → work/deprecated/test}/fixtures/case_inclusion.rb +0 -0
- data/{test → work/deprecated/test}/fixtures/case_incomplete.rb +0 -0
- data/{test → work/deprecated/test}/fixtures/example.rb +0 -0
- data/{test → work/deprecated/test}/fixtures/helper.rb +0 -0
- data/{test → work/deprecated/test}/runner +0 -0
- data/work/old-tests/case_example.rb +15 -0
- data/work/old-tests/feature_example.rb +40 -0
- data/work/reference/dsl2.rb +4 -0
- metadata +101 -98
- data/README.rdoc +0 -103
- data/bin/lemon +0 -4
- data/demo/case_example_error.rb +0 -10
- data/demo/case_example_fail.rb +0 -15
- data/demo/case_example_pass.rb +0 -32
- data/demo/case_example_pending.rb +0 -14
- data/demo/case_example_untested.rb +0 -10
- data/lib/lemon/controller/test_runner.rb +0 -299
- data/lib/lemon/model/pending.rb +0 -10
- data/lib/lemon/model/test_case.rb +0 -305
- data/lib/lemon/model/test_unit.rb +0 -147
- data/lib/lemon/view/test_reports/abstract.rb +0 -256
- data/lib/lemon/view/test_reports/dotprogress.rb +0 -73
- data/lib/lemon/view/test_reports/html.rb +0 -146
- data/lib/lemon/view/test_reports/outline.rb +0 -118
- data/lib/lemon/view/test_reports/summary.rb +0 -131
- data/lib/lemon/view/test_reports/tap.rb +0 -49
- data/lib/lemon/view/test_reports/tapj.rb +0 -130
- data/lib/lemon/view/test_reports/tapy.rb +0 -141
- data/lib/lemon/view/test_reports/verbose.rb +0 -197
- data/work/sandbox/lib/sample.rb +0 -13
- data/work/sandbox/test/sample_case.rb +0 -12
- data/work/trash/example-cover.rb +0 -5
- data/work/trash/example.rb +0 -16
data/lib/lemon.yml
CHANGED
|
@@ -9,6 +9,7 @@ copyrights:
|
|
|
9
9
|
replacements: []
|
|
10
10
|
conflicts: []
|
|
11
11
|
requirements:
|
|
12
|
+
- name: test
|
|
12
13
|
- name: ae
|
|
13
14
|
- name: ansi
|
|
14
15
|
version: 1.3+
|
|
@@ -24,14 +25,6 @@ requirements:
|
|
|
24
25
|
groups:
|
|
25
26
|
- test
|
|
26
27
|
development: true
|
|
27
|
-
- name: cucumber
|
|
28
|
-
groups:
|
|
29
|
-
- test
|
|
30
|
-
development: true
|
|
31
|
-
- name: aruba
|
|
32
|
-
groups:
|
|
33
|
-
- test
|
|
34
|
-
development: true
|
|
35
28
|
dependencies: []
|
|
36
29
|
repositories:
|
|
37
30
|
- uri: git://github.com/proutils/lemon.git
|
|
@@ -47,10 +40,10 @@ extra:
|
|
|
47
40
|
alternatives: []
|
|
48
41
|
revision: 0
|
|
49
42
|
title: Lemon
|
|
50
|
-
suite: proutils
|
|
51
43
|
summary: Pucker-tight Unit Testing
|
|
52
44
|
description: Lemon is a unit testing framework that tightly correlates class to test
|
|
53
45
|
case and method to test unit.
|
|
54
|
-
|
|
46
|
+
organization: RubyWorks
|
|
47
|
+
version: 0.9.0
|
|
55
48
|
name: lemon
|
|
56
|
-
date: '2011-
|
|
49
|
+
date: '2011-08-11'
|
|
File without changes
|
data/lib/lemon/cli.rb
CHANGED
|
@@ -1,285 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
# TODO: What about a config file?
|
|
6
|
-
|
|
7
|
-
# CLI Interface handle all lemon sub-commands.
|
|
8
|
-
class CLI
|
|
9
|
-
|
|
10
|
-
COMMANDS = {
|
|
11
|
-
'-t' => 'test' , '--test' => 'test',
|
|
12
|
-
'-c' => 'coverage', '--cov' => 'coverage', '--coverage' => 'coverage',
|
|
13
|
-
'-g' => 'generate', '--gen' => 'generate', '--generate' => 'generate'
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
#
|
|
17
|
-
def self.run(argv=ARGV)
|
|
18
|
-
new.run(argv)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
#
|
|
22
|
-
def initialize(argv=ARGV)
|
|
23
|
-
@options = {}
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
#
|
|
27
|
-
def options
|
|
28
|
-
@options
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
#
|
|
32
|
-
def run(argv)
|
|
33
|
-
cmdopt = COMMANDS.keys.find{ |k| argv.delete(k) }
|
|
34
|
-
command = COMMANDS[cmdopt]
|
|
35
|
-
|
|
36
|
-
if command.nil? && argv.include?('--help')
|
|
37
|
-
option_commands
|
|
38
|
-
option_parser.parse!(argv)
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
command ||= 'test'
|
|
42
|
-
|
|
43
|
-
#option_commands
|
|
44
|
-
|
|
45
|
-
#cmd = argv.shift
|
|
46
|
-
#cmd = COMMANDS.find{ |c| /^#{cmd}/ =~ c }
|
|
47
|
-
#option_parser.order!(argv)
|
|
48
|
-
|
|
49
|
-
begin
|
|
50
|
-
__send__("#{command}_parse", argv)
|
|
51
|
-
__send__("#{command}", argv)
|
|
52
|
-
rescue => err
|
|
53
|
-
raise err if $DEBUG
|
|
54
|
-
$stderr.puts('ERROR: ' + err.to_s)
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
# T E S T
|
|
59
|
-
|
|
60
|
-
# Run unit tests.
|
|
61
|
-
def test(scripts)
|
|
62
|
-
require 'lemon/controller/test_runner'
|
|
63
|
-
|
|
64
|
-
loadpath = options[:loadpath] || ['lib'] # + ['lib'] ?
|
|
65
|
-
requires = options[:requires] || []
|
|
66
|
-
|
|
67
|
-
loadpath.each{ |path| $LOAD_PATH.unshift(path) }
|
|
68
|
-
requires.each{ |path| require(path) }
|
|
69
|
-
|
|
70
|
-
#suite = Lemon::Test::Suite.new(files, :cover=>cover)
|
|
71
|
-
#runner = Lemon::Runner.new(suite, :format=>format, :cover=>cover, :namespaces=>namespaces)
|
|
72
|
-
|
|
73
|
-
runner = Lemon::TestRunner.new(
|
|
74
|
-
scripts, :format=>options[:format], :namespaces=>options[:namespaces]
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
success = runner.run
|
|
78
|
-
|
|
79
|
-
exit -1 unless success
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
#
|
|
83
|
-
def test_parse(argv)
|
|
84
|
-
option_parser.banner = "Usage: lemon [-t] [options] [files ...]"
|
|
85
|
-
#option_parser.separator("Run unit tests.")
|
|
86
|
-
|
|
87
|
-
option_format
|
|
88
|
-
option_verbose
|
|
89
|
-
option_namespaces
|
|
90
|
-
option_loadpath
|
|
91
|
-
option_requires
|
|
92
|
-
|
|
93
|
-
option_parser.parse!(argv)
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
# C O V E R A G E
|
|
97
|
-
|
|
98
|
-
# Ouput coverage report.
|
|
99
|
-
def coverage(test_files)
|
|
100
|
-
require 'lemon/controller/coverage_analyzer'
|
|
101
|
-
|
|
102
|
-
#loadpath = options[:loadpath] || []
|
|
103
|
-
#requires = options[:requires] || []
|
|
104
|
-
|
|
105
|
-
#loadpath.each{ |path| $LOAD_PATH.unshift(path) }
|
|
106
|
-
#requires.each{ |path| require(path) }
|
|
107
|
-
|
|
108
|
-
$stderr.print "Calculating... "
|
|
109
|
-
$stderr.flush
|
|
110
|
-
|
|
111
|
-
cover = Lemon::CoverageAnalyzer.new(test_files, options)
|
|
112
|
-
|
|
113
|
-
cover.calculate # this just helps calcs get done up front
|
|
114
|
-
|
|
115
|
-
$stderr.puts
|
|
116
|
-
|
|
117
|
-
cover.render
|
|
118
|
-
end
|
|
1
|
+
#require 'lemon/cli/test'
|
|
2
|
+
require 'lemon/cli/generate'
|
|
3
|
+
require 'lemon/cli/coverage'
|
|
119
4
|
|
|
120
|
-
|
|
121
|
-
def coverage_parse(argv)
|
|
122
|
-
option_parser.banner = "Usage: lemon -c [options] [files ...]"
|
|
123
|
-
#option_parser.separator("Check test coverage.")
|
|
124
|
-
|
|
125
|
-
option_namespaces
|
|
126
|
-
option_private
|
|
127
|
-
option_zealous
|
|
128
|
-
option_output
|
|
129
|
-
option_format
|
|
130
|
-
option_loadpath
|
|
131
|
-
option_requires
|
|
132
|
-
|
|
133
|
-
option_parser.parse!(argv)
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
# G E N E R A T E
|
|
137
|
-
|
|
138
|
-
# Generate test templates.
|
|
139
|
-
def generate(test_files)
|
|
140
|
-
require 'lemon/controller/scaffold_generator'
|
|
141
|
-
|
|
142
|
-
loadpath = options[:loadpath] || []
|
|
143
|
-
requires = options[:requires] || []
|
|
144
|
-
|
|
145
|
-
loadpath.each{ |path| $LOAD_PATH.unshift(path) }
|
|
146
|
-
requires.each{ |path| require(path) }
|
|
147
|
-
|
|
148
|
-
#cover = options[:uncovered]
|
|
149
|
-
#suite = Lemon::TestSuite.new(test_files, :cover=>cover) #, :cover_all=>true)
|
|
150
|
-
generator = Lemon::ScaffoldGenerator.new(test_files, options)
|
|
151
|
-
|
|
152
|
-
#if uncovered
|
|
153
|
-
# puts cover.generate_uncovered #(output)
|
|
154
|
-
#else
|
|
155
|
-
puts generator.generate #(output)
|
|
156
|
-
#end
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
#
|
|
160
|
-
def generate_parse(argv)
|
|
161
|
-
option_parser.banner = "Usage: lemon -g [options] [files ...]"
|
|
162
|
-
#option_parser.separator("Generate test scaffolding.")
|
|
163
|
-
|
|
164
|
-
option_namespaces
|
|
165
|
-
option_uncovered
|
|
166
|
-
option_all
|
|
167
|
-
option_private
|
|
168
|
-
option_loadpath
|
|
169
|
-
option_requires
|
|
170
|
-
|
|
171
|
-
option_parser.parse!(argv)
|
|
172
|
-
end
|
|
173
|
-
|
|
174
|
-
# P A R S E R O P T I O N S
|
|
175
|
-
|
|
176
|
-
def option_commands
|
|
177
|
-
option_parser.banner = "Usage: lemon [command] [options] [files ...]"
|
|
178
|
-
option_parser.on('-t', '--test', 'run unit tests [default]') do
|
|
179
|
-
@command = :test
|
|
180
|
-
end
|
|
181
|
-
option_parser.on('-c', '--cov', '--coverage', 'provide test coverage analysis') do
|
|
182
|
-
@command = :coverage
|
|
183
|
-
end
|
|
184
|
-
option_parser.on('-g', '--gen', '--generate', 'generate unit test scaffolding') do
|
|
185
|
-
@command = :generate
|
|
186
|
-
end
|
|
187
|
-
end
|
|
188
|
-
|
|
189
|
-
def option_namespaces
|
|
190
|
-
option_parser.on('-n', '--namespace NAME', 'add a namespace to output') do |name|
|
|
191
|
-
options[:namespaces] ||= []
|
|
192
|
-
options[:namespaces] << name
|
|
193
|
-
end
|
|
194
|
-
end
|
|
195
|
-
|
|
196
|
-
#def option_framework
|
|
197
|
-
# option_parser.on('-f', '--framework NAME', 'framework syntax to output') do |name|
|
|
198
|
-
# options[:framework] = name.to_sym
|
|
199
|
-
# end
|
|
200
|
-
#end
|
|
201
|
-
|
|
202
|
-
def option_format
|
|
203
|
-
option_parser.on('-f', '--format NAME', 'output format') do |name|
|
|
204
|
-
options[:format] = name
|
|
205
|
-
end
|
|
206
|
-
end
|
|
207
|
-
|
|
208
|
-
def option_verbose
|
|
209
|
-
option_parser.on('-v', '--verbose', 'shortcut for `-f verbose`') do |name|
|
|
210
|
-
options[:format] = 'verbose'
|
|
211
|
-
end
|
|
212
|
-
end
|
|
213
|
-
|
|
214
|
-
def option_uncovered
|
|
215
|
-
option_parser.on('-u', '--uncovered', 'include only uncovered units') do
|
|
216
|
-
options[:uncovered] = true
|
|
217
|
-
end
|
|
218
|
-
end
|
|
219
|
-
|
|
220
|
-
def option_all
|
|
221
|
-
option_parser.on('-a', '--all', 'include all namespaces and units') do
|
|
222
|
-
options[:all] = true
|
|
223
|
-
end
|
|
224
|
-
end
|
|
225
|
-
|
|
226
|
-
def option_private
|
|
227
|
-
option_parser.on('-p', '--private', 'include private and protected methods') do
|
|
228
|
-
options[:private] = true
|
|
229
|
-
end
|
|
230
|
-
end
|
|
231
|
-
|
|
232
|
-
def option_zealous
|
|
233
|
-
option_parser.on('-z', '--zealous', 'include undefined case methods') do
|
|
234
|
-
options[:zealous] = true
|
|
235
|
-
end
|
|
236
|
-
end
|
|
237
|
-
|
|
238
|
-
def option_output
|
|
239
|
-
option_parser.on('-o', '--output DIRECTORY', 'log directory') do |dir|
|
|
240
|
-
options[:output] = dir
|
|
241
|
-
end
|
|
242
|
-
end
|
|
243
|
-
|
|
244
|
-
def option_loadpath
|
|
245
|
-
option_parser.on("-I PATH" , 'add directory to $LOAD_PATH') do |path|
|
|
246
|
-
paths = path.split(/[:;]/)
|
|
247
|
-
options[:loadpath] ||= []
|
|
248
|
-
options[:loadpath].concat(paths)
|
|
249
|
-
end
|
|
250
|
-
end
|
|
251
|
-
|
|
252
|
-
def option_requires
|
|
253
|
-
option_parser.on("-r FILE" , 'require file(s) (before doing anything else)') do |files|
|
|
254
|
-
files = files.split(/[:;]/)
|
|
255
|
-
options[:requires] ||= []
|
|
256
|
-
options[:requires].concat(files)
|
|
257
|
-
end
|
|
258
|
-
end
|
|
5
|
+
module Lemon
|
|
259
6
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
)
|
|
7
|
+
#--
|
|
8
|
+
# TODO: Use Lemon::CLI::Runner and have it delegate to Ruby Test ?
|
|
9
|
+
#++
|
|
10
|
+
|
|
11
|
+
# Command line interface takes the first argument off `argv` to determine
|
|
12
|
+
# the subcommand: `test`, `cov` or `gen`. If `test`, then Lemon delegates
|
|
13
|
+
# control to Ruby Test.
|
|
14
|
+
#
|
|
15
|
+
def self.cli(*argv)
|
|
16
|
+
cmd = argv.shift
|
|
17
|
+
case cmd
|
|
18
|
+
when 'test'
|
|
19
|
+
require 'lemon'
|
|
20
|
+
require 'test/cli'
|
|
21
|
+
Test::Runner.cli(*ARGV)
|
|
22
|
+
#Lemon::CLI::Test.new.run(argv)
|
|
23
|
+
when /^gen/, /^scaf/
|
|
24
|
+
Lemon::CLI::Generate.new.run(argv)
|
|
25
|
+
when /^cov/
|
|
26
|
+
Lemon::CLI::Coverage.new.run(argv)
|
|
27
|
+
else
|
|
28
|
+
# run tests instead?
|
|
29
|
+
puts "invalid lemon command -- #{cmd}"
|
|
30
|
+
exit -1
|
|
280
31
|
end
|
|
281
|
-
|
|
282
32
|
end
|
|
283
33
|
|
|
284
34
|
end
|
|
285
|
-
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
module Lemon
|
|
2
|
+
|
|
3
|
+
require 'optparse'
|
|
4
|
+
|
|
5
|
+
# TODO: What about a config file?
|
|
6
|
+
|
|
7
|
+
# CLI Interfaces handle all lemon sub-commands.
|
|
8
|
+
module CLI
|
|
9
|
+
|
|
10
|
+
# Base class for all commands.
|
|
11
|
+
class Base
|
|
12
|
+
|
|
13
|
+
#
|
|
14
|
+
def initialize(argv=ARGV)
|
|
15
|
+
@options = {}
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
#
|
|
19
|
+
def options
|
|
20
|
+
@options
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
#
|
|
24
|
+
def run(argv)
|
|
25
|
+
begin
|
|
26
|
+
command_parse(argv)
|
|
27
|
+
command_run(argv)
|
|
28
|
+
rescue => err
|
|
29
|
+
raise err if $DEBUG
|
|
30
|
+
$stderr.puts('ERROR: ' + err.to_s)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
#
|
|
35
|
+
def option_parser
|
|
36
|
+
@option_parser ||= (
|
|
37
|
+
OptionParser.new do |opt|
|
|
38
|
+
opt.on_tail("--[no-]ansi" , 'turn on/off ANIS colors') do |v|
|
|
39
|
+
$ansi = v
|
|
40
|
+
end
|
|
41
|
+
opt.on_tail("--debug" , 'turn on debugging mode') do
|
|
42
|
+
$DEBUG = true
|
|
43
|
+
end
|
|
44
|
+
opt.on_tail("--about" , 'display information about lemon') do
|
|
45
|
+
puts "Lemon v#{Lemon::VERSION}"
|
|
46
|
+
puts "#{Lemon::COPYRIGHT}"
|
|
47
|
+
exit
|
|
48
|
+
end
|
|
49
|
+
opt.on_tail('-h', '--help', 'display help (also try `<command> --help`)') do
|
|
50
|
+
puts opt
|
|
51
|
+
exit
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
#
|
|
58
|
+
def option_namespaces
|
|
59
|
+
option_parser.on('-n', '--namespace NAME', 'add a namespace to output') do |name|
|
|
60
|
+
options[:namespaces] ||= []
|
|
61
|
+
options[:namespaces] << name
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
#def option_framework
|
|
66
|
+
# option_parser.on('-f', '--framework NAME', 'framework syntax to output') do |name|
|
|
67
|
+
# options[:framework] = name.to_sym
|
|
68
|
+
# end
|
|
69
|
+
#end
|
|
70
|
+
|
|
71
|
+
def option_format
|
|
72
|
+
option_parser.on('-f', '--format NAME', 'output format') do |name|
|
|
73
|
+
options[:format] = name
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def option_verbose
|
|
78
|
+
option_parser.on('-v', '--verbose', 'shortcut for `-f verbose`') do |name|
|
|
79
|
+
options[:format] = 'verbose'
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def option_covered
|
|
84
|
+
option_parser.on('-c', '--covered', 'include covered units') do
|
|
85
|
+
options[:covered] = true
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def option_uncovered
|
|
90
|
+
option_parser.on('-u', '--uncovered', 'include only uncovered units') do
|
|
91
|
+
options[:uncovered] = true
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def option_all
|
|
96
|
+
option_parser.on('-a', '--all', 'include all namespaces and units') do
|
|
97
|
+
options[:all] = true
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def option_private
|
|
102
|
+
option_parser.on('-p', '--private', 'include private and protected methods') do
|
|
103
|
+
options[:private] = true
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def option_zealous
|
|
108
|
+
option_parser.on('-z', '--zealous', 'include undefined case methods') do
|
|
109
|
+
options[:zealous] = true
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def option_output
|
|
114
|
+
option_parser.on('-o', '--output DIRECTORY', 'log directory') do |dir|
|
|
115
|
+
options[:output] = dir
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def option_loadpath
|
|
120
|
+
option_parser.on("-I PATH" , 'add directory to $LOAD_PATH') do |path|
|
|
121
|
+
paths = path.split(/[:;]/)
|
|
122
|
+
options[:loadpath] ||= []
|
|
123
|
+
options[:loadpath].concat(paths)
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def option_requires
|
|
128
|
+
option_parser.on("-r FILE" , 'require file(s) (before doing anything else)') do |files|
|
|
129
|
+
files = files.split(/[:;]/)
|
|
130
|
+
options[:requires] ||= []
|
|
131
|
+
options[:requires].concat(files)
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
end
|