rdoc-generator-fivefish 0.1.0.pre.87 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b1c31edb8ff7f8f6979b5391984e439c9fa285a1
4
- data.tar.gz: a82da0842d0ca0c73593cab01fecf212f43a2d88
3
+ metadata.gz: bc91a5bf6d446d2540e1ed7d30c2aee31ef3d084
4
+ data.tar.gz: f2090ba8575abc8db0c59752ff33b31c46cac72f
5
5
  SHA512:
6
- metadata.gz: 1fc838df2a6111ff7c11fdda5b7ae803dec5b6cb73ccd5a793413c3b482c51ecc3faa1452e5aba2fbc85f1e8e8a199f2433a03ab869ef9fa14e8a012e3367df4
7
- data.tar.gz: 6b265b5dc435fbc5c88d695dd63daa3aa37f590fca4b80e51e9c55a50218cb89c508cadcc6a19ce3445aa3a7b1b7c3acda01e1189910e2bf03400d2c4e5cc5ee
6
+ metadata.gz: 739d3fabcb43e04dfcebead109d2d32bbd25a4a41b711a5fad4443d0aa929762fab4a6936f187e89580d5e028cdab7e50a743bf360a9a5e1b2f8ad5f61d2014a
7
+ data.tar.gz: 2e99d4359a00d5cf334ab28ad3624b1e77de55278626f953f70acff05dc86905ad1a9dfc337df1fd6508e3aa34c6b36ff28629cd14e50979a15d890400212aa6
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -24,3 +24,6 @@ data/rdoc-generator-fivefish/templates/layout.tmpl
24
24
  lib/fivefish.rb
25
25
  lib/rdoc/discover.rb
26
26
  lib/rdoc/generator/fivefish.rb
