rubydoctest 1.0.0 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/Manifest.txt +0 -1
- data/bin/rubydoctest +61 -11
- data/lib/lines.rb +2 -2
- data/lib/rubydoctest.rb +1 -1
- data/lib/rubydoctest/version.rb +2 -2
- data/lib/runner.rb +55 -10
- data/lib/special_directive.rb +11 -1
- data/lib/statement.rb +7 -1
- data/rubydoctest.gemspec +46 -6
- data/script/console +0 -0
- data/script/destroy +0 -0
- data/script/generate +0 -0
- data/script/rstakeout +0 -0
- data/script/txt2html +0 -0
- data/tasks/doctests.rake +4 -3
- data/textmate/DocTest (Ruby).textmate +10 -0
- data/website/index.html +12 -59
- data/website/index.txt +8 -54
- metadata +38 -9
- data/Ruby DocTest.tmproj +0 -197
data/.gemtest
ADDED
File without changes
|
data/Manifest.txt
CHANGED
data/bin/rubydoctest
CHANGED
@@ -1,51 +1,101 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
require 'rbconfig'
|
4
|
+
RUBY = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']).sub(/.*\s.*/m, '"\&"')
|
5
|
+
|
6
|
+
options, files = ARGV.partition{ |a| a =~ /^-/ }
|
7
|
+
|
8
|
+
if ARGV.empty? or options.include?("-h") or options.include?("--help")
|
9
|
+
require 'rubydoctest/version'
|
4
10
|
puts <<-DIRECTIONS
|
5
|
-
|
11
|
+
Ruby DocTest #{Rubydoctest::VERSION::STRING}
|
12
|
+
USAGE: rubydoctest [options] <files>
|
6
13
|
|
7
14
|
rubydoctest parses Ruby files (.rb) or DocTest files (.doctest) for irb-style
|
8
15
|
sessions in comments, and runs the commented sessions as tests.
|
9
16
|
|
10
17
|
Options:
|
18
|
+
General:
|
19
|
+
--help - show this usage / help information
|
20
|
+
--single - run all tests in the same ruby environment
|
21
|
+
-t<n> - only run test number n, e.g. -t1 -t3
|
22
|
+
|
11
23
|
Output Format:
|
12
24
|
--html - output in HTML format
|
13
|
-
--plain - force output in plain text (no Ansi colors)
|
25
|
+
--plain - force output in plain text (no Ansi colors) [windows default]
|
14
26
|
|
15
27
|
Debug:
|
16
28
|
--ignore-interactive - do not heed !!! special directives
|
17
29
|
--trace - turn backtrace on to debug Ruby DocTest
|
18
30
|
--debugger - include ruby-debug library / gem
|
31
|
+
--verbose - print more (useful only with --plain)
|
32
|
+
--require=</path/to/require>,</another/path/to/require> - eg. --require=config/environment.rb
|
19
33
|
|
20
34
|
See http://github.com/tablatom/rubydoctest/wikis for more information.
|
21
35
|
DIRECTIONS
|
22
36
|
exit 0
|
23
37
|
end
|
24
38
|
|
25
|
-
|
39
|
+
single = options.include?("--single")
|
26
40
|
|
27
41
|
requires = ['rubygems', File.dirname(__FILE__) + "/../lib/rubydoctest"]
|
28
42
|
requires << 'ruby-debug' if options.include?("--debugger")
|
43
|
+
|
44
|
+
if options.detect {|opt| opt =~ /^--require=(.+)/}
|
45
|
+
requires << $1.split(",")
|
46
|
+
end
|
47
|
+
|
29
48
|
ruby_lines = []
|
30
49
|
ruby_lines << "RubyDocTest.trace = true;" if options.include?("--trace")
|
50
|
+
ruby_lines << "RubyDocTest.verbose = true;" if options.include?("--verbose") or options.include?("-v")
|
31
51
|
ruby_lines << "RubyDocTest.ignore_interactive = true;" if options.include?("--ignore-interactive")
|
32
52
|
|
53
|
+
tests = options.map{ |o| o =~ /^-t(\d+)/; $1 }.compact
|
54
|
+
ruby_lines << "RubyDocTest.tests = #{tests.inspect};" if tests.size > 0
|
55
|
+
|
33
56
|
requires = requires.map {|lib| "require '#{lib}'; "}.join
|
34
57
|
|
35
|
-
def files_runner(command, files, requires, lines)
|
36
|
-
|
37
|
-
|
58
|
+
def files_runner(command, files, requires, lines, single)
|
59
|
+
preamble = <<END_CMD
|
60
|
+
#{requires} #{lines.join(" ")}
|
61
|
+
|
62
|
+
module Kernel
|
63
|
+
# IRB redefines exit
|
64
|
+
alias_method :our_exit, :exit
|
65
|
+
end
|
66
|
+
|
67
|
+
END_CMD
|
68
|
+
if single
|
69
|
+
cmd = preamble + "our_exit("
|
70
|
+
cmd << files.reverse.map do |f|
|
71
|
+
%(RubyDocTest::Runner.new(File.read('#{f}'), '#{f}').run )
|
72
|
+
end.join("&& ")
|
73
|
+
cmd << "? 0 : 1)"
|
74
|
+
if ! system(%(#{command} -e "#{cmd}"))
|
75
|
+
exit(1)
|
76
|
+
end
|
77
|
+
else
|
78
|
+
files.reverse.detect do |f|
|
79
|
+
cmd = preamble + <<END_CMD2
|
80
|
+
our_exit(RubyDocTest::Runner.new(File.read('#{f}'), '#{f}').run ? 0 : 1)
|
81
|
+
END_CMD2
|
82
|
+
|
83
|
+
if ! system(%(#{command} -e "#{cmd}"))
|
84
|
+
exit(1)
|
85
|
+
end
|
86
|
+
end
|
38
87
|
end
|
39
88
|
end
|
40
89
|
|
41
|
-
if options.include?("--plain")
|
90
|
+
if options.include?("--plain") or RUBY_PLATFORM =~ /mswin|mingw/
|
42
91
|
ruby_lines << "RubyDocTest.output_format = :plain;"
|
43
|
-
files_runner(
|
92
|
+
files_runner(RUBY, files, requires, ruby_lines, single)
|
44
93
|
elsif options.include?("--html")
|
45
94
|
ruby_lines << "RubyDocTest.output_format = :html;"
|
46
95
|
puts "<html><body><pre>"
|
47
|
-
files_runner(
|
96
|
+
files_runner(RUBY, files, requires, ruby_lines, single)
|
48
97
|
puts "</pre></body></html>"
|
49
98
|
else
|
50
|
-
files_runner(
|
99
|
+
files_runner(RUBY, files, requires, ruby_lines, single)
|
51
100
|
end
|
101
|
+
exit(0)
|
data/lib/lines.rb
CHANGED
@@ -109,7 +109,7 @@ module RubyDocTest
|
|
109
109
|
# => " # "
|
110
110
|
def indentation(doc_lines = @doc_lines, line_index = @line_index)
|
111
111
|
if doc_lines[line_index]
|
112
|
-
doc_lines[line_index][/^(\s*#\s*|\s*)(\?>\s)?/]
|
112
|
+
doc_lines[line_index][/^(\s*#\s*|\s*)(\?>\s?)?/]
|
113
113
|
else
|
114
114
|
""
|
115
115
|
end
|
@@ -140,4 +140,4 @@ module RubyDocTest
|
|
140
140
|
doc_lines[start_index..-1]
|
141
141
|
end
|
142
142
|
end
|
143
|
-
end
|
143
|
+
end
|
data/lib/rubydoctest.rb
CHANGED
data/lib/rubydoctest/version.rb
CHANGED
data/lib/runner.rb
CHANGED
@@ -106,16 +106,25 @@ module RubyDocTest
|
|
106
106
|
@@color[RubyDocTest.output_format][color] % text.to_s
|
107
107
|
end
|
108
108
|
|
109
|
+
def escape(text)
|
110
|
+
case RubyDocTest.output_format
|
111
|
+
when :html
|
112
|
+
text.gsub("<", "<").gsub(">", ">")
|
113
|
+
else
|
114
|
+
text
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
109
118
|
def run
|
110
119
|
prepare_tests
|
111
|
-
newline = "\n
|
120
|
+
newline = "\n "
|
112
121
|
everything_passed = true
|
113
122
|
puts "=== Testing '#{@file_name}'..."
|
114
123
|
ok, fail, err = 0, 0, 0
|
115
|
-
@tests.
|
124
|
+
@tests.each_with_index do |t, index|
|
116
125
|
if SpecialDirective === t and t.name == "!!!"
|
117
126
|
start_irb unless RubyDocTest.ignore_interactive
|
118
|
-
|
127
|
+
elsif RubyDocTest.tests.nil? or RubyDocTest.tests.include?(index + 1)
|
119
128
|
begin
|
120
129
|
if t.pass?
|
121
130
|
ok += 1
|
@@ -125,26 +134,35 @@ module RubyDocTest
|
|
125
134
|
fail += 1
|
126
135
|
everything_passed = false
|
127
136
|
status = ["FAIL".center(4), :red]
|
137
|
+
|
138
|
+
result_raw = t.first_failed.actual_result
|
139
|
+
got = if result_raw =~ /\n$/ && result_raw.count("\n") > 1
|
140
|
+
"Got: <<-__END__\n#{result_raw}__END__\n "
|
141
|
+
else
|
142
|
+
"Got: #{t.actual_result}#{newline}"
|
143
|
+
end
|
128
144
|
detail = format_color(
|
129
|
-
"
|
145
|
+
"#{got}Expected: #{t.expected_result}" + newline +
|
130
146
|
" from #{@file_name}:#{t.first_failed.result.line_number}",
|
131
147
|
:red)
|
132
148
|
|
133
149
|
end
|
134
150
|
rescue EvaluationError => e
|
135
151
|
err += 1
|
152
|
+
everything_passed = false
|
136
153
|
status = ["ERR".center(4), :yellow]
|
137
154
|
exception_text = e.original_exception.to_s.split("\n").join(newline)
|
138
|
-
if RubyDocTest.output_format == :html
|
139
|
-
exception_text = exception_text.gsub("<", "<").gsub(">", ">")
|
140
|
-
end
|
141
155
|
detail = format_color(
|
142
|
-
"#{e.original_exception.class.to_s}: #{exception_text}" + newline +
|
156
|
+
"#{escape e.original_exception.class.to_s}: #{escape exception_text}" + newline +
|
143
157
|
" from #{@file_name}:#{e.statement.line_number}" + newline +
|
144
158
|
e.statement.source_code,
|
145
159
|
:yellow)
|
160
|
+
if RubyDocTest.verbose
|
161
|
+
detail += format_color(newline + e.original_exception.backtrace.join("\n"), :red)
|
162
|
+
end
|
146
163
|
end
|
147
164
|
puts \
|
165
|
+
"#{((index + 1).to_s + ".").ljust(3)} " +
|
148
166
|
"#{format_color(*status)} | " +
|
149
167
|
"#{t.description.split("\n").join(newline)}" +
|
150
168
|
(detail ? newline + detail : "")
|
@@ -292,18 +310,27 @@ module RubyDocTest
|
|
292
310
|
current_statements = []
|
293
311
|
when SpecialDirective
|
294
312
|
case g.name
|
295
|
-
when "doctest:"
|
313
|
+
when "doctest:", "it:"
|
296
314
|
blocks << CodeBlock.new(current_statements) unless current_statements.empty?
|
297
315
|
current_statements = []
|
316
|
+
blocks << g
|
298
317
|
when "doctest_require:"
|
299
318
|
doctest_require = eval(g.value, TOPLEVEL_BINDING, @file_name, g.line_number)
|
300
319
|
if doctest_require.is_a? String
|
301
320
|
require_relative_to_file_name(doctest_require, @file_name)
|
302
321
|
end
|
322
|
+
blocks << g
|
303
323
|
when "!!!"
|
304
324
|
# ignore
|
325
|
+
unless RubyDocTest.ignore_interactive
|
326
|
+
fake_statement = Object.new
|
327
|
+
runner = self
|
328
|
+
(class << fake_statement; self; end).send(:define_method, :evaluate) do
|
329
|
+
runner.start_irb
|
330
|
+
end
|
331
|
+
current_statements << fake_statement
|
332
|
+
end
|
305
333
|
end
|
306
|
-
blocks << g
|
307
334
|
end
|
308
335
|
end
|
309
336
|
blocks << CodeBlock.new(current_statements) unless current_statements.empty?
|
@@ -313,6 +340,9 @@ module RubyDocTest
|
|
313
340
|
def require_relative_to_file_name(file_name, relative_to)
|
314
341
|
load_path = $:.dup
|
315
342
|
$:.unshift File.expand_path(File.join(File.dirname(relative_to), File.dirname(file_name)))
|
343
|
+
if RubyDocTest.verbose
|
344
|
+
puts "doctest_require: [#{File.expand_path(File.join(File.dirname(relative_to), File.dirname(file_name)))}] #{File.basename(file_name)}"
|
345
|
+
end
|
316
346
|
require File.basename(file_name)
|
317
347
|
ensure
|
318
348
|
$:.shift
|
@@ -345,6 +375,18 @@ module RubyDocTest
|
|
345
375
|
#
|
346
376
|
# >> r.tests.first.code_blocks.size
|
347
377
|
# => 2
|
378
|
+
#
|
379
|
+
# doctest: When using the "it:" directive, it should re-append "it" to the description;
|
380
|
+
# >> r = RubyDocTest::Runner.new("it: should behave\n>> t = 1\n>> t + 2\n=> 3\n>> u = 1", "test.doctest")
|
381
|
+
# >> r.prepare_tests
|
382
|
+
# >> r.tests.size
|
383
|
+
# => 1
|
384
|
+
#
|
385
|
+
# >> r.tests.first.description
|
386
|
+
# => "it should behave"
|
387
|
+
#
|
388
|
+
# >> r.tests.first.code_blocks.size
|
389
|
+
# => 2
|
348
390
|
def organize_tests(blocks = @blocks)
|
349
391
|
tests = []
|
350
392
|
assigned_blocks = nil
|
@@ -358,6 +400,9 @@ module RubyDocTest
|
|
358
400
|
when "doctest:"
|
359
401
|
assigned_blocks = []
|
360
402
|
tests << Test.new(g.value, assigned_blocks)
|
403
|
+
when "it:"
|
404
|
+
assigned_blocks = []
|
405
|
+
tests << Test.new("it #{g.value}", assigned_blocks)
|
361
406
|
when "!!!"
|
362
407
|
tests << g
|
363
408
|
end
|
data/lib/special_directive.rb
CHANGED
@@ -5,7 +5,7 @@ require 'lines'
|
|
5
5
|
|
6
6
|
module RubyDocTest
|
7
7
|
class SpecialDirective < Lines
|
8
|
-
NAMES = ["doctest:", "!!!", "doctest_require:"]
|
8
|
+
NAMES = ["doctest:", "it:", "!!!", "doctest_require:"]
|
9
9
|
NAMES_FOR_RX = NAMES.map{ |n| Regexp.escape(n) }.join("|")
|
10
10
|
|
11
11
|
# === Test
|
@@ -14,6 +14,11 @@ module RubyDocTest
|
|
14
14
|
# >> s = RubyDocTest::SpecialDirective.new(["doctest: Testing Stuff", "Other Stuff"])
|
15
15
|
# >> s.name
|
16
16
|
# => "doctest:"
|
17
|
+
#
|
18
|
+
# doctest: "it:" is a valid directive
|
19
|
+
# >> s = RubyDocTest::SpecialDirective.new(["it: should test stuff"])
|
20
|
+
# >> s.name
|
21
|
+
# => "it:"
|
17
22
|
def name
|
18
23
|
if m = lines.first.match(/^#{Regexp.escape(indentation)}(#{NAMES_FOR_RX})/)
|
19
24
|
m[1]
|
@@ -35,6 +40,11 @@ module RubyDocTest
|
|
35
40
|
# >> s = RubyDocTest::SpecialDirective.new(["doctest: Testing Stuff", " On Two Lines"])
|
36
41
|
# >> s.value
|
37
42
|
# => "Testing Stuff\nOn Two Lines"
|
43
|
+
#
|
44
|
+
# doctest: "it" should also work as a directive
|
45
|
+
# >> s = RubyDocTest::SpecialDirective.new(["it: should do something"])
|
46
|
+
# >> s.value
|
47
|
+
# => "should do something"
|
38
48
|
def value
|
39
49
|
if m = lines.join("\n").match(/^#{Regexp.escape(indentation)}(#{NAMES_FOR_RX})(.*)/m)
|
40
50
|
m[2].strip
|
data/lib/statement.rb
CHANGED
@@ -62,8 +62,14 @@ module RubyDocTest
|
|
62
62
|
# => :ok
|
63
63
|
def evaluate
|
64
64
|
sc = source_code.gsub("__FILE__", @file_name.inspect)
|
65
|
-
|
65
|
+
if RubyDocTest.verbose
|
66
|
+
puts "EVAL: #{sc}"
|
67
|
+
end
|
66
68
|
@actual_result = eval(sc, TOPLEVEL_BINDING, __FILE__, __LINE__)
|
69
|
+
if RubyDocTest.verbose
|
70
|
+
puts "RESULT: #{@actual_result}"
|
71
|
+
end
|
72
|
+
@actual_result
|
67
73
|
rescue Exception => e
|
68
74
|
if RubyDocTest.trace
|
69
75
|
raise e.class, e.to_s + "\n" + e.backtrace.first
|
data/rubydoctest.gemspec
CHANGED
@@ -1,18 +1,58 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
|
-
s.name =
|
3
|
-
s.version = "1.
|
2
|
+
s.name = "rubydoctest"
|
3
|
+
s.version = "1.1.3"
|
4
4
|
|
5
5
|
s.specification_version = 2 if s.respond_to? :specification_version=
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Duane Johnson", "Tom Locke", "Dr Nic Williams"]
|
9
|
-
s.date =
|
10
|
-
s.default_executable =
|
11
|
-
s.description =
|
9
|
+
s.date = "2008-12-06"
|
10
|
+
s.default_executable = "rubydoctest"
|
11
|
+
s.description = "Ruby version of Python's doctest tool, but a bit different."
|
12
12
|
s.email = ["duane.johnson@gmail.com"]
|
13
13
|
s.executables = ["rubydoctest"]
|
14
14
|
s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "PostInstall.txt", "README.txt", "website/index.txt"]
|
15
|
-
|
15
|
+
manifest = <<-MANIFEST
|
16
|
+
History.txt
|
17
|
+
License.txt
|
18
|
+
Manifest.txt
|
19
|
+
PostInstall.txt
|
20
|
+
README.txt
|
21
|
+
Rakefile
|
22
|
+
bin/rubydoctest
|
23
|
+
config/hoe.rb
|
24
|
+
config/requirements.rb
|
25
|
+
lib/code_block.rb
|
26
|
+
lib/doctest_require.rb
|
27
|
+
lib/lines.rb
|
28
|
+
lib/result.rb
|
29
|
+
lib/rubydoctest.rb
|
30
|
+
lib/rubydoctest/version.rb
|
31
|
+
lib/runner.rb
|
32
|
+
lib/special_directive.rb
|
33
|
+
lib/statement.rb
|
34
|
+
lib/test.rb
|
35
|
+
rubydoctest.gemspec
|
36
|
+
script/console
|
37
|
+
script/destroy
|
38
|
+
script/generate
|
39
|
+
script/rstakeout
|
40
|
+
script/txt2html
|
41
|
+
setup.rb
|
42
|
+
tasks/deployment.rake
|
43
|
+
tasks/doctests.rake
|
44
|
+
tasks/environment.rake
|
45
|
+
tasks/website.rake
|
46
|
+
textmate/DocTest (Markdown).textmate
|
47
|
+
textmate/DocTest (Ruby).textmate
|
48
|
+
textmate/DocTest (Text).textmate
|
49
|
+
website/index.html
|
50
|
+
website/index.txt
|
51
|
+
website/javascripts/rounded_corners_lite.inc.js
|
52
|
+
website/stylesheets/screen.css
|
53
|
+
website/template.html.erb
|
54
|
+
MANIFEST
|
55
|
+
s.files = manifest.strip.split("\n").map{|m| m.strip}
|
16
56
|
s.has_rdoc = true
|
17
57
|
s.homepage = %q{http://rubydoctest.rubyforge.org}
|
18
58
|
s.post_install_message = %q{
|
data/script/console
CHANGED
File without changes
|
data/script/destroy
CHANGED
File without changes
|
data/script/generate
CHANGED
File without changes
|
data/script/rstakeout
CHANGED
File without changes
|
data/script/txt2html
CHANGED
File without changes
|
data/tasks/doctests.rake
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
namespace :test do
|
2
2
|
desc "Run doctests"
|
3
3
|
task :doctest do
|
4
|
-
|
5
|
-
|
4
|
+
system("ruby #{File.dirname(__FILE__)}/../bin/rubydoctest #{File.dirname(__FILE__)}/../lib/*.rb") &&
|
5
|
+
system("ruby #{File.dirname(__FILE__)}/../bin/rubydoctest #{File.dirname(__FILE__)}/../doc/*.doctest")
|
6
|
+
exit($?.exitstatus)
|
6
7
|
end
|
7
8
|
|
8
9
|
namespace :doctest do
|
@@ -26,4 +27,4 @@ namespace :test do
|
|
26
27
|
sh "ruby #{File.dirname(__FILE__)}/../bin/rubydoctest #{tests}"
|
27
28
|
end
|
28
29
|
end
|
29
|
-
end
|
30
|
+
end
|
@@ -31,6 +31,16 @@
|
|
31
31
|
3 = { name = 'keyword.ruby.doctest'; };
|
32
32
|
};
|
33
33
|
patterns = (
|
34
|
+
{
|
35
|
+
begin = '^([ \t]*(#)\s+)';
|
36
|
+
end = '\n';
|
37
|
+
captures = {
|
38
|
+
2 = { name = 'comment.line.number-sign.ruby'; };
|
39
|
+
};
|
40
|
+
patterns = (
|
41
|
+
{ include = 'source.ruby.rails'; }
|
42
|
+
);
|
43
|
+
},
|
34
44
|
{ include = 'source.ruby.rails'; }
|
35
45
|
);
|
36
46
|
},
|
data/website/index.html
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
<link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
|
6
6
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
7
7
|
<title>
|
8
|
-
|
8
|
+
Ruby DocTest
|
9
9
|
</title>
|
10
10
|
<script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
|
11
11
|
<style>
|
@@ -30,7 +30,7 @@
|
|
30
30
|
<body>
|
31
31
|
<div id="main">
|
32
32
|
|
33
|
-
<h1>
|
33
|
+
<h1>Ruby DocTest</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/rubydoctest"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
36
|
<a href="http://rubyforge.org/projects/rubydoctest" class="numbers">1.0.0</a>
|
@@ -41,82 +41,35 @@
|
|
41
41
|
<h2>What</h2>
|
42
42
|
|
43
43
|
|
44
|
-
<
|
45
|
-
|
46
|
-
|
47
|
-
<p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">rubydoctest</span></pre></p>
|
44
|
+
<p>Ruby DocTest is a tool that lets you put irb-style tests in your documentation. It’s similar to Python’s doctest, but different in several ways.</p>
|
48
45
|
|
49
46
|
|
50
|
-
<h2>
|
51
|
-
|
52
|
-
|
53
|
-
<h2>Demonstration of usage</h2>
|
47
|
+
<h2>Installing</h2>
|
54
48
|
|
55
49
|
|
56
|
-
<
|
50
|
+
<p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">rubydoctest</span></pre></p>
|
57
51
|
|
58
52
|
|
59
|
-
<
|
53
|
+
<h2>Wiki, Documentation, Examples</h2>
|
60
54
|
|
61
55
|
|
62
|
-
<p
|
56
|
+
<p>See the <a href="http://github.com/tablatom/rubydoctest/wikis">github wiki</a></p>
|
63
57
|
|
64
58
|
|
65
59
|
<h2>How to submit patches</h2>
|
66
60
|
|
67
61
|
|
68
|
-
<p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people’s code</a
|
69
|
-
|
70
|
-
|
71
|
-
<p><span class="caps">TODO</span> – pick <span class="caps">SVN</span> or Git instructions</p>
|
72
|
-
|
73
|
-
|
74
|
-
<p>The trunk repository is <code>svn://rubyforge.org/var/svn/rubydoctest/trunk</code> for anonymous access.</p>
|
75
|
-
|
76
|
-
|
77
|
-
<p><span class="caps">OOOORRRR</span></p>
|
78
|
-
|
79
|
-
|
80
|
-
<p>You can fetch the source from either:</p>
|
81
|
-
|
82
|
-
|
83
|
-
<ul>
|
84
|
-
<li>rubyforge: <span class="caps">MISSING IN ACTION</span></li>
|
85
|
-
</ul>
|
86
|
-
|
87
|
-
|
88
|
-
<p><span class="caps">TODO</span> – You can not created a RubyForge project, OR have not run <code>rubyforge config</code>
|
89
|
-
yet to refresh your local rubyforge data with this projects’ id information.</p>
|
90
|
-
|
91
|
-
|
92
|
-
<p>When you do this, this message will magically disappear!</p>
|
93
|
-
|
94
|
-
|
95
|
-
<p>Or you can hack website/index.txt and make it all go away!!</p>
|
96
|
-
|
97
|
-
|
98
|
-
<ul>
|
99
|
-
<li>github: <a href="http://github.com/GITHUB_USERNAME/rubydoctest/tree/master">http://github.com/GITHUB_USERNAME/rubydoctest/tree/master</a></li>
|
100
|
-
</ul>
|
101
|
-
|
102
|
-
|
103
|
-
<pre>git clone git://github.com/GITHUB_USERNAME/rubydoctest.git</pre>
|
104
|
-
|
105
|
-
<p><span class="caps">TODO</span> – add “github_username: username” to ~/.rubyforge/user-config.yml and newgem will reuse it for future projects.</p>
|
106
|
-
|
62
|
+
<p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people’s code</a>.</p>
|
107
63
|
|
108
|
-
<ul>
|
109
|
-
<li>gitorious: <a href="git://gitorious.org/rubydoctest/mainline.git">git://gitorious.org/rubydoctest/mainline.git</a></li>
|
110
|
-
</ul>
|
111
64
|
|
65
|
+
<p>The git repository is <code>http://github.com/tablatom/rubydoctest/tree/master</code> for anonymous access.</p>
|
112
66
|
|
113
|
-
<pre>git clone git://gitorious.org/rubydoctest/mainline.git</pre>
|
114
67
|
|
115
68
|
<h3>Build and test instructions</h3>
|
116
69
|
|
117
70
|
|
118
71
|
<pre>cd rubydoctest
|
119
|
-
rake test
|
72
|
+
rake test:doctest
|
120
73
|
rake install_gem</pre>
|
121
74
|
|
122
75
|
<h2>License</h2>
|
@@ -128,9 +81,9 @@ rake install_gem</pre>
|
|
128
81
|
<h2>Contact</h2>
|
129
82
|
|
130
83
|
|
131
|
-
<p>Comments are welcome. Send an email to <a href="mailto:
|
84
|
+
<p>Comments are welcome. Send an email to <a href="mailto:duane.johnson@gmail.com">Duane Johnson</a>.</p>
|
132
85
|
<p class="coda">
|
133
|
-
<a href="mailto:duane.johnson@gmail.com">Duane Johnson</a>,
|
86
|
+
<a href="mailto:duane.johnson@gmail.com">Duane Johnson</a>, 23rd June 2008<br>
|
134
87
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
135
88
|
</p>
|
136
89
|
</div>
|
data/website/index.txt
CHANGED
@@ -1,83 +1,37 @@
|
|
1
|
-
h1.
|
1
|
+
h1. Ruby DocTest
|
2
2
|
|
3
3
|
h1. → 'rubydoctest'
|
4
4
|
|
5
5
|
|
6
6
|
h2. What
|
7
7
|
|
8
|
+
Ruby DocTest is a tool that lets you put irb-style tests in your documentation. It’s similar to Python’s doctest, but different in several ways.
|
8
9
|
|
9
10
|
h2. Installing
|
10
11
|
|
11
12
|
<pre syntax="ruby">sudo gem install rubydoctest</pre>
|
12
13
|
|
13
|
-
h2.
|
14
|
+
h2. Wiki, Documentation, Examples
|
14
15
|
|
15
|
-
|
16
|
-
h2. Demonstration of usage
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
h2. Forum
|
21
|
-
|
22
|
-
"http://groups.google.com/group/rubydoctest":http://groups.google.com/group/rubydoctest
|
23
|
-
|
24
|
-
TODO - create Google Group - rubydoctest
|
16
|
+
See the "github wiki":http://github.com/tablatom/rubydoctest/wikis
|
25
17
|
|
26
18
|
h2. How to submit patches
|
27
19
|
|
28
|
-
Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code
|
29
|
-
|
30
|
-
TODO - pick SVN or Git instructions
|
31
|
-
|
32
|
-
The trunk repository is <code>svn://rubyforge.org/var/svn/rubydoctest/trunk</code> for anonymous access.
|
33
|
-
|
34
|
-
OOOORRRR
|
35
|
-
|
36
|
-
You can fetch the source from either:
|
37
|
-
|
38
|
-
<% if rubyforge_project_id %>
|
39
|
-
|
40
|
-
* rubyforge: "http://rubyforge.org/scm/?group_id=<%= rubyforge_project_id %>":http://rubyforge.org/scm/?group_id=<%= rubyforge_project_id %>
|
41
|
-
|
42
|
-
<pre>git clone git://rubyforge.org/rubydoctest.git</pre>
|
20
|
+
Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/.
|
43
21
|
|
44
|
-
|
45
|
-
|
46
|
-
* rubyforge: MISSING IN ACTION
|
47
|
-
|
48
|
-
TODO - You can not created a RubyForge project, OR have not run <code>rubyforge config</code>
|
49
|
-
yet to refresh your local rubyforge data with this projects' id information.
|
50
|
-
|
51
|
-
When you do this, this message will magically disappear!
|
52
|
-
|
53
|
-
Or you can hack website/index.txt and make it all go away!!
|
54
|
-
|
55
|
-
<% end %>
|
56
|
-
|
57
|
-
* github: "http://github.com/GITHUB_USERNAME/rubydoctest/tree/master":http://github.com/GITHUB_USERNAME/rubydoctest/tree/master
|
58
|
-
|
59
|
-
<pre>git clone git://github.com/GITHUB_USERNAME/rubydoctest.git</pre>
|
60
|
-
|
61
|
-
|
62
|
-
TODO - add "github_username: username" to ~/.rubyforge/user-config.yml and newgem will reuse it for future projects.
|
63
|
-
|
64
|
-
|
65
|
-
* gitorious: "git://gitorious.org/rubydoctest/mainline.git":git://gitorious.org/rubydoctest/mainline.git
|
66
|
-
|
67
|
-
<pre>git clone git://gitorious.org/rubydoctest/mainline.git</pre>
|
22
|
+
The git repository is <code>http://github.com/tablatom/rubydoctest/tree/master</code> for anonymous access.
|
68
23
|
|
69
24
|
h3. Build and test instructions
|
70
25
|
|
71
26
|
<pre>cd rubydoctest
|
72
|
-
rake test
|
27
|
+
rake test:doctest
|
73
28
|
rake install_gem</pre>
|
74
29
|
|
75
|
-
|
76
30
|
h2. License
|
77
31
|
|
78
32
|
This code is free to use under the terms of the MIT license.
|
79
33
|
|
80
34
|
h2. Contact
|
81
35
|
|
82
|
-
Comments are welcome. Send an email to "
|
36
|
+
Comments are welcome. Send an email to "Duane Johnson":mailto:duane.johnson@gmail.com.
|
83
37
|
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubydoctest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 21
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 1
|
9
|
+
- 3
|
10
|
+
version: 1.1.3
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Duane Johnson
|
@@ -11,10 +17,25 @@ autorequire:
|
|
11
17
|
bindir: bin
|
12
18
|
cert_chain: []
|
13
19
|
|
14
|
-
date:
|
20
|
+
date: 2011-02-27 00:00:00 -05:00
|
15
21
|
default_executable:
|
16
|
-
dependencies:
|
17
|
-
|
22
|
+
dependencies:
|
23
|
+
- !ruby/object:Gem::Dependency
|
24
|
+
name: hoe
|
25
|
+
prerelease: false
|
26
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
hash: 41
|
32
|
+
segments:
|
33
|
+
- 2
|
34
|
+
- 9
|
35
|
+
- 1
|
36
|
+
version: 2.9.1
|
37
|
+
type: :development
|
38
|
+
version_requirements: *id001
|
18
39
|
description: Ruby version of Python's doctest tool, but a bit different.
|
19
40
|
email: duane.johnson@gmail.com
|
20
41
|
executables:
|
@@ -35,7 +56,6 @@ files:
|
|
35
56
|
- PostInstall.txt
|
36
57
|
- README.txt
|
37
58
|
- Rakefile
|
38
|
-
- Ruby DocTest.tmproj
|
39
59
|
- bin/rubydoctest
|
40
60
|
- config/hoe.rb
|
41
61
|
- config/requirements.rb
|
@@ -68,8 +88,11 @@ files:
|
|
68
88
|
- website/javascripts/rounded_corners_lite.inc.js
|
69
89
|
- website/stylesheets/screen.css
|
70
90
|
- website/template.html.erb
|
91
|
+
- .gemtest
|
71
92
|
has_rdoc: true
|
72
93
|
homepage: http://rubydoctest.rubyforge.org
|
94
|
+
licenses: []
|
95
|
+
|
73
96
|
post_install_message: |+
|
74
97
|
|
75
98
|
rubydoctest comes as an executable that takes a list of files:
|
@@ -84,23 +107,29 @@ rdoc_options:
|
|
84
107
|
require_paths:
|
85
108
|
- lib
|
86
109
|
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
87
111
|
requirements:
|
88
112
|
- - ">="
|
89
113
|
- !ruby/object:Gem::Version
|
114
|
+
hash: 3
|
115
|
+
segments:
|
116
|
+
- 0
|
90
117
|
version: "0"
|
91
|
-
version:
|
92
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
none: false
|
93
120
|
requirements:
|
94
121
|
- - ">="
|
95
122
|
- !ruby/object:Gem::Version
|
123
|
+
hash: 3
|
124
|
+
segments:
|
125
|
+
- 0
|
96
126
|
version: "0"
|
97
|
-
version:
|
98
127
|
requirements: []
|
99
128
|
|
100
129
|
rubyforge_project: rubydoctest
|
101
|
-
rubygems_version: 1.
|
130
|
+
rubygems_version: 1.4.2
|
102
131
|
signing_key:
|
103
|
-
specification_version:
|
132
|
+
specification_version: 3
|
104
133
|
summary: Ruby version of Python's doctest tool, but a bit different.
|
105
134
|
test_files: []
|
106
135
|
|
data/Ruby DocTest.tmproj
DELETED
@@ -1,197 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
-
<plist version="1.0">
|
4
|
-
<dict>
|
5
|
-
<key>currentDocument</key>
|
6
|
-
<string>rubydoctest.gemspec</string>
|
7
|
-
<key>documents</key>
|
8
|
-
<array>
|
9
|
-
<dict>
|
10
|
-
<key>expanded</key>
|
11
|
-
<true/>
|
12
|
-
<key>name</key>
|
13
|
-
<string>rubydoctest</string>
|
14
|
-
<key>regexFolderFilter</key>
|
15
|
-
<string>!.*/(\.[^/]*|rails|CVS|_darcs|_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
|
16
|
-
<key>sourceDirectory</key>
|
17
|
-
<string></string>
|
18
|
-
</dict>
|
19
|
-
</array>
|
20
|
-
<key>fileHierarchyDrawerWidth</key>
|
21
|
-
<integer>315</integer>
|
22
|
-
<key>metaData</key>
|
23
|
-
<dict>
|
24
|
-
<key>Manifest.txt</key>
|
25
|
-
<dict>
|
26
|
-
<key>caret</key>
|
27
|
-
<dict>
|
28
|
-
<key>column</key>
|
29
|
-
<integer>0</integer>
|
30
|
-
<key>line</key>
|
31
|
-
<integer>0</integer>
|
32
|
-
</dict>
|
33
|
-
<key>firstVisibleColumn</key>
|
34
|
-
<integer>0</integer>
|
35
|
-
<key>firstVisibleLine</key>
|
36
|
-
<integer>0</integer>
|
37
|
-
</dict>
|
38
|
-
<key>PostInstall.txt</key>
|
39
|
-
<dict>
|
40
|
-
<key>caret</key>
|
41
|
-
<dict>
|
42
|
-
<key>column</key>
|
43
|
-
<integer>0</integer>
|
44
|
-
<key>line</key>
|
45
|
-
<integer>0</integer>
|
46
|
-
</dict>
|
47
|
-
<key>firstVisibleColumn</key>
|
48
|
-
<integer>0</integer>
|
49
|
-
<key>firstVisibleLine</key>
|
50
|
-
<integer>0</integer>
|
51
|
-
</dict>
|
52
|
-
<key>Rakefile</key>
|
53
|
-
<dict>
|
54
|
-
<key>caret</key>
|
55
|
-
<dict>
|
56
|
-
<key>column</key>
|
57
|
-
<integer>0</integer>
|
58
|
-
<key>line</key>
|
59
|
-
<integer>0</integer>
|
60
|
-
</dict>
|
61
|
-
<key>firstVisibleColumn</key>
|
62
|
-
<integer>0</integer>
|
63
|
-
<key>firstVisibleLine</key>
|
64
|
-
<integer>0</integer>
|
65
|
-
</dict>
|
66
|
-
<key>config/hoe.rb</key>
|
67
|
-
<dict>
|
68
|
-
<key>caret</key>
|
69
|
-
<dict>
|
70
|
-
<key>column</key>
|
71
|
-
<integer>73</integer>
|
72
|
-
<key>line</key>
|
73
|
-
<integer>64</integer>
|
74
|
-
</dict>
|
75
|
-
<key>columnSelection</key>
|
76
|
-
<false/>
|
77
|
-
<key>firstVisibleColumn</key>
|
78
|
-
<integer>0</integer>
|
79
|
-
<key>firstVisibleLine</key>
|
80
|
-
<integer>26</integer>
|
81
|
-
<key>selectFrom</key>
|
82
|
-
<dict>
|
83
|
-
<key>column</key>
|
84
|
-
<integer>66</integer>
|
85
|
-
<key>line</key>
|
86
|
-
<integer>64</integer>
|
87
|
-
</dict>
|
88
|
-
<key>selectTo</key>
|
89
|
-
<dict>
|
90
|
-
<key>column</key>
|
91
|
-
<integer>73</integer>
|
92
|
-
<key>line</key>
|
93
|
-
<integer>64</integer>
|
94
|
-
</dict>
|
95
|
-
</dict>
|
96
|
-
<key>lib/lines.rb</key>
|
97
|
-
<dict>
|
98
|
-
<key>caret</key>
|
99
|
-
<dict>
|
100
|
-
<key>column</key>
|
101
|
-
<integer>0</integer>
|
102
|
-
<key>line</key>
|
103
|
-
<integer>0</integer>
|
104
|
-
</dict>
|
105
|
-
<key>firstVisibleColumn</key>
|
106
|
-
<integer>0</integer>
|
107
|
-
<key>firstVisibleLine</key>
|
108
|
-
<integer>0</integer>
|
109
|
-
</dict>
|
110
|
-
<key>lib/result.rb</key>
|
111
|
-
<dict>
|
112
|
-
<key>caret</key>
|
113
|
-
<dict>
|
114
|
-
<key>column</key>
|
115
|
-
<integer>3</integer>
|
116
|
-
<key>line</key>
|
117
|
-
<integer>62</integer>
|
118
|
-
</dict>
|
119
|
-
<key>firstVisibleColumn</key>
|
120
|
-
<integer>0</integer>
|
121
|
-
<key>firstVisibleLine</key>
|
122
|
-
<integer>16</integer>
|
123
|
-
</dict>
|
124
|
-
<key>lib/rubydoctest/version.rb</key>
|
125
|
-
<dict>
|
126
|
-
<key>caret</key>
|
127
|
-
<dict>
|
128
|
-
<key>column</key>
|
129
|
-
<integer>13</integer>
|
130
|
-
<key>line</key>
|
131
|
-
<integer>3</integer>
|
132
|
-
</dict>
|
133
|
-
<key>firstVisibleColumn</key>
|
134
|
-
<integer>0</integer>
|
135
|
-
<key>firstVisibleLine</key>
|
136
|
-
<integer>0</integer>
|
137
|
-
</dict>
|
138
|
-
<key>lib/runner.rb</key>
|
139
|
-
<dict>
|
140
|
-
<key>caret</key>
|
141
|
-
<dict>
|
142
|
-
<key>column</key>
|
143
|
-
<integer>53</integer>
|
144
|
-
<key>line</key>
|
145
|
-
<integer>129</integer>
|
146
|
-
</dict>
|
147
|
-
<key>firstVisibleColumn</key>
|
148
|
-
<integer>0</integer>
|
149
|
-
<key>firstVisibleLine</key>
|
150
|
-
<integer>0</integer>
|
151
|
-
</dict>
|
152
|
-
<key>rubydoctest.gemspec</key>
|
153
|
-
<dict>
|
154
|
-
<key>caret</key>
|
155
|
-
<dict>
|
156
|
-
<key>column</key>
|
157
|
-
<integer>45</integer>
|
158
|
-
<key>line</key>
|
159
|
-
<integer>14</integer>
|
160
|
-
</dict>
|
161
|
-
<key>firstVisibleColumn</key>
|
162
|
-
<integer>0</integer>
|
163
|
-
<key>firstVisibleLine</key>
|
164
|
-
<integer>0</integer>
|
165
|
-
</dict>
|
166
|
-
<key>tasks/deployment.rake</key>
|
167
|
-
<dict>
|
168
|
-
<key>caret</key>
|
169
|
-
<dict>
|
170
|
-
<key>column</key>
|
171
|
-
<integer>0</integer>
|
172
|
-
<key>line</key>
|
173
|
-
<integer>0</integer>
|
174
|
-
</dict>
|
175
|
-
<key>firstVisibleColumn</key>
|
176
|
-
<integer>0</integer>
|
177
|
-
<key>firstVisibleLine</key>
|
178
|
-
<integer>0</integer>
|
179
|
-
</dict>
|
180
|
-
</dict>
|
181
|
-
<key>openDocuments</key>
|
182
|
-
<array>
|
183
|
-
<string>lib/runner.rb</string>
|
184
|
-
<string>lib/rubydoctest/version.rb</string>
|
185
|
-
<string>tasks/deployment.rake</string>
|
186
|
-
<string>Manifest.txt</string>
|
187
|
-
<string>PostInstall.txt</string>
|
188
|
-
<string>Rakefile</string>
|
189
|
-
<string>config/hoe.rb</string>
|
190
|
-
<string>rubydoctest.gemspec</string>
|
191
|
-
</array>
|
192
|
-
<key>showFileHierarchyDrawer</key>
|
193
|
-
<true/>
|
194
|
-
<key>windowFrame</key>
|
195
|
-
<string>{{61, 4}, {935, 874}}</string>
|
196
|
-
</dict>
|
197
|
-
</plist>
|