emerald 0.0.1.alpha2 → 0.0.1.alpha3

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1-alpha2
1
+ 0.0.1-alpha3
@@ -4,10 +4,11 @@
4
4
  <% else %>
5
5
  <h1 class="classmodule"><span class="leader">Class</span> <%= classmod.full_name %></h1>
6
6
  <p class="superclass">
7
- <% if classmod.superclass.kind_of?(String) %>
8
- Parent: <%= classmod.superclass %>
7
+ <% klass = classmod.superclass %>
8
+ <% if klass.kind_of?(String) %>
9
+ Parent: <%= klass %>
9
10
  <% else %>
10
- Parent: <a href="<%= root_path + rdocize_classmod(classmod.superclass) %>"><%= classmod.superclass.full_name %></a>
11
+ Parent: <a href="<%= root_path + rdocize_classmod(klass) %>"><%= klass.full_name %></a>
11
12
  <% end %>
12
13
  </p>
13
14
  <% end %>
@@ -34,7 +35,7 @@
34
35
  <% unless classmod.includes.empty? %>
35
36
  <h2 id="includes">Includes</h2>
36
37
  <ul>
37
- <% classmod.includes.sort_by(&:name).each do |inc| %>
38
+ <% classmod.includes.each do |inc| %>
38
39
  <li>
39
40
  <% result = inc.module %>
40
41
  <% if result.kind_of?(String) %>
@@ -52,8 +53,8 @@
52
53
  <h2 id="constants">Constants</h2>
53
54
  <table class="constants">
54
55
  <tr><th>Name</th><th>Value</th><th>Description</th></tr>
55
- <% classmod.constants.each do |const| %>
56
- <% abbrev_value = const.value.chars.count > 20 ? const.value.chars.first(20).join + "..." : const.value %>
56
+ <% classmod.constants.sort_by(&:name).each do |const| %>
57
+ <% abbrev_value = const.value.chars.count > 20 ? "#{const.value.chars.first(20).join}..." : const.value %>
57
58
  <tr><td><%= const.name %></td><td style="font-family: monospace"><%= abbrev_value %></td><td><%= const.description %></td></tr>
58
59
  <% end %>
59
60
  </table>
@@ -63,7 +64,7 @@
63
64
  <% unless classmod.attributes.empty? %>
64
65
  <h2 id="attributes">Attributes</h2>
65
66
  <ul class="attribute-list">
66
- <% classmod.attributes.sort_by(&:name).each do |attr| %>
67
+ <% classmod.attributes.each do |attr| %>
67
68
  <li><strong><%= "#{attr.name}<sup>[#{attr.rw}]</sup>" %></strong><br/><%= attr.description %></li>
68
69
  <% end %>
69
70
  </ul>
@@ -79,7 +80,7 @@
79
80
 
80
81
  <h2 id="<%= "#{visibility}-#{type}-methods" %>"><%= "#{visibility.capitalize} #{type.capitalize} Methods" %></h2>
81
82
 
82
- <% methods_by_type[type][visibility].sort_by(&:name).each do |method| %>
83
+ <% methods_by_type[type][visibility].each do |method| %>
83
84
  <div class="method <%= "#{visibility}-#{type}" %>" id="<%= method.aref %>">
84
85
  <div class="header">
85
86
  <%= method.arglists.gsub("\n", "<br/>") %>
@@ -79,22 +79,6 @@ class RDoc::Generator::Emerald
79
79
  options.extend(RDoc::Generator::Emerald::Options)
80
80
  end
81
81
 
82
- class << self
83
-
84
- protected
85
-
86
- # Protected foo.
87
- def foo
88
- end
89
-
90
- private
91
-
92
- # Private bar.
93
- def bar
94
- end
95
-
96
- end
97
-
98
82
  # Instanciates this generator. Automatically called
99
83
  # by RDoc.
100
84
  # ==Parameter
@@ -105,7 +89,15 @@ class RDoc::Generator::Emerald
105
89
  @op_dir = Pathname.pwd.expand_path + @options.op_dir
106
90
  end
107
91
 
92
+ # Outputs a string on standard output, but only if RDoc
93
+ # was invoked with the <tt>--debug</tt> switch.
94
+ def debug(str)
95
+ puts(str) if $DEBUG_RDOC
96
+ end
97
+
98
+ # Main hook method called by RDoc, triggers the generation process.
108
99
  def generate(top_levels)
100
+ debug "Sorting classes, modules, and methods..."
109
101
  @toplevels = top_levels
110
102
  @classes_and_modules = RDoc::TopLevel.all_classes_and_modules.sort_by{|klass| klass.full_name}
