nandoc 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. data/README +5 -4
  2. data/Rakefile +1 -1
  3. data/bin/nandoc +2 -1
  4. data/doc/FAQ.md +3 -0
  5. data/doc/PROVISO.md +39 -0
  6. data/doc/commands/diff.md +49 -0
  7. data/doc/svg/less-fonts.svg +2 -2
  8. data/lib/nandoc/cli/README.md +6 -0
  9. data/lib/nandoc/cli/command-methods.rb +38 -0
  10. data/lib/nandoc/cli/option-methods/exclusive-options.rb +56 -0
  11. data/lib/nandoc/cli/option-methods/option-enum.rb +64 -0
  12. data/lib/nandoc/cli/option-methods.rb +35 -0
  13. data/lib/nandoc/cli.rb +3 -0
  14. data/lib/nandoc/commands/create-nandoc-site.rb +9 -12
  15. data/lib/nandoc/commands/diff.rb +14 -11
  16. data/lib/nandoc/commands.rb +9 -0
  17. data/lib/nandoc/{config.rb → core/config.rb} +18 -9
  18. data/lib/nandoc/core/project.rb +50 -0
  19. data/lib/nandoc/doc/hack-free-zone-defined.md +33 -0
  20. data/lib/nandoc/erb/agent.rb +5 -5
  21. data/lib/nandoc/{test/minitest-extlib.rb → extlib/minitest.rb} +1 -1
  22. data/lib/nandoc/filters/builtin-tags/fence/terminal.rb +24 -0
  23. data/lib/nandoc/filters/builtin-tags/fence-dispatcher.rb +43 -0
  24. data/lib/nandoc/filters/builtin-tags/fences.rb +4 -0
  25. data/lib/nandoc/filters/builtin-tags/see-test.rb +67 -0
  26. data/lib/nandoc/filters/builtin-tags.rb +11 -0
  27. data/lib/nandoc/filters/custom-tag.rb +43 -0
  28. data/lib/nandoc/filters/custom-tags.rb +19 -0
  29. data/lib/nandoc/filters/tag-parse-instance-methods.rb +11 -0
  30. data/lib/nandoc/filters/tag-parser.rb +206 -0
  31. data/lib/nandoc/filters.rb +11 -585
  32. data/lib/nandoc/{cri-hacks.rb → hacks/cri-hacks.rb} +4 -3
  33. data/lib/nandoc/{data-source.rb → hacks/data-source.rb} +5 -4
  34. data/lib/nandoc/{item-class-hacks.rb → hacks/item-class-hacks.rb} +3 -1
  35. data/lib/nandoc/hacks.rb +6 -0
  36. data/lib/nandoc/helpers/menu-bouncy.rb +1 -1
  37. data/lib/nandoc/helpers/site-map.rb +3 -0
  38. data/lib/nandoc/helpers.rb +1 -1
  39. data/lib/nandoc/html/tags.rb +65 -0
  40. data/lib/nandoc/html.rb +6 -0
  41. data/lib/nandoc/parse-readme.rb +4 -0
  42. data/lib/nandoc/spec-doc/agent-instance-methods.rb +24 -0
  43. data/lib/nandoc/spec-doc/code-snippet.rb +59 -0
  44. data/lib/nandoc/spec-doc/generic-agent.rb +40 -0
  45. data/lib/nandoc/spec-doc/mock-prompt.rb +3 -9
  46. data/lib/nandoc/spec-doc/parse-trace.rb +25 -0
  47. data/lib/nandoc/spec-doc/{mini-test/spec-instance-methods.rb → playback/html/foo-bar.rb} +0 -0
  48. data/lib/nandoc/spec-doc/playback/html.rb +2 -0
  49. data/lib/nandoc/spec-doc/playback/players/method.rb +64 -0
  50. data/lib/nandoc/spec-doc/playback/players/ruby.rb +158 -0
  51. data/lib/nandoc/spec-doc/playback/players/terminal.rb +93 -0
  52. data/lib/nandoc/spec-doc/playback/players.rb +4 -0
  53. data/lib/nandoc/spec-doc/playback/support/playback-methods.rb +44 -0
  54. data/lib/nandoc/spec-doc/playback/support/sexp-scanner.rb +61 -0
  55. data/lib/nandoc/spec-doc/playback/support.rb +3 -0
  56. data/lib/nandoc/spec-doc/playback/terminal/color-to-html.rb +100 -0
  57. data/lib/nandoc/spec-doc/playback.rb +3 -0
  58. data/lib/nandoc/spec-doc/recordings.rb +55 -0
  59. data/lib/nandoc/spec-doc/ruby2ruby-standin.rb +37 -0
  60. data/lib/nandoc/spec-doc/test-case-agent.rb +1 -1
  61. data/lib/nandoc/spec-doc/{mini-test.rb → test-framework/mini-test/proxy.rb} +9 -31
  62. data/lib/nandoc/spec-doc/{test-framework-proxy.rb → test-framework/proxy.rb} +27 -50
  63. data/lib/nandoc/spec-doc.rb +57 -13
  64. data/lib/nandoc/{test → support}/diff-to-string.rb +0 -0
  65. data/lib/nandoc/support/regexp-enhance.rb +6 -0
  66. data/lib/nandoc/support/regexp.rb +12 -0
  67. data/lib/nandoc/support/secret-parent.rb +21 -0
  68. data/lib/nandoc/support/shared-attr-reader.rb +32 -0
  69. data/lib/nandoc/support/site-merge.rb +1 -1
  70. data/lib/nandoc/support/site-methods.rb +4 -4
  71. data/lib/nandoc/support/stream-colorizer.rb +1 -1
  72. data/lib/nandoc/support/string-methods.rb +56 -0
  73. data/lib/nandoc.rb +12 -35
  74. data/proto/README.md +4 -2
  75. data/test/test.rb +1 -0
  76. metadata +58 -25
  77. data/doc/bar/baz.md +0 -4
  78. data/doc/bar/bliff.md +0 -8
  79. data/doc/foo.md +0 -5
  80. data/doc/getting-started.rb +0 -13
  81. data/lib/nandoc/spec-doc/support-modules.rb +0 -158
  82. data/lib/nandoc/spec-doc/test-framework-dispatcher.rb +0 -15
  83. data/lib/nandoc/support-modules.rb +0 -273
  84. data/lib/nandoc/treebis/NOGIT-DOCS/NEWS.md +0 -5
  85. data/lib/nandoc/treebis/NOGIT-README.md +0 -65
  86. data/lib/nandoc/treebis/nandoc.persistent.json +0 -3
