tdoc 0.11.1 → 0.12.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/bin/tdoc.rb +11 -7
- metadata +1 -1
data/bin/tdoc.rb
CHANGED
@@ -9,15 +9,15 @@ $: << 'lib'
|
|
9
9
|
LINST='^[#|\s]*'
|
10
10
|
LINSTM='[#|\s]*'
|
11
11
|
EXTENSIONS={:tests => '.rdoc',:requires => '.rb'}
|
12
|
-
DEFAULT_FILE="README#{EXTENSIONS[:tests]}"
|
12
|
+
DEFAULT_FILE=["README#{EXTENSIONS[:tests]}"]
|
13
13
|
|
14
14
|
START_IRB="IRB.setup nil; IRB.conf[:MAIN_CONTEXT] = IRB::Irb.new.context; require 'irb/ext/multi-irb'; IRB.irb nil, self"
|
15
15
|
|
16
|
-
def process(
|
17
|
-
files
|
18
|
-
if files.count > 1
|
16
|
+
def process(files) #called at end of script
|
17
|
+
if files.class==Array && files.count > 1
|
19
18
|
files.each {|f| system("#{$PROGRAM_NAME} #{f} #{ARGV}")}
|
20
19
|
else
|
20
|
+
file=files[0]
|
21
21
|
test_name=File.basename(file).sub(/\..*?$/,'')
|
22
22
|
test_case=Class.new(Test::Unit::TestCase)
|
23
23
|
Object.const_set(:"Test#{test_name.capitalize}", test_case)
|
@@ -78,10 +78,14 @@ def mk_test_context(file, test_case=nil)
|
|
78
78
|
}
|
79
79
|
if test_case
|
80
80
|
test_case.module_eval {mk_test_context(file).call}
|
81
|
-
opts[:tests]
|
81
|
+
process opts[:tests] unless opts[:tests].empty?
|
82
82
|
else
|
83
|
-
opts[:tests]
|
83
|
+
process opts[:tests] unless opts[:tests].empty?
|
84
84
|
context_proc
|
85
85
|
end
|
86
86
|
end
|
87
|
-
|
87
|
+
if glob=ARGV.shift
|
88
|
+
process(Dir.glob(glob))
|
89
|
+
else
|
90
|
+
process(DEFAULT_FILE)
|
91
|
+
end
|