tdoc 0.11.1 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/bin/tdoc.rb +11 -7
  2. 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(file) #called at end of script
17
- files=Dir.glob(file)
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].each {|c| process(c)}
81
+ process opts[:tests] unless opts[:tests].empty?
82
82
  else
83
- opts[:tests].each {|c| process(c)}
83
+ process opts[:tests] unless opts[:tests].empty?
84
84
  context_proc
85
85
  end
86
86
  end
87
- process(ARGV.shift || DEFAULT_FILE)
87
+ if glob=ARGV.shift
88
+ process(Dir.glob(glob))
89
+ else
90
+ process(DEFAULT_FILE)
91
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Herb Daily