111
103
  @methods = @classes_and_modules.map{|mod| mod.method_list}.flatten.sort
@@ -184,12 +176,13 @@ class RDoc::Generator::Emerald
184
176
  # done by RDoc’s crossref-HTML formatter are honoured. Note you
185
177
  # have to prepend #root_path to get a complete href.
186
178
  def rdocize_classmod(classmod)
187
- Pathname.new(classmod.full_name.split("::").join("/") + ".html")
179
+ Pathname.new("#{classmod.full_name.split("::").join("/")}.html")
188
180
  end
189
181
 
190
182
  private
191
183
 
192
184
  def copy_base_files
185
+ debug "Copying base base files..."
193
186
  mkdir @op_dir + "stylesheets" unless File.directory?(@op_dir + "stylesheets")
194
187
 
195
188
  cp Dir[DATA_DIR + "stylesheets" + "*.css"], @op_dir + "stylesheets"
@@ -199,6 +192,8 @@ class RDoc::Generator::Emerald
199
192
 
200
193
  def evaluate_toplevels
201
194
  @toplevels.each do |toplevel|
195
+ debug "Processing toplevel #{toplevel.name}..."
196
+
202
197
  root_path("../" * (toplevel.relative_name.split("/").count - 1)) # Last component is a filename
203
198
  title toplevel.relative_name
204
199
 
@@ -208,12 +203,15 @@ class RDoc::Generator::Emerald
208
203
 
209
204
  # Evaluate the actual file documentation
210
205
  File.open(path, "w") do |file|
206
+ debug " => #{path}"
211
207
  file.write(render(:toplevel, binding))
212
208
  end
213
209
 
214
210
  # If this toplevel is supposed to be the main file,
215
211
  # copy it’s content to the index.html file.
216
212
  if toplevel.relative_name == @options.main_page
213
+ debug " => This is the main page. Writing index.html."
214
+
217
215
  root_path "./" # We *are* at the top here
218
216
 
219
217
  File.open(@op_dir + "index.html", "w") do |file|
@@ -225,6 +223,7 @@ class RDoc::Generator::Emerald
225
223
 
226
224
  def evaluate_classes_and_modules
227
225
  @classes_and_modules.each do |classmod|
226
+ debug "Processing class/module #{classmod.full_name} (#{classmod.method_list.count} methods)..."
228
227
 
229
228
  path = @op_dir + rdocize_classmod(classmod)
230
229
 
@@ -234,6 +233,7 @@ class RDoc::Generator::Emerald
234
233
 
235
234
 
236
235
  File.open(path, "w") do |file|
236
+ debug " => #{path}"
237
237
  file.write(render(:classmodule, binding))
238
238
  end
239
239
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emerald
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.alpha2
4
+ version: 0.0.1.alpha3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-18 00:00:00.000000000 Z
12
+ date: 2012-08-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdoc
@@ -54,27 +54,27 @@ email: quintus@quintilianus.eu
54
54
  executables: []
55
55
  extensions: []
56
56
  extra_rdoc_files:
57
- - COPYING.rdoc
58
- - LEGAL.rdoc
59
- - CHANGELOG.rdoc
60
57
  - README.rdoc
58
+ - CHANGELOG.rdoc
59
+ - LEGAL.rdoc
60
+ - COPYING.rdoc
61
61
  files:
62
- - lib/rdoc/discover.rb
63
- - lib/rdoc/generator/emerald/options.rb
64
62
  - lib/rdoc/generator/emerald.rb
65
- - COPYING.rdoc
66
- - LEGAL.rdoc
67
- - CHANGELOG.rdoc
63
+ - lib/rdoc/generator/emerald/options.rb
64
+ - lib/rdoc/discover.rb
68
65
  - README.rdoc
66
+ - CHANGELOG.rdoc
67
+ - LEGAL.rdoc
68
+ - COPYING.rdoc
69
69
  - data/stylesheets/rdoc.css
70
- - data/javascripts/toc.js
71
70
  - data/javascripts/jquery.js
71
+ - data/javascripts/toc.js
72
72
  - data/javascripts/emerald.js
73
73
  - data/images/zoom.png
74
74
  - data/images/tag_blue.png
75
- - data/templates/layout.html.erb
76
- - data/templates/classmodule.html.erb
77
75
  - data/templates/toplevel.html.erb
76
+ - data/templates/classmodule.html.erb
77
+ - data/templates/layout.html.erb
78
78
  - VERSION
79
79
  homepage: https://github.com/Quintus/emerald
80
80
  licenses: []