@@ -0,0 +1,56 @@
1
+ module NanDoc
2
+ # @dependencies: none
3
+
4
+ module StringMethods
5
+ def basename_no_extension str
6
+ /([^\/\.]+)(?:\.[^\.\/]+)?\Z/ =~ str ? $1 : nil
7
+ end
8
+ def indent str, indent
9
+ str.gsub(/^/, indent)
10
+ end
11
+ def no_blank_lines str
12
+ str.gsub(/\n[[:space:]]*\n/, "\n")
13
+ end
14
+ def no_leading_ws str
15
+ str.sub(/\A[[:space:]]+/, '')
16
+ end
17
+ def no_trailing_ws str
18
+ str.sub(/[[:space:]]+\Z/, '')
19
+ end
20
+ def oxford_comma items, final = ' and ', &quoter
21
+ items = items.map(&quoter) if quoter
22
+ these = []
23
+ these.push final if items.size > 1
24
+ these.concat(Array.new(items.size-2,', ')) if items.size > 2
25
+ these.reverse!
26
+ items.zip(these).flatten.compact.join
27
+ end
28
+ module_function :oxford_comma
29
+ def quoted
30
+ proc{|x| "\"#{x}\"" }
31
+ end
32
+
33
+ #
34
+ # must respond to tab() and tabs()
35
+ # reindent a block by striping leading whitespace from lines evenly
36
+ # and then re-indenting each line according to our indent.
37
+ # this could be simpler, it has been more complicated
38
+ # we do it languidly because we can
39
+ #
40
+ def reindent h1, offset=0
41
+ indent_by = tab * (tabs+offset)
42
+ unindent_by = (/\A([[:space:]]+)/ =~ h1 && $1) or
43
+ fail('regex fail -- not sure if we need this to be so strict')
44
+ h2 = no_blank_lines(h1) # careful. will mess up with <pre> etc
45
+ return h2 if unindent_by == indent_by
46
+ h3 = unindent(h2, unindent_by)
47
+ h4 = indent(h3, indent_by)
48
+ h4
49
+ end
50
+
51
+ def unindent str, by=nil
52
+ by ||= (/\A([ \t]*)/ =~ str and $1 )
53
+ str.gsub(/^#{Regexp.escape(by)}/, '')
54
+ end
55
+ end
56
+ end
data/lib/nandoc.rb CHANGED
@@ -3,46 +3,23 @@
3
3
 
4
4
  unless Object.const_defined?('NanDoc')
5
5
 
6
- require 'nanoc3'
7
- require 'nanoc3/cli'
8
-
9
- module NanDoc
6
+ module NanDoc; end
10
7
  #
11
8
  # i make the D big so i can see it
12
9
  # i move my head away from the microphone when i breathe
13
10
  #
14
- Root = File.expand_path('../..',__FILE__)
15
- end
16
-
17
- me = File.dirname(__FILE__)+'/nandoc'
18
-
19
- # order is important:
20
- require me + '/support-modules.rb'
21
- require 'treebis' # gem
22
- require me + '/config.rb'
23
-
24
- module NanDoc
25
- Treebis::PersistentDotfile.extend_to(self,
26
- './nandoc.persistent.json',
27
- :file_utils => Config.file_utils
28
- )
29
- end
30
-
31
- # order is not important: (alphabetical:)
32
- require me + '/commands/create-nandoc-site.rb'
33
- require me + '/commands/diff.rb'
34
- require me + '/cri-hacks.rb'
35
- require me + '/data-source.rb'
36
- require me + '/filters.rb'
37
- require me + '/helpers.rb'
38
- require me + '/item-class-hacks.rb'
39
11
 
40
- Nanoc3::DataSource.register ::NanDoc::DataSource, :nandoc
41
- Nanoc3::Filter.register ::NanDoc::Filters::General, :nandoc
42
12
 
43
- shared_base = Nanoc3::CLI::Base.shared_base
44
- shared_base.remove_command Nanoc3::CLI::Commands::CreateSite
45
- shared_base.add_command NanDoc::CreateNanDocSite.new
46
- shared_base.add_command NanDoc::Commands::Diff.new
13
+ require 'nanoc3'
14
+ require 'nanoc3/cli'
15
+ require 'treebis'
16
+ me = File.dirname(__FILE__)+'/nandoc'
17
+ require me + '/core/config.rb'
18
+ require me + '/hacks.rb'
19
+ require me + '/commands.rb'
20
+ # only above should be necessary for 'create site'
47
21
 
22
+ require me + '/helpers.rb'
23
+ require me + '/filters.rb'
24
+ require me + '/core/project.rb'
48
25
  end
data/proto/README.md CHANGED
@@ -1,11 +1,13 @@
1
1
  ### Abstract
2
2
 
3
- This document presents three implementation alternatives of NanDoc site creation, and then explains why we are going with the one we are going with at the time of this writing. (It was also a chance for me to experiment with markdown footnotes!)
3
+ The target audience of this document is developers *of* nanDoc, not developers using nanDoc.
4
+
5
+ This document introduces the use of [treebis](http://treebis.hipeland.org) tasks for use in representing site prototypes and generating prototype sites; and presents three implementation alternatives of NanDoc site creation, and then explains why we are going with the one we are going with at the time of this writing. (It was also a chance for me to experiment with markdown footnotes!)
4
6
 
5
7
 
6
8
  ### Prototypes
7
9
 
8
- Almost each folder in this folder is a 'prototype' nanDoc installation. Most users will only ever use the `default` prototype and not worry about other prototypes.
10
+ Almost each folder in this folder is a 'prototype' nanDoc installation. Most users will only ever use the `default` prototype and not worry about other prototypes. (maybe.)
9
11
 
10
12
  The folder called 'misc' holds one-off templates for ad-hoc stuff, maybe for helpers etc.
11
13
 
data/test/test.rb CHANGED
@@ -7,6 +7,7 @@ describe 'Basic' do
7
7
  Treebis::PersistentDotfile.include_to(self, '.nandoc.persistent.json')
8
8
  include Treebis::DirAsHash
9
9
  include Treebis::Sopen2
10
+ include NanDoc::SpecDoc # really just loads nandoc/extlib/minitest
10
11
 
11
12
  def file_utils
12
13
  @fu ||= NanDoc::Config.file_utils
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Chip Malice
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-12 00:00:00 -04:00
17
+ date: 2010-05-17 00:00:00 -04:00
18
18
  default_executable: nandoc
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -41,8 +41,8 @@ dependencies:
41
41
  segments:
42
42
  - 0
43
43
  - 0
44
- - 1
45
- version: 0.0.1
44
+ - 2
45
+ version: 0.0.2
46
46
  type: :runtime
47
47
  version_requirements: *id002
48
48
  - !ruby/object:Gem::Dependency
@@ -73,53 +73,86 @@ files:
73
73
  - doc/CREDITS.md
74
74
  - doc/FAQ.md
75
75
  - doc/FAQ/why-not-wiki.md
76
+ - doc/PROVISO.md
76
77
  - doc/TODOs-and-BUGs.md
77
- - doc/bar/baz.md
78
- - doc/bar/bliff.md
79
- - doc/foo.md
80
- - doc/getting-started.rb
78
+ - doc/commands/diff.md
81
79
  - doc/svg/less-fonts.svg
82
80
  - lib/nandoc.rb
81
+ - lib/nandoc/cli.rb
82
+ - lib/nandoc/cli/README.md
83
+ - lib/nandoc/cli/command-methods.rb
84
+ - lib/nandoc/cli/option-methods.rb
85
+ - lib/nandoc/cli/option-methods/exclusive-options.rb
86
+ - lib/nandoc/cli/option-methods/option-enum.rb
87
+ - lib/nandoc/commands.rb
83
88
  - lib/nandoc/commands/create-nandoc-site.rb
84
89
  - lib/nandoc/commands/diff.rb
85
- - lib/nandoc/config.rb
86
- - lib/nandoc/cri-hacks.rb
87
- - lib/nandoc/data-source.rb
90
+ - lib/nandoc/core/config.rb
91
+ - lib/nandoc/core/project.rb
88
92
  - lib/nandoc/deployers/rsync.rb
93
+ - lib/nandoc/doc/hack-free-zone-defined.md
89
94
  - lib/nandoc/erb/agent.rb
95
+ - lib/nandoc/extlib/minitest.rb
90
96
  - lib/nandoc/filters.rb
97
+ - lib/nandoc/filters/builtin-tags.rb
98
+ - lib/nandoc/filters/builtin-tags/fence-dispatcher.rb
99
+ - lib/nandoc/filters/builtin-tags/fence/terminal.rb
100
+ - lib/nandoc/filters/builtin-tags/fences.rb
101
+ - lib/nandoc/filters/builtin-tags/see-test.rb
102
+ - lib/nandoc/filters/custom-tag.rb
103
+ - lib/nandoc/filters/custom-tags.rb
104
+ - lib/nandoc/filters/tag-parse-instance-methods.rb
105
+ - lib/nandoc/filters/tag-parser.rb
106
+ - lib/nandoc/hacks.rb
107
+ - lib/nandoc/hacks/cri-hacks.rb
108
+ - lib/nandoc/hacks/data-source.rb
109
+ - lib/nandoc/hacks/item-class-hacks.rb
91
110
  - lib/nandoc/helpers.rb
92
111
  - lib/nandoc/helpers/menu-bouncy.rb
93
112
  - lib/nandoc/helpers/site-map.rb
94
113
  - lib/nandoc/helpers/top-nav.rb
95
- - lib/nandoc/item-class-hacks.rb
114
+ - lib/nandoc/html.rb
115
+ - lib/nandoc/html/tags.rb
96
116
  - lib/nandoc/nandoc.persistent.json
97
117
  - lib/nandoc/parse-readme.rb
98
118
  - lib/nandoc/spec-doc.rb
99
- - lib/nandoc/spec-doc/mini-test.rb
100
- - lib/nandoc/spec-doc/mini-test/spec-instance-methods.rb
119
+ - lib/nandoc/spec-doc/agent-instance-methods.rb
120
+ - lib/nandoc/spec-doc/code-snippet.rb
121
+ - lib/nandoc/spec-doc/generic-agent.rb
101
122
  - lib/nandoc/spec-doc/mock-prompt.rb
102
- - lib/nandoc/spec-doc/support-modules.rb
123
+ - lib/nandoc/spec-doc/parse-trace.rb
124
+ - lib/nandoc/spec-doc/playback.rb
125
+ - lib/nandoc/spec-doc/playback/html.rb
126
+ - lib/nandoc/spec-doc/playback/html/foo-bar.rb
127
+ - lib/nandoc/spec-doc/playback/players.rb
128
+ - lib/nandoc/spec-doc/playback/players/method.rb
129
+ - lib/nandoc/spec-doc/playback/players/ruby.rb
130
+ - lib/nandoc/spec-doc/playback/players/terminal.rb
131
+ - lib/nandoc/spec-doc/playback/support.rb
132
+ - lib/nandoc/spec-doc/playback/support/playback-methods.rb
133
+ - lib/nandoc/spec-doc/playback/support/sexp-scanner.rb
134
+ - lib/nandoc/spec-doc/playback/terminal/color-to-html.rb
135
+ - lib/nandoc/spec-doc/recordings.rb
136
+ - lib/nandoc/spec-doc/ruby2ruby-standin.rb
103
137
  - lib/nandoc/spec-doc/test-case-agent.rb
104
- - lib/nandoc/spec-doc/test-framework-dispatcher.rb
105
- - lib/nandoc/spec-doc/test-framework-proxy.rb
106
- - lib/nandoc/support-modules.rb
138
+ - lib/nandoc/spec-doc/test-framework/mini-test/proxy.rb
139
+ - lib/nandoc/spec-doc/test-framework/proxy.rb
107
140
  - lib/nandoc/support/diff-proxy.rb
141
+ - lib/nandoc/support/diff-to-string.rb
108
142
  - lib/nandoc/support/orphanage.rb
109
143
  - lib/nandoc/support/path-tardo.rb
110
144
  - lib/nandoc/support/regexp-enhance.rb
145
+ - lib/nandoc/support/regexp.rb
146
+ - lib/nandoc/support/secret-parent.rb
147
+ - lib/nandoc/support/shared-attr-reader.rb
111
148
  - lib/nandoc/support/site-diff.rb
112
149
  - lib/nandoc/support/site-merge.rb
113
150
  - lib/nandoc/support/site-methods.rb
114
151
  - lib/nandoc/support/stream-colorizer.rb
152
+ - lib/nandoc/support/string-methods.rb
115
153
  - lib/nandoc/support/treebis-extlib.rb
116
154
  - lib/nandoc/tasks.rb
117
155
  - lib/nandoc/tasks/nandoc/deploy.rake
118
- - lib/nandoc/test/diff-to-string.rb
119
- - lib/nandoc/test/minitest-extlib.rb
120
- - lib/nandoc/treebis/NOGIT-DOCS/NEWS.md
121
- - lib/nandoc/treebis/NOGIT-README.md
122
- - lib/nandoc/treebis/nandoc.persistent.json
123
156
  - proto/README.md
124
157
  - proto/default/Rakefile
125
158
  - proto/default/Rules
@@ -170,6 +203,6 @@ rubyforge_project: nandoc
170
203
  rubygems_version: 1.3.6
171
204
  signing_key:
172
205
  specification_version: 3
173
- summary: hack of [nanoc3](http://nanoc.stoneship.org) to generate a static site of your ruby project from your README etc.
206
+ summary: hack of [nanoc3](http://nanoc.stoneship.org) to generate a static site of your (command-line) ruby project from your README etc.
174
207
  test_files:
175
208
  - test/test.rb
data/doc/bar/baz.md DELETED
@@ -1,4 +0,0 @@
1
- # what a crazy
2
-
3
- ## way to
4
- write your docs
data/doc/bar/bliff.md DELETED
@@ -1,8 +0,0 @@
1
- # what if
2
-
3
- ## you wrote
4
-
5
- all your documenation
6
- ~~~
7
- like this
8
- ~~~~
data/doc/foo.md DELETED
@@ -1,5 +0,0 @@
1
- i am some secret content
2
- ### in this
3
- strange file
4
-
5
- see bar somehow
@@ -1,13 +0,0 @@
1
- ### requirements
2
-
3
- boobric foobric blaz
4
- ~~~
5
- some code
6
- ~~~
7
-
8
-
9
- blaff bliff bloof
10
-
11
- #### other stuff
12
-
13
- that's how you just got started
@@ -1,158 +0,0 @@
1
- module NanDoc
2
- module SpecDoc
3
- module AgentInstanceMethods
4
- # share things between MockPrompt and TestCaseAgent
5
-
6
- # we used to use first method, now we use first test_ method
7
- def method_name_to_record caller
8
- line = caller.detect{ |x| x =~ /in `test_/ } or fail('hack fail')
9
- method = line =~ /in `(.+)'\Z/ && $1 or fail("hack fail")
10
- method
11
- end
12
-
13
- def recordings
14
- @recordings ||= NanDoc::SpecDoc::Recordings.get(test_case)
15
- end
16
-
17
- def story story_name
18
- method = method_name_to_record(caller)
19
- rec = recordings
20
- rec.add(:method, method)
21
- rec.add(:story, story_name)
22
- nil
23
- end
24
-
25
- end
26
-
27
- class CodeSnippet
28
- #
29
- # internally this does deferred parsing of the thing
30
- # a code snippet holds meta information (or maybe content)
31
- # for record_ruby nandoc commands in tests.
32
- #
33
-
34
- def initialize matches_hash
35
- @start_at = matches_hash
36
- @stop_at = nil
37
- @lines_proc = nil
38
- end
39
- attr_reader :start_at
40
- %w(method line file).each do |meth|
41
- sym = meth.to_sym
42
- define_method(meth){ || @start_at[sym] }
43
- end
44
- def describe
45
- last = method ? ":in `#{method}'" : ''
46
- "#{file}:#{line}#{tail}"
47
- end
48
- # just hide all the lines from dumps to make irb debugging prettier
49
- def file_lines
50
- @lines_proc ||= begin
51
- stop_at_assert # not really appropriate here
52
- same_file_assert # not really appropriate here
53
- all_lines = File.open(@start_at[:file],'r').lines.map # sure why not
54
- proc{ all_lines }
55
- end
56
- @lines_proc.call
57
- end
58
- def line_start
59
- @start_at[:line]
60
- end
61
- def line_stop
62
- @stop_at[:line]
63
- end
64
- # @todo maybe get rid of this. we interpolate inspects elsewhere
65
- def ruby_string_raw
66
- @ruby_string_raw ||= begin
67
- these = all_lines[line_start..(line_stop-2)]
68
- these.join('') # they have newlines already
69
- end
70
- end
71
- def stop_at data=nil
72
- data ? (@stop_at = data) : @stop_at
73
- end
74
- private
75
- def same_file_assert
76
- @stop_at[:file] == @start_at[:file] or fail("I want life to be"<<
77
- " simple. start and stop files must be the same: "<<
78
- ([@stop_at, @start_at].map{ |x| File.basename(x)}*' and '))
79
- end
80
- def stop_at_assert
81
- stop_at or fail("no record_ruby_stop() found in method "<<
82
- "after #{describe}")
83
- end
84
- end
85
-
86
- module ParseTrace
87
- #
88
- # @return [Regexp] enhanced regex that parses a stack trace line
89
- #
90
- def parse_trace
91
- @parse_trace_re ||= begin
92
- re = /\A(.*):(\d+)(?::in `([^']+)')?\Z/
93
- RegexpEnhance.names(re, :file, :line, :method)
94
- re
95
- end
96
- end
97
- def parse_trace_assert line
98
- md = parse_trace.match(line) or
99
- fail("couldn't parse trace line: #{line}")
100
- h = md.to_hash
101
- /\A\d+\Z/ =~ h[:line] or fail("not line: #{h[:line]}.inspect")
102
- h[:line] = h[:line].to_i
103
- h
104
- end
105
- end
106
-
107
-
108
- class Recordings < Array
109
- #
110
- # everything that nandoc does during test runs gets written
111
- # to one of these. It's like a Sexp structure.
112
- #
113
-
114
-
115
- @for_test_case = {}
116
-
117
- class << self
118
- attr_accessor :for_test_case
119
- def get test_case
120
- @for_test_case[test_case.class] ||= new(test_case.class)
121
- end
122
- def report_test_case_not_found tc
123
- msgs = ["no recordings found for #{tc}"]
124
- msgs.join(' ')
125
- end
126
- end
127
-
128
- def add name, *data
129
- # this might change if we need to group by method name
130
- push [name, *data]
131
- end
132
-
133
- def get_first_sexp_for_test_method meth
134
- first = index([:method, meth]) or return nil
135
- last = (first+1..length-1).detect do |i|
136
- self[i].first == :method && self[i][1] != meth
137
- end
138
- last = last ? (last - 1) : (length - 1)
139
- ret = self[first..last]
140
- ret
141
- end
142
-
143
- def initialize test_case
144
- @test_case = test_case
145
- end
146
-
147
- def note &block
148
- push [:note, block]
149
- end
150
-
151
- def report_recording_not_found meth_name
152
- "no recordings found for #{meth_name}"
153
- end
154
-
155
- attr_reader :test_case
156
- end
157
- end
158
- end
@@ -1,15 +0,0 @@
1
- require File.dirname(__FILE__)+'/test-framework-proxy.rb'
2
-
3
- module NanDoc
4
- module SpecDoc
5
- class TestFrameworkDispatcher
6
- def initialize gem_root
7
- require File.dirname(__FILE__)+'/mini-test.rb'
8
- @the_only_proxy = SpecDoc::MiniTest::Proxy.new(gem_root)
9
- end
10
- def get_sexp *a
11
- @the_only_proxy.get_sexp(*a)
12
- end
13
- end
14
- end
15
- end