rdoc-generator-sixfish 0.5.0.pre20180710102525

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,250 @@
1
+ # -*- ruby -*-
2
+ #encoding: utf-8
3
+
4
+ require_relative '../../helpers'
5
+
6
+ require 'tmpdir'
7
+ require 'rspec'
8
+ require 'rdoc/generator/sixfish'
9
+
10
+ describe RDoc::Generator::Sixfish do
11
+
12
+ # Lots of the setup and the examples in this file are ported from
13
+ # the test_rdoc_generator_darkfish.rb file from RDoc itself.
14
+ # Used under the second option in the LICENSE.rdoc file:
15
+ # https://github.com/rdoc/rdoc/blob/master/LICENSE.rdoc
16
+
17
+ before( :all ) do
18
+ @libdir = Pathname.pwd + 'lib'
19
+ @datadir = RDoc::Generator::Sixfish::DATADIR
20
+ @tmpdir = Pathname( Dir.tmpdir ) + "test_rdoc_generator_sixfish_#{$$}"
21
+ @opdir = @tmpdir + 'docs'
22
+ @storefile = @tmpdir + '.rdoc_store'
23
+
24
+ @options = RDoc::Options.new
25
+ @options.option_parser = OptionParser.new
26
+
27
+ @options.op_dir = @opdir.to_s
28
+ @options.generator = described_class
29
+ @options.template_dir = @datadir.to_s
30
+
31
+ @tmpdir.mkpath
32
+ @store = RDoc::Store.new( @storefile.to_s )
33
+ @store.load_cache
34
+
35
+ $stderr.puts "Tmpdir is: %s" % [@tmpdir] if ENV['SIXFISH_DEVELMODE']
36
+ end
37
+
38
+ before( :each ) do
39
+ @generator = described_class.new( @store, @options )
40
+
41
+ @rdoc = RDoc::RDoc.new
42
+ @rdoc.options = @options
43
+ @rdoc.store = @store
44
+ @rdoc.generator = @generator
45
+
46
+ @top_level, @readme = add_code_objects( @store )
47
+ end
48
+
49
+ around( :each ) do |example|
50
+ @opdir.mkpath
51
+ Dir.chdir( @opdir ) { example.run }
52
+ @opdir.rmtree unless ENV['SIXFISH_DEVELMODE']
53
+ end
54
+
55
+
56
+ #
57
+ # Examples
58
+ #
59
+
60
+ it "registers itself as a generator" do
61
+ expect( RDoc::RDoc::GENERATORS ).to include( 'sixfish' => described_class )
62
+ end
63
+
64
+
65
+ it "configures Inversion to load templates from its data directory" do
66
+ expect( Inversion::Template.template_paths ).to eq( [@datadir + 'templates'] )
67
+ end
68
+
69
+
70
+ describe "additional-stylesheet option" do
71
+
72
+ it "is added to the options by the setup_options callback" do
73
+ @options.setup_generator( 'sixfish' )
74
+ expect( @options.option_parser.to_a.join ).to include( '--additional-stylesheet=URL' )
75
+ end
76
+
77
+ end
78
+
79
+
80
+ describe "generation" do
81
+
82
+ before( :each ) do
83
+ @generator.populate_data_objects
84
+ end
85
+
86
+
87
+ it "combines an index template with the layout template to make the index page" do
88
+ layout_template = get_fixtured_layout_template_mock()
89
+
90
+ index_template = double( "index template" )
91
+ expect( Inversion::Template ).to receive( :load ).
92
+ with( 'index.tmpl', encoding: 'utf-8' ).
93
+ and_return( index_template )
94
+
95
+ expect( index_template ).to receive( :dup ).and_return( index_template )
96
+ expect( index_template ).to receive( :mainpage= ).with( @readme )
97
+ expect( index_template ).to receive( :synopsis= ).
98
+ with( %{<h1 id="label-Testing+README">Testing <a href="README_md} +
99
+ %{.html">README</a><span><a href="#label-Testing+README">} +
100
+ %{&para;</a> <a href="#top">&uarr;</a></span></h1>} +
101
+ %{<p>This is a readme for testing.</p>} )
102
+
103
+ expect( layout_template ).to receive( :contents= ).with( index_template )
104
+ expect( layout_template ).to receive( :pageclass= ).with( 'index-page' )
105
+ expect( layout_template ).to receive( :rel_prefix= ).with( Pathname('.') )
106
+
107
+ expect( layout_template ).to receive( :render ).and_return( 'Index page!' )
108
+
109
+ @generator.generate_index_page
110
+ end
111
+
112
+
113
+ it "combines a class template with the layout template to make class pages" do
114
+ classes = @store.all_classes_and_modules
115
+
116
+ layout_template = get_fixtured_layout_template_mock()
117
+
118
+ class_template = double( "class template" )
119
+ expect( Inversion::Template ).to receive( :load ).
120
+ with( 'class.tmpl', encoding: 'utf-8' ).
121
+ and_return( class_template )
122
+ expect( class_template ).to receive( :dup ).and_return( class_template )
123
+
124
+ classes.each do |klass|
125
+ expect( class_template ).to receive( :klass= ).with( klass )
126
+ end
127
+
128
+ expect( layout_template ).to receive( :contents= ).with( class_template ).
129
+ exactly( classes.length ).times
130
+ expect( layout_template ).to receive( :pageclass= ).with( 'class-page' ).
131
+ exactly( classes.length ).times
132
+ expect( layout_template ).to receive( :rel_prefix= ).with( Pathname('.') ).
133
+ exactly( classes.length ).times
134
+
135
+ expect( layout_template ).to receive( :render ).
136
+ and_return( *classes.map {|k| "#{k.name} class page!"} )
137
+
138
+ @generator.generate_class_files
139
+ end
140
+
141
+
142
+ it "combines a file template with the layout template to make file pages" do
143
+ files = @store.all_files
144
+
145
+ layout_template = get_fixtured_layout_template_mock()
146
+
147
+ file_template = double( "file template" )
148
+ expect( Inversion::Template ).to receive( :load ).
149
+ with( 'file.tmpl', encoding: 'utf-8' ).
150
+ and_return( file_template )
151
+ expect( file_template ).to receive( :dup ).and_return( file_template )
152
+ expect( file_template ).to receive( :header= ).
153
+ with( %{<h1 id="label-Testing+README">Testing <a href="README_md} +
154
+ %{.html">README</a><span><a href="#label-Testing+README">} +
155
+ %{&para;</a> <a href="#top">&uarr;</a></span></h1>} )
156
+ expect( file_template ).to receive( :description= ).
157
+ with( %{\n<p>This is a readme for testing.</p>\n\n<p>It has some more} +
158
+ %{ stuff</p>\n\n<p>And even more stuff.</p>\n} )
159
+
160
+ expect( file_template ).to receive( :file= ).with( @readme )
161
+
162
+ expect( layout_template ).to receive( :contents= ).with( file_template ).once
163
+ expect( layout_template ).to receive( :pageclass= ).with( 'file-page' )
164
+ expect( layout_template ).to receive( :rel_prefix= ).with( Pathname('.') )
165
+ expect( layout_template ).to receive( :render ).and_return( "README file page!" )
166
+
167
+ @generator.generate_file_files
168
+ end
169
+
170
+ end
171
+
172
+
173
+
174
+ #
175
+ # Helpers
176
+ #
177
+
178
+ def any_method( name, comment=nil )
179
+ return RDoc::AnyMethod.new( comment, name )
180
+ end
181
+
182
+
183
+ def add_code_objects( store )
184
+ top_level = store.add_file( 'file.rb' )
185
+ top_level.parser = RDoc::Parser::Ruby
186
+
187
+ # Klass
188
+ klass = top_level.add_class( RDoc::NormalClass, 'Klass' )
189
+
190
+ # Klass::A
191
+ alias_constant = RDoc::Constant.new( 'A', nil, '' )
192
+ alias_constant.record_location( top_level )
193
+ top_level.add_constant( alias_constant )
194
+
195
+ # ::A = ::Klass (?)
196
+ klass.add_module_alias( klass, 'A', top_level )
197
+
198
+ # Klass#method
199
+ meth = RDoc::AnyMethod.new( nil, 'method' )
200
+ klass.add_method( meth )
201
+
202
+ # Klass#method!
203
+ meth_bang = RDoc::AnyMethod.new( nil, 'method!' )
204
+ klass.add_method( meth_bang )
205
+
206
+ # attr_accessor :name
207
+ name_attr = RDoc::Attr.new( nil, 'name', 'RW', '' )
208
+ klass.add_attribute( name_attr )
209
+
210
+ # Ignored class ::Ignored
211
+ ignored = top_level.add_class( RDoc::NormalClass, 'Ignored' )
212
+ ignored.ignore
213
+
214
+ readme = store.add_file( 'README.md' )
215
+ readme.parser = RDoc::Parser::Markdown
216
+ readme.comment = "= Testing README\n\nThis is a readme for testing.\n\n" +
217
+ "It has some more stuff\n\nAnd even more stuff.\n\n"
218
+
219
+ store.complete :private
220
+
221
+ return top_level, readme
222
+ end
223
+
224
+
225
+ def get_fixtured_layout_template_mock
226
+ layout_template = double( "layout template" )
227
+ expect( Inversion::Template ).to receive( :load ).
228
+ with( 'layout.tmpl', encoding: 'utf-8' ).
229
+ and_return( layout_template )
230
+
231
+ # Work around caching
232
+ expect( layout_template ).to receive( :dup ).and_return( layout_template )
233
+
234
+ expect( layout_template ).to receive( :files= ).with( [@readme, @top_level] )
235
+ expect( layout_template ).to receive( :classes= ).
236
+ with( @store.all_classes_and_modules.sort )
237
+ expect( layout_template ).to receive( :methods= ).
238
+ with( @store.all_classes_and_modules.flat_map(&:method_list).sort )
239
+ expect( layout_template ).to receive( :modsort= ) do |sorted_mods|
240
+ expect( sorted_mods ).to include( @store.find_class_named('Klass') )
241
+ end
242
+ expect( layout_template ).to receive( :rdoc_options= ).with( @options )
243
+ expect( layout_template ).to receive( :rdoc_version= ).with( RDoc::VERSION )
244
+ expect( layout_template ).to receive( :sixfish_version= ).with( Sixfish.version_string )
245
+
246
+ return layout_template
247
+ end
248
+
249
+ end
250
+
@@ -0,0 +1,23 @@
1
+ # -*- ruby -*-
2
+ #encoding: utf-8
3
+
4
+ require 'helpers'
5
+ require 'rspec'
6
+ require 'sixfish'
7
+
8
+ describe Sixfish do
9
+
10
+ describe "version methods" do
11
+ it "returns a version string if asked" do
12
+ expect( described_class.version_string ).to match( /\w+ [\d.]+/ )
13
+ end
14
+
15
+
16
+ it "returns a version string with a build number if asked" do
17
+ expect( described_class.version_string(true) ).
18
+ to match( /\w+ [\d.]+ \(build [[:xdigit:]]+\)/ )
19
+ end
20
+ end
21
+
22
+ end
23
+
metadata ADDED
@@ -0,0 +1,265 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rdoc-generator-sixfish
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0.pre20180710102525
5
+ platform: ruby
6
+ authors:
7
+ - Michael Granger
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIEbDCCAtSgAwIBAgIBATANBgkqhkiG9w0BAQUFADA+MQwwCgYDVQQDDANnZWQx
14
+ GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
15
+ HhcNMTcwOTI3MDAzMDQ0WhcNMTgwOTI3MDAzMDQ0WjA+MQwwCgYDVQQDDANnZWQx
16
+ GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
17
+ ggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC/JWGRHO+USzR97vXjkFgt
18
+ 83qeNf2KHkcvrRTSnR64i6um/ziin0I0oX23H7VYrDJC9A/uoUa5nGRJS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ia7PfubcBThSIdz61eCb8gRi/RiZZwb3/7+eyEncLJzt2Ob9fGSF
35
+ X0qdrKi+2aZZ0NGuFj9AItBsVmAvkBGIpX4TEKQp5haEbPpmaqO5nIIhV26PXmyT
36
+ OMKv6pWsoS81vw5KAGBmfX8nht/Py90DQrbRvakATGI=
37
+ -----END CERTIFICATE-----
38
+ date: 2018-07-10 00:00:00.000000000 Z
39
+ dependencies:
40
+ - !ruby/object:Gem::Dependency
41
+ name: inversion
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '0.17'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '0.17'
54
+ - !ruby/object:Gem::Dependency
55
+ name: loggability
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '0.11'
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '0.11'
68
+ - !ruby/object:Gem::Dependency
69
+ name: yajl-ruby
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '1.2'
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '1.2'
82
+ - !ruby/object:Gem::Dependency
83
+ name: rdoc
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '6.0'
89
+ type: :runtime
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '6.0'
96
+ - !ruby/object:Gem::Dependency
97
+ name: hoe-deveiate
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '0.9'
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '0.9'
110
+ - !ruby/object:Gem::Dependency
111
+ name: hoe-mercurial
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '1.4'
117
+ type: :development
118
+ prerelease: false
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '1.4'
124
+ - !ruby/object:Gem::Dependency
125
+ name: hoe-highline
126
+ requirement: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '0.2'
131
+ type: :development
132
+ prerelease: false
133
+ version_requirements: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '0.2'
138
+ - !ruby/object:Gem::Dependency
139
+ name: uglifier
140
+ requirement: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '2.7'
145
+ type: :development
146
+ prerelease: false
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: '2.7'
152
+ - !ruby/object:Gem::Dependency
153
+ name: compass
154
+ requirement: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - "~>"
157
+ - !ruby/object:Gem::Version
158
+ version: '1.0'
159
+ type: :development
160
+ prerelease: false
161
+ version_requirements: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - "~>"
164
+ - !ruby/object:Gem::Version
165
+ version: '1.0'
166
+ - !ruby/object:Gem::Dependency
167
+ name: minitar
168
+ requirement: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - "~>"
171
+ - !ruby/object:Gem::Version
172
+ version: '0.5'
173
+ type: :development
174
+ prerelease: false
175
+ version_requirements: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - "~>"
178
+ - !ruby/object:Gem::Version
179
+ version: '0.5'
180
+ - !ruby/object:Gem::Dependency
181
+ name: hoe
182
+ requirement: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - "~>"
185
+ - !ruby/object:Gem::Version
186
+ version: '3.16'
187
+ type: :development
188
+ prerelease: false
189
+ version_requirements: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - "~>"
192
+ - !ruby/object:Gem::Version
193
+ version: '3.16'
194
+ description: |-
195
+ A(nother) HTML(5) generator for RDoc.
196
+
197
+ It uses the {Skeleton Responsive CSS Boilerplate}[http://getskeleton.com/] for
198
+ the layout stuff, doesn't take up valuable horizontal real estate space with
199
+ indexes and stuff, and has a QuickSilver-like incremental searching.
200
+ email:
201
+ - ged@FaerieMUD.org
202
+ executables: []
203
+ extensions: []
204
+ extra_rdoc_files:
205
+ - History.md
206
+ - Manifest.txt
207
+ - README.md
208
+ files:
209
+ - ".editorconfig"
210
+ - ".ruby-gemset"
211
+ - ".ruby-version"
212
+ - ChangeLog
213
+ - History.md
214
+ - Manifest.txt
215
+ - README.md
216
+ - data/rdoc-generator-sixfish/css/sixfish.css
217
+ - data/rdoc-generator-sixfish/css/sixfish.css.map
218
+ - data/rdoc-generator-sixfish/fa/light.js
219
+ - data/rdoc-generator-sixfish/fa/light.svg
220
+ - data/rdoc-generator-sixfish/fa/loader.js
221
+ - data/rdoc-generator-sixfish/fa/regular.js
222
+ - data/rdoc-generator-sixfish/fa/regular.svg
223
+ - data/rdoc-generator-sixfish/fa/solid.js
224
+ - data/rdoc-generator-sixfish/fa/solid.svg
225
+ - data/rdoc-generator-sixfish/images/glyphicons-28-search.png
226
+ - data/rdoc-generator-sixfish/js/jquery-3.1.1.js
227
+ - data/rdoc-generator-sixfish/js/sixfish.min.js
228
+ - data/rdoc-generator-sixfish/templates/class.tmpl
229
+ - data/rdoc-generator-sixfish/templates/file.tmpl
230
+ - data/rdoc-generator-sixfish/templates/index.tmpl
231
+ - data/rdoc-generator-sixfish/templates/layout.tmpl
232
+ - lib/rdoc/discover.rb
233
+ - lib/rdoc/generator/sixfish.rb
234
+ - lib/sixfish.rb
235
+ - spec/helpers.rb
236
+ - spec/rdoc/generator/sixfish_spec.rb
237
+ - spec/sixfish_spec.rb
238
+ homepage: https://bitbucket.org/ged/rdoc-generator-sixfish
239
+ licenses:
240
+ - BSD-3-Clause
241
+ - BSD-3-Clause
242
+ metadata: {}
243
+ post_install_message:
244
+ rdoc_options:
245
+ - "--main"
246
+ - README.md
247
+ require_paths:
248
+ - lib
249
+ required_ruby_version: !ruby/object:Gem::Requirement
250
+ requirements:
251
+ - - ">="
252
+ - !ruby/object:Gem::Version
253
+ version: '2.4'
254
+ required_rubygems_version: !ruby/object:Gem::Requirement
255
+ requirements:
256
+ - - ">"
257
+ - !ruby/object:Gem::Version
258
+ version: 1.3.1
259
+ requirements: []
260
+ rubyforge_project:
261
+ rubygems_version: 2.7.6
262
+ signing_key:
263
+ specification_version: 4
264
+ summary: A(nother) HTML(5) generator for RDoc
265
+ test_files: []