27
+ spec/fivefish_spec.rb
28
+ spec/helpers.rb
29
+ spec/rdoc/generator/fivefish_spec.rb
@@ -463,7 +463,7 @@ table [class*=span],.row-fluid table [class*=span]{display:table-cell;float:none
463
463
  .dropdown-menu .active>a,.dropdown-menu .active>a:hover{color:#ffffff;text-decoration:none;outline:0;background-color:#0088cc;background-color:#0081c2;background-image:-moz-linear-gradient(top, #0088cc, #0077b3);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));background-image:-webkit-linear-gradient(top, #0088cc, #0077b3);background-image:-o-linear-gradient(top, #0088cc, #0077b3);background-image:linear-gradient(to bottom, #0088cc, #0077b3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);}
464
464
  .dropdown-menu .disabled>a,.dropdown-menu .disabled>a:hover{color:#999999;}
465
465
  .dropdown-menu .disabled>a:hover{text-decoration:none;background-color:transparent;cursor:default;}
466
- .open{*z-index:1000;}.open >.dropdown-menu{display:block;}
466
+ .open{*z-index:1000;}.open>.dropdown-menu{display:block;}
467
467
  .pull-right>.dropdown-menu{right:0;left:auto;}
468
468
  .dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px solid #000000;content:"";}
469
469
  .dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px;}
@@ -263,7 +263,7 @@ class RDoc::Generator::Fivefish
263
263
  def copy_static_assets
264
264
  asset_paths = self.find_static_assets
265
265
 
266
- self.log.debug "Copying assets from paths:", *asset_paths
266
+ self.log.debug "Copying assets from paths: %s" % [ asset_paths.join(', ') ]
267
267
 
268
268
  asset_paths.each do |path|
269
269
 
@@ -0,0 +1,22 @@
1
+ # -*- ruby -*-
2
+ #encoding: utf-8
3
+
4
+ require 'helpers'
5
+ require 'rspec'
6
+ require 'fivefish'
7
+
8
+ describe Fivefish do
9
+
10
+ describe "version methods" do
11
+ it "returns a version string if asked" do
12
+ described_class.version_string.should =~ /\w+ [\d.]+/
13
+ end
14
+
15
+
16
+ it "returns a version string with a build number if asked" do
17
+ described_class.version_string(true).should =~ /\w+ [\d.]+ \(build [[:xdigit:]]+\)/
18
+ end
19
+ end
20
+
21
+ end
22
+
@@ -0,0 +1,42 @@
1
+ # -*- ruby -*-
2
+ #encoding: utf-8
3
+
4
+ # SimpleCov test coverage reporting; enable this using the :coverage rake task
5
+ if ENV['COVERAGE']
6
+ $stderr.puts "\n\n>>> Enabling coverage report.\n\n"
7
+ require 'simplecov'
8
+ SimpleCov.start do
9
+ add_filter 'spec'
10
+ add_group "Needing tests" do |file|
11
+ file.covered_percent < 90
12
+ end
13
+ end
14
+ end
15
+
16
+
17
+ require 'loggability'
18
+ require 'loggability/spechelpers'
19
+
20
+ require 'rspec'
21
+ require 'fivefish'
22
+
23
+ Loggability.format_with( :color ) if $stdout.tty?
24
+
25
+
26
+ ### RSpec helper functions.
27
+ module Fivefish::SpecHelpers
28
+
29
+
30
+ end
31
+
32
+
33
+ ### Mock with RSpec
34
+ RSpec.configure do |c|
35
+ c.mock_with( :rspec )
36
+
37
+ c.include( Loggability::SpecHelpers )
38
+ c.include( Fivefish::SpecHelpers )
39
+ end
40
+
41
+ # vim: set nosta noet ts=4 sw=4:
42
+
@@ -0,0 +1,246 @@
1
+ # -*- ruby -*-
2
+ #encoding: utf-8
3
+
4
+ require 'helpers'
5
+ require 'tmpdir'
6
+ require 'rspec'
7
+ require 'rdoc/generator/fivefish'
8
+
9
+ describe RDoc::Generator::Fivefish do
10
+
11
+ # Lots of the setup and the examples in this file are ported from
12
+ # the test_rdoc_generator_darkfish.rb file from RDoc itself.
13
+ # Used under the second option in the LICENSE.rdoc file:
14
+ # https://github.com/rdoc/rdoc/blob/master/LICENSE.rdoc
15
+
16
+ before( :all ) do
17
+ setup_logging()
18
+
19
+ @libdir = Pathname.pwd + 'lib'
20
+ @datadir = RDoc::Generator::Fivefish::DATADIR
21
+ @tmpdir = Pathname( Dir.tmpdir ) + "test_rdoc_generator_fivefish_#{$$}"
22
+ @opdir = @tmpdir + 'docs'
23
+ @storefile = @tmpdir + '.rdoc_store'
24
+
25
+ @options = RDoc::Options.new
26
+ @options.option_parser = OptionParser.new
27
+
28
+ @options.op_dir = @opdir.to_s
29
+ @options.generator = described_class
30
+ @options.template_dir = @datadir.to_s
31
+
32
+ @tmpdir.mkpath
33
+ @store = RDoc::Store.new( @storefile.to_s )
34
+ @store.load_cache
35
+
36
+ $stderr.puts "Tmpdir is: %s" % [@tmpdir] if ENV['FIVEFISH_DEVELMODE']
37
+ end
38
+
39
+ before( :each ) do
40
+ @generator = described_class.new( @store, @options )
41
+
42
+ @rdoc = RDoc::RDoc.new
43
+ @rdoc.options = @options
44
+ @rdoc.store = @store
45
+ @rdoc.generator = @generator
46
+
47
+ @top_level, @readme = add_code_objects( @store )
48
+ end
49
+
50
+ around( :each ) do |example|
51
+ @opdir.mkpath
52
+ Dir.chdir( @opdir ) { example.run }
53
+ @opdir.rmtree unless ENV['FIVEFISH_DEVELMODE']
54
+ end
55
+
56
+
57
+ #
58
+ # Examples
59
+ #
60
+
61
+ it "registers itself as a generator" do
62
+ RDoc::RDoc::GENERATORS.include?( described_class )
63
+ end
64
+
65
+ it "configures Inversion to load templates from its data directory" do
66
+ Inversion::Template.template_paths.should == [ @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( 'fivefish' )
74
+ @options.option_parser.to_a.join.should 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 = mock( "index template" )
91
+ Inversion::Template.stub( :load ).with( 'index.tmpl', encoding: 'utf-8' ).
92
+ and_return( index_template )
93
+
94
+ index_template.should_receive( :dup ).and_return( index_template )
95
+ index_template.should_receive( :mainpage= ).with( @readme )
96
+ index_template.should_receive( :synopsis= ).
97
+ with( %{<h1 id="label-Testing+README">Testing <a href="README_md} +
98
+ %{.html">README</a><span><a href="#label-Testing+README">} +
99
+ %{&para;</a> <a href="#documentation">&uarr;</a></span></h1>} +
100
+ %{<p>This is a readme for testing.</p>} )
101
+
102
+ layout_template.should_receive( :contents= ).with( index_template )
103
+ layout_template.should_receive( :pageclass= ).with( 'index-page' )
104
+ layout_template.should_receive( :rel_prefix= ).with( Pathname('.') )
105
+
106
+ layout_template.should_receive( :render ).and_return( 'Index page!' )
107
+
108
+ @generator.generate_index_page
109
+ end
110
+
111
+
112
+ it "combines a class template with the layout template to make class pages" do
113
+ classes = @store.all_classes_and_modules
114
+
115
+ layout_template = get_fixtured_layout_template_mock()
116
+
117
+ class_template = mock( "class template" )
118
+ Inversion::Template.stub( :load ).with( 'class.tmpl', encoding: 'utf-8' ).
119
+ and_return( class_template )
120
+ class_template.should_receive( :dup ).and_return( class_template )
121
+
122
+ classes.each do |klass|
123
+ class_template.should_receive( :klass= ).with( klass )
124
+ end
125
+
126
+ layout_template.should_receive( :contents= ).with( class_template ).
127
+ exactly( classes.length ).times
128
+ layout_template.should_receive( :pageclass= ).with( 'class-page' ).
129
+ exactly( classes.length ).times
130
+ layout_template.should_receive( :rel_prefix= ).with( Pathname('.') ).
131
+ exactly( classes.length ).times
132
+
133
+ layout_template.should_receive( :render ).
134
+ and_return( *classes.map {|k| "#{k.name} class page!"} )
135
+
136
+ @generator.generate_class_files
137
+ end
138
+
139
+
140
+ it "combines a file template with the layout template to make file pages" do
141
+ files = @store.all_files
142
+
143
+ layout_template = get_fixtured_layout_template_mock()
144
+
145
+ file_template = mock( "file template" )
146
+ Inversion::Template.stub( :load ).with( 'file.tmpl', encoding: 'utf-8' ).
147
+ and_return( file_template )
148
+ file_template.should_receive( :dup ).and_return( file_template )
149
+ file_template.should_receive( :header= ).
150
+ with( %{<h1 id="label-Testing+README">Testing <a href="README_md} +
151
+ %{.html">README</a><span><a href="#label-Testing+README">} +
152
+ %{&para;</a> <a href="#documentation">&uarr;</a></span></h1>} )
153
+ file_template.should_receive( :description= ).
154
+ with( %{\n<p>This is a readme for testing.</p>\n\n<p>It has some more} +
155
+ %{ stuff</p>\n\n<p>And even more stuff.</p>\n} )
156
+
157
+ file_template.should_receive( :file= ).with( @readme )
158
+
159
+ layout_template.should_receive( :contents= ).with( file_template ).once
160
+ layout_template.should_receive( :pageclass= ).with( 'file-page' )
161
+ layout_template.should_receive( :rel_prefix= ).with( Pathname('.') )
162
+ layout_template.should_receive( :render ).and_return( "README file page!" )
163
+
164
+ @generator.generate_file_files
165
+ end
166
+
167
+ end
168
+
169
+
170
+
171
+ #
172
+ # Helpers
173
+ #
174
+
175
+ def any_method( name, comment=nil )
176
+ return RDoc::AnyMethod.new( comment, name )
177
+ end
178
+
179
+
180
+ def add_code_objects( store )
181
+ top_level = store.add_file( 'file.rb' )
182
+ top_level.parser = RDoc::Parser::Ruby
183
+
184
+ # Klass
185
+ klass = top_level.add_class( RDoc::NormalClass, 'Klass' )
186
+
187
+ # Klass::A
188
+ alias_constant = RDoc::Constant.new( 'A', nil, '' )
189
+ alias_constant.record_location( top_level )
190
+ top_level.add_constant( alias_constant )
191
+
192
+ # ::A = ::Klass (?)
193
+ klass.add_module_alias( klass, 'A', top_level )
194
+
195
+ # Klass#method
196
+ meth = RDoc::AnyMethod.new( nil, 'method' )
197
+ klass.add_method( meth )
198
+
199
+ # Klass#method!
200
+ meth_bang = RDoc::AnyMethod.new( nil, 'method!' )
201
+ klass.add_method( meth_bang )
202
+
203
+ # attr_accessor :name
204
+ name_attr = RDoc::Attr.new( nil, 'name', 'RW', '' )
205
+ klass.add_attribute( name_attr )
206
+
207
+ # Ignored class ::Ignored
208
+ ignored = top_level.add_class( RDoc::NormalClass, 'Ignored' )
209
+ ignored.ignore
210
+
211
+ readme = store.add_file( 'README.md' )
212
+ readme.parser = RDoc::Parser::Markdown
213
+ readme.comment = "= Testing README\n\nThis is a readme for testing.\n\n" +
214
+ "It has some more stuff\n\nAnd even more stuff.\n\n"
215
+
216
+ store.complete :private
217
+
218
+ return top_level, readme
219
+ end
220
+
221
+
222
+ def get_fixtured_layout_template_mock
223
+ layout_template = mock( "layout template" )
224
+ Inversion::Template.stub( :load ).with( 'layout.tmpl', encoding: 'utf-8' ).
225
+ and_return( layout_template )
226
+
227
+ # Work around caching
228
+ layout_template.should_receive( :dup ).and_return( layout_template )
229
+
230
+ layout_template.should_receive( :files= ).with( [@readme, @top_level] )
231
+ layout_template.should_receive( :classes= ).
232
+ with( @store.all_classes_and_modules.sort )
233
+ layout_template.should_receive( :methods= ).
234
+ with( @store.all_classes_and_modules.flat_map(&:method_list).sort )
235
+ layout_template.should_receive( :modsort= ).with do |sorted_mods|
236
+ sorted_mods.should include( @store.find_class_named('Klass') )
237
+ end
238
+ layout_template.should_receive( :rdoc_options= ).with( @options )
239
+ layout_template.should_receive( :rdoc_version= ).with( RDoc::VERSION )
240
+ layout_template.should_receive( :fivefish_version= ).with( Fivefish.version_string )
241
+
242
+ return layout_template
243
+ end
244
+
245
+ end
246
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdoc-generator-fivefish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre.87
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Granger
@@ -30,7 +30,7 @@ cert_chain:
30
30
  6mKCwjpegytE0oifXfF8k75A9105cBnNiMZOe1tXiqYc/exCgWvbggurzDOcRkZu
31
31
  /YSusaiDXHKU2O3Akc3htA==
32
32
  -----END CERTIFICATE-----
33
- date: 2013-03-25 00:00:00.000000000 Z
33
+ date: 2013-03-26 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: inversion
@@ -213,6 +213,9 @@ files:
213
213
  - lib/fivefish.rb
214
214
  - lib/rdoc/discover.rb
215
215
  - lib/rdoc/generator/fivefish.rb
216
+ - spec/fivefish_spec.rb
217
+ - spec/helpers.rb
218
+ - spec/rdoc/generator/fivefish_spec.rb
216
219
  - .gemtest
217
220
  homepage: http://deveiate.org/fivefish.html
218
221
  licenses:
metadata.gz.sig CHANGED
Binary file