horo 1.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,23 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'autotest/restart'
4
+
5
+ # Autotest.add_hook :initialize do |at|
6
+ # at.extra_files << "../some/external/dependency.rb"
7
+ #
8
+ # at.libs << ":../some/external"
9
+ #
10
+ # at.add_exception 'vendor'
11
+ #
12
+ # at.add_mapping(/dependency.rb/) do |f, _|
13
+ # at.files_matching(/test_.*rb$/)
14
+ # end
15
+ #
16
+ # %w(TestA TestB).each do |klass|
17
+ # at.extra_class_map[klass] = "test/test_misc.rb"
18
+ # end
19
+ # end
20
+
21
+ # Autotest.add_hook :run_command do |at|
22
+ # system "rake build"
23
+ # end
@@ -0,0 +1,6 @@
1
+ === 1.0.0 / 2010-07-13
2
+
3
+ * 1 major enhancement
4
+
5
+ * Birthday!
6
+
@@ -0,0 +1,17 @@
1
+ .autotest
2
+ CHANGELOG.rdoc
3
+ Manifest.txt
4
+ README.rdoc
5
+ Rakefile
6
+ lib/app/views/classes/index.html.erb
7
+ lib/app/views/classes/show.html.erb
8
+ lib/app/views/files/index.html.erb
9
+ lib/app/views/files/show.html.erb
10
+ lib/app/views/layouts/application.html.erb
11
+ lib/app/views/methods/index.html.erb
12
+ lib/app/views/root/index.html.erb
13
+ lib/horo.rb
14
+ lib/public/rdoc-style.css
15
+ lib/rdoc/discover.rb
16
+ lib/rdoc/generator/horo.rb
17
+ test/test_horo.rb
@@ -0,0 +1,49 @@
1
+ = horo
2
+
3
+ * http://github.com/tenderlove/horo
4
+
5
+ == DESCRIPTION:
6
+
7
+ An RDoc template extracted from Ruby on Rails. Provides the same documetation
8
+ style and format used for Ruby on Rails API documentation.
9
+
10
+ == FEATURES/PROBLEMS:
11
+
12
+ * Not done yet
13
+
14
+ == SYNOPSIS:
15
+
16
+ FIX (code sample of usage)
17
+
18
+ == REQUIREMENTS:
19
+
20
+ * FIX (list of requirements)
21
+
22
+ == INSTALL:
23
+
24
+ * gem install horo
25
+
26
+ == LICENSE:
27
+
28
+ (The MIT License)
29
+
30
+ Copyright (c) 2010 Aaron Patterson
31
+
32
+ Permission is hereby granted, free of charge, to any person obtaining
33
+ a copy of this software and associated documentation files (the
34
+ 'Software'), to deal in the Software without restriction, including
35
+ without limitation the rights to use, copy, modify, merge, publish,
36
+ distribute, sublicense, and/or sell copies of the Software, and to
37
+ permit persons to whom the Software is furnished to do so, subject to
38
+ the following conditions:
39
+
40
+ The above copyright notice and this permission notice shall be
41
+ included in all copies or substantial portions of the Software.
42
+
43
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
44
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
45
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
46
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
47
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
48
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
49
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,14 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+
6
+ Hoe.spec 'horo' do
7
+ developer('Aaron Patterson', 'aaron@tenderlovemaking.com')
8
+ self.readme_file = 'README.rdoc'
9
+ self.history_file = 'CHANGELOG.rdoc'
10
+ self.extra_rdoc_files = FileList['*.rdoc']
11
+ self.extra_dev_deps << ['nokogiri', '>= 1.4.2']
12
+ end
13
+
14
+ # vim: syntax=ruby
@@ -0,0 +1,49 @@
1
+ <?xml version="1.0" encoding="<%= charset %>"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+ <html>
6
+ <head>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=<%= charset %>" />
8
+ <title>Index</title>
9
+ <style type="text/css">
10
+ <!--
11
+ body {
12
+ background-color: #EEE;
13
+ font-family: "Bitstream Vera Sans", Verdana, Arial, Helvetica, sans-serif;
14
+ color: #000;
15
+ margin: 0px;
16
+ }
17
+ .banner {
18
+ background: #005;
19
+ color: #FFF;
20
+ padding: 0.2em;
21
+ font-size: small;
22
+ font-weight: bold;
23
+ text-align: center;
24
+ }
25
+ .entries {
26
+ margin: 0.25em 1em 0 1em;
27
+ font-size: x-small;
28
+ }
29
+ a {
30
+ color: #00F;
31
+ text-decoration: none;
32
+ white-space: nowrap;
33
+ }
34
+ a:hover {
35
+ color: #77F;
36
+ text-decoration: underline;
37
+ }
38
+ -->
39
+ </style>
40
+ <base target="docwin" />
41
+ </head>
42
+ <body>
43
+ <div class="banner"><%= list_title %></div>
44
+ <div class="entries">
45
+ <% files.sort_by { |x| x.full_name }.each do |entrie| %>
46
+ <a href="<%= entrie.path %>"><%= entrie.full_name %></a><br />
47
+ <% end %>
48
+ </div>
49
+ </body></html>
@@ -0,0 +1,181 @@
1
+ <table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
2
+ <td class="file-title"><span class="file-title-prefix"><%= klass.module? ? 'Module' : 'Class' %></span><br /><%= klass.full_name %></td>
3
+ <td align="right">
4
+ <table cellspacing="0" cellpadding="2">
5
+ <tr valign="top">
6
+ <td>In:</td>
7
+ <td>
8
+ <% klass.in_files.each do |infile| %>
9
+ <%= link_to infile.absolute_name, File.join(relative_prefix, infile.path) %>:
10
+ <% end %>
11
+ </td>
12
+ </tr>
13
+ <% if klass.type == 'class' %>
14
+ <tr>
15
+ <td>Parent:</td>
16
+ <td>
17
+
18
+ <% if String === klass.superclass %>
19
+ <%= klass.superclass %>
20
+ <% else %>
21
+ <%= link_to klass.superclass.full_name, klass.aref_to(klass.superclass.path) %>
22
+ <% end %>
23
+ </td>
24
+ </tr>
25
+ <% end %>
26
+ </table>
27
+ </td>
28
+ </tr>
29
+ </table>
30
+ <div id="bodyContent">
31
+ <div id="content">
32
+ <% if klass.diagram %>
33
+ <table cellpadding='0' cellspacing='0' border='0' width="100%"><tr><td align="center">
34
+ <%= klass.diagram %>
35
+ </td></tr></table>
36
+ <% end %>
37
+
38
+ <% if klass.description %>
39
+ <div class="description"><%= klass.description %></div>
40
+ <% end %>
41
+
42
+ <% unless klass.requires.empty? %>
43
+ <div class="sectiontitle">Required Files</div>
44
+ <ul>
45
+ <% klass.requires.each do |require| %>
46
+ <li><%= link_to require.name, require.aref %>:</li>
47
+ <% end %>
48
+ </ul>
49
+ <% end %>
50
+
51
+ <% unless klass.methods.empty? %>
52
+ <div class="sectiontitle">Methods</div>
53
+ <ul>
54
+ <% klass.method_list.sort_by { |x| x.name }.each do |method| %>
55
+ <% next if method.is_alias_for %>
56
+ <li><%= link_to method.name, "##{method.aref}" %></li>
57
+ <% end %>
58
+ </ul>
59
+ <% end %>
60
+
61
+ <% unless klass.includes.empty? %>
62
+ <div class="sectiontitle">Included Modules</div>
63
+ <ul>
64
+ <% klass.each_include do |include| %>
65
+ <li>
66
+ <% if String === include.module %>
67
+ <%= include.module %>
68
+ <% else %>
69
+ <%= link_to include.module.full_name, klass.aref_to(include.module.path) %>
70
+ <% end %>
71
+ </li>
72
+ <% end %>
73
+ </ul>
74
+ <% end %>
75
+
76
+ <% unless klass.constants.empty? %>
77
+ <div class="sectiontitle">Constants</div>
78
+ <table border='0' cellpadding='5'>
79
+ <% klass.each_constant do |constant| %>
80
+ <tr valign='top'>
81
+ <td class="attr-name"><%= constant.name %></td>
82
+ <td>=</td>
83
+ <td class="attr-value"><%= constant.value %></td>
84
+ </tr>
85
+ <% unless constant.comment.empty? %>
86
+ <tr valign='top'>
87
+ <td>&nbsp;</td>
88
+ <td colspan="2" class="attr-desc"><%= constant.comment.strip %></td>
89
+ </tr>
90
+ <% end %>
91
+ <% end %>
92
+ </table>
93
+ <% end %>
94
+
95
+ <% unless klass.attributes.empty? %>
96
+ <div class="sectiontitle">Attributes</div>
97
+ <table border='0' cellpadding='5'>
98
+ <% klass.each_attribute do |attribute| %>
99
+ <tr valign='top'>
100
+ <td class='attr-rw'>
101
+ <% if attribute.rw %>
102
+ [<%= attribute.rw %>]
103
+ <% end %>
104
+ </td>
105
+ <td class='attr-name'><%= attribute.name %></td>
106
+ <td class='attr-desc'>
107
+ <% if attribute.comment %>
108
+ <%= attribute.comment.strip %>
109
+ <% else %>
110
+ (Not documented)
111
+ <% end %>
112
+ </td>
113
+ </tr>
114
+ <% end %>
115
+ </table>
116
+ <% end %>
117
+
118
+ <% klass.methods_by_type.each do |type, visibilities| %>
119
+ <% next if visibilities.empty? %>
120
+ <% visibilities.each do |visibility, methods| %>
121
+ <% next if methods.empty? %>
122
+
123
+ <div class="sectiontitle">
124
+ <%= visibility.to_s.capitalize %>
125
+ <%= type.capitalize %>
126
+ methods
127
+ </div>
128
+
129
+ <% methods.each do |method| %>
130
+ <% next if method.is_alias_for %>
131
+
132
+ <div class="method">
133
+ <div class="title">
134
+ <% if method.call_seq %>
135
+ <a name="<%= method.aref %>"></a>
136
+ <b><%= method.call_seq.strip.gsub(/->/, '&rarr;').gsub( /^\w.+\./m, '') %></b>
137
+ <% else %>
138
+ <a name="<%= method.aref %>"></a>
139
+ <b><%= method.name %></b><%= method.params %>
140
+ <% end %>
141
+
142
+ </div>
143
+
144
+ <% if method.comment %>
145
+ <div class="description">
146
+ <%= method.comment.strip %>
147
+ </div>
148
+ <% end %>
149
+
150
+ <% unless method.aliases.empty? %>
151
+ <div class="aka">
152
+ This method is also aliased as
153
+ <% method.aliases.each do |aka| %>
154
+ <%= link_to aka.name, klass.aref_to(aka.path) %>
155
+ <% end %>
156
+ </div>
157
+ <% end %>
158
+
159
+ <% if method.token_stream %>
160
+ <div class="sourcecode">
161
+ <p class="source-link">[
162
+ <a href="javascript:toggleSource('<%= method.html_name %>_source')"
163
+ id="l_<%= method.aref %>_source">
164
+ show source
165
+ </a> ]</p>
166
+ <div class="dyn-source"
167
+ id="<%= method.html_name %>_source">
168
+ <pre>
169
+ <%= method.markup_code %>
170
+ </pre>
171
+ </div>
172
+ </div>
173
+ <% end %>
174
+
175
+ </div>
176
+
177
+ <% end %>
178
+ <% end %>
179
+ <% end %>
180
+ </div>
181
+ </div>
@@ -0,0 +1,49 @@
1
+ <?xml version="1.0" encoding="<%= charset %>"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+ <html>
6
+ <head>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=<%= charset %>" />
8
+ <title>Index</title>
9
+ <style type="text/css">
10
+ <!--
11
+ body {
12
+ background-color: #EEE;
13
+ font-family: "Bitstream Vera Sans", Verdana, Arial, Helvetica, sans-serif;
14
+ color: #000;
15
+ margin: 0px;
16
+ }
17
+ .banner {
18
+ background: #005;
19
+ color: #FFF;
20
+ padding: 0.2em;
21
+ font-size: small;
22
+ font-weight: bold;
23
+ text-align: center;
24
+ }
25
+ .entries {
26
+ margin: 0.25em 1em 0 1em;
27
+ font-size: x-small;
28
+ }
29
+ a {
30
+ color: #00F;
31
+ text-decoration: none;
32
+ white-space: nowrap;
33
+ }
34
+ a:hover {
35
+ color: #77F;
36
+ text-decoration: underline;
37
+ }
38
+ -->
39
+ </style>
40
+ <base target="docwin" />
41
+ </head>
42
+ <body>
43
+ <div class="banner"><%= list_title %></div>
44
+ <div class="entries">
45
+ <% files.sort_by { |x| x.base_name }.each do |entrie| %>
46
+ <a href="<%= entrie.path %>"><%= entrie.absolute_name %></a><br />
47
+ <% end %>
48
+ </div>
49
+ </body></html>
@@ -0,0 +1,27 @@
1
+ <table border='0' cellpadding='0' cellspacing='0' width="100%" class='banner'>
2
+ <tr><td>
3
+ <table width="100%" border='0' cellpadding='0' cellspacing='0'><tr>
4
+ <td class="file-title" colspan="2"><span class="file-title-prefix">File</span><br /><%= file.base_name %></td>
5
+ <td align="right">
6
+ <table border='0' cellspacing="0" cellpadding="2">
7
+ <tr>
8
+ <td>Path:</td>
9
+ <td><%= file.absolute_name %>
10
+ </td>
11
+ </tr>
12
+ <tr>
13
+ <td>Modified:</td>
14
+ <td><%= file.last_modified %></td>
15
+ </tr>
16
+ </table>
17
+ </td></tr>
18
+ </table>
19
+ </td></tr>
20
+ </table><br />
21
+ <div id="bodyContent">
22
+ <div id="content">
23
+ <% if file.description %>
24
+ <div class="description"><%= file.description %></div>
25
+ <% end %>
26
+ </div>
27
+ </div>
@@ -0,0 +1,55 @@
1
+ <?xml version="1.0" encoding="<%= charset %>"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+ <html>
6
+ <head>
7
+ <title><%= title %></title>
8
+ <meta http-equiv="Content-Type" content="text/html; charset=<%= charset %>" />
9
+ <link rel="stylesheet" href="<%= style_url %>" type="text/css" media="screen" />
10
+
11
+ <script language="JavaScript" type="text/javascript">
12
+ // <![CDATA[
13
+
14
+ function toggleSource( id )
15
+ {
16
+ var elem
17
+ var link
18
+
19
+ if( document.getElementById )
20
+ {
21
+ elem = document.getElementById( id )
22
+ link = document.getElementById( "l_" + id )
23
+ }
24
+ else if ( document.all )
25
+ {
26
+ elem = eval( "document.all." + id )
27
+ link = eval( "document.all.l_" + id )
28
+ }
29
+ else
30
+ return false;
31
+
32
+ if( elem.style.display == "block" )
33
+ {
34
+ elem.style.display = "none"
35
+ link.innerHTML = "show source"
36
+ }
37
+ else
38
+ {
39
+ elem.style.display = "block"
40
+ link.innerHTML = "hide source"
41
+ }
42
+ }
43
+
44
+ function openCode( url )
45
+ {
46
+ window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
47
+ }
48
+ // ]]>
49
+ </script>
50
+ </head>
51
+
52
+ <body>
53
+ <%= yield %>
54
+ </body>
55
+ </html>
@@ -0,0 +1,52 @@
1
+ <?xml version="1.0" encoding="<%= charset %>"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+ <html>
6
+ <head>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=<%= charset %>" />
8
+ <title>Index</title>
9
+ <style type="text/css">
10
+ <!--
11
+ body {
12
+ background-color: #EEE;
13
+ font-family: "Bitstream Vera Sans", Verdana, Arial, Helvetica, sans-serif;
14
+ color: #000;
15
+ margin: 0px;
16
+ }
17
+ .banner {
18
+ background: #005;
19
+ color: #FFF;
20
+ padding: 0.2em;
21
+ font-size: small;
22
+ font-weight: bold;
23
+ text-align: center;
24
+ }
25
+ .entries {
26
+ margin: 0.25em 1em 0 1em;
27
+ font-size: x-small;
28
+ }
29
+ a {
30
+ color: #00F;
31
+ text-decoration: none;
32
+ white-space: nowrap;
33
+ }
34
+ a:hover {
35
+ color: #77F;
36
+ text-decoration: underline;
37
+ }
38
+ -->
39
+ </style>
40
+ <base target="docwin" />
41
+ </head>
42
+ <body>
43
+ <div class="banner"><%= list_title %></div>
44
+ <div class="entries">
45
+ <% files.sort_by { |x| x.name }.each do |entrie| %>
46
+ <a href="<%= entrie.path %>">
47
+ <%= entrie.name %>
48
+ (<%= entrie.parent ? entrie.parent.full_name : 'unknown' %>)
49
+ </a><br />
50
+ <% end %>
51
+ </div>
52
+ </body></html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html
2
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <title><%= title %></title>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=<%= charset %>" />
8
+ </head>
9
+
10
+ <frameset cols="20%,*">
11
+ <frameset rows="15%,55%,30%">
12
+ <frame src="fr_file_index.html" title="Files" name="Files" />
13
+ <frame src="fr_class_index.html" name="Classes" />
14
+ <frame src="fr_method_index.html" name="Methods" />
15
+ </frameset>
16
+ <frame src="<%= main_page.path %>" name="docwin" />
17
+ <noframes>
18
+ <body bgcolor="white">
19
+ Click <a href="html/index.html">here</a> for a non-frames
20
+ version of this page.
21
+ </body>
22
+ </noframes>
23
+ </frameset>
24
+
25
+ </html>
@@ -0,0 +1,3 @@
1
+ module Horo
2
+ VERSION = '1.0.0.beta.1'
3
+ end
@@ -0,0 +1,187 @@
1
+ a {
2
+ color: #00F;
3
+ text-decoration: none;
4
+ }
5
+
6
+ a:hover {
7
+ color: #77F;
8
+ text-decoration: underline;
9
+ }
10
+
11
+ body, td, p {
12
+ font-family: "Bitstream Vera Sans", Verdana, Arial, Helvetica, sans-serif;
13
+ background: #FFF;
14
+ color: #000;
15
+ margin: 0px;
16
+ font-size: small;
17
+ }
18
+
19
+ p {
20
+ margin-top: 0.5em;
21
+ margin-bottom: 0.5em;
22
+ }
23
+
24
+ #content {
25
+ margin: 2em;
26
+ margin-left: 3.5em;
27
+ margin-right: 3.5em;
28
+ }
29
+
30
+ #description p {
31
+ margin-bottom: 0.5em;
32
+ }
33
+
34
+ .sectiontitle {
35
+ margin-top: 1em;
36
+ margin-bottom: 1em;
37
+ padding: 0.5em;
38
+ padding-left: 2em;
39
+ background: #005;
40
+ color: #FFF;
41
+ font-weight: bold;
42
+ }
43
+
44
+ .attr-rw {
45
+ padding-left: 1em;
46
+ padding-right: 1em;
47
+ text-align: center;
48
+ color: #055;
49
+ }
50
+
51
+ .attr-name {
52
+ font-weight: bold;
53
+ }
54
+
55
+ .attr-desc {
56
+ }
57
+
58
+ .attr-value {
59
+ font-family: monospace;
60
+ }
61
+
62
+ .file-title-prefix {
63
+ font-size: large;
64
+ }
65
+
66
+ .file-title {
67
+ font-size: large;
68
+ font-weight: bold;
69
+ background: #005;
70
+ color: #FFF;
71
+ }
72
+
73
+ .banner {
74
+ background: #005;
75
+ color: #FFF;
76
+ border: 1px solid black;
77
+ padding: 1em;
78
+ }
79
+
80
+ .banner td {
81
+ background: transparent;
82
+ color: #FFF;
83
+ }
84
+
85
+ h1 a, h2 a, .sectiontitle a, .banner a {
86
+ color: #FF0;
87
+ }
88
+
89
+ h1 a:hover, h2 a:hover, .sectiontitle a:hover, .banner a:hover {
90
+ color: #FF7;
91
+ }
92
+
93
+ .dyn-source {
94
+ display: none;
95
+ background: #fffde8;
96
+ color: #000;
97
+ border: #ffe0bb dotted 1px;
98
+ margin: 0.5em 2em 0.5em 2em;
99
+ padding: 0.5em;
100
+ }
101
+
102
+ .dyn-source .cmt {
103
+ color: #00F;
104
+ font-style: italic;
105
+ }
106
+
107
+ .dyn-source .kw {
108
+ color: #070;
109
+ font-weight: bold;
110
+ }
111
+
112
+ .method {
113
+ margin-left: 1em;
114
+ margin-right: 1em;
115
+ margin-bottom: 1em;
116
+ }
117
+
118
+ .description pre {
119
+ padding: 0.5em;
120
+ border: #ffe0bb dotted 1px;
121
+ background: #fffde8;
122
+ }
123
+
124
+ .method .title {
125
+ font-family: monospace;
126
+ font-size: large;
127
+ border-bottom: 1px dashed black;
128
+ margin-bottom: 0.3em;
129
+ padding-bottom: 0.1em;
130
+ }
131
+
132
+ .method .description, .method .sourcecode {
133
+ margin-left: 1em;
134
+ }
135
+
136
+ .description p, .sourcecode p {
137
+ margin-bottom: 0.5em;
138
+ }
139
+
140
+ .method .sourcecode p.source-link {
141
+ text-indent: 0em;
142
+ margin-top: 0.5em;
143
+ }
144
+
145
+ .method .aka {
146
+ margin-top: 0.3em;
147
+ margin-left: 1em;
148
+ font-style: italic;
149
+ text-indent: 2em;
150
+ }
151
+
152
+ h1 {
153
+ padding: 1em;
154
+ margin-left: -1.5em;
155
+ font-size: x-large;
156
+ font-weight: bold;
157
+ color: #FFF;
158
+ background: #007;
159
+ }
160
+
161
+ h2 {
162
+ padding: 0.5em 1em 0.5em 1em;
163
+ margin-left: -1.5em;
164
+ font-size: large;
165
+ font-weight: bold;
166
+ color: #FFF;
167
+ background: #009;
168
+ }
169
+
170
+ h3, h4, h5, h6 {
171
+ color: #220088;
172
+ border-bottom: #5522bb solid 1px;
173
+ }
174
+
175
+ .sourcecode > pre {
176
+ padding: 0.5em;
177
+ border: 1px dotted black;
178
+ background: #FFE;
179
+ }
180
+
181
+ dt {
182
+ font-weight: bold
183
+ }
184
+
185
+ dd {
186
+ margin-bottom: 0.7em;
187
+ }
@@ -0,0 +1 @@
1
+ require 'rdoc/generator/horo'
@@ -0,0 +1,194 @@
1
+ require 'rdoc/generator'
2
+ require 'rdoc/rdoc'
3
+ require 'erb'
4
+
5
+ class RDoc::Generator::Horo
6
+ RDoc::RDoc.add_generator self
7
+
8
+ class << self
9
+ alias :for :new
10
+ end
11
+
12
+ attr_accessor :file_dir, :class_dir
13
+
14
+ def initialize options
15
+ @options = options
16
+ @files = nil
17
+ @classes = nil
18
+ @methods = nil
19
+ @file_dir = 'files'
20
+ @class_dir = 'classes'
21
+ @app_root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
22
+ @op_dir = File.expand_path options.op_dir
23
+ end
24
+
25
+ def generate top_levels
26
+ @files = top_levels
27
+ @classes = RDoc::TopLevel.all_classes_and_modules
28
+ @methods = @classes.map { |x| x.method_list }.flatten
29
+
30
+ write_static_files
31
+ write_index
32
+ write_file_index
33
+ write_class_index
34
+ write_method_index
35
+ write_classes
36
+ write_files
37
+ end
38
+
39
+ private
40
+ def layout name, ctx, &block
41
+ filename = File.join @app_root, 'app', 'views', 'layouts', name
42
+ ctx.eval(File.read(filename), filename, &block)
43
+ end
44
+
45
+ def write_files
46
+ filename = File.join @app_root, 'app', 'views', 'files', 'show.html.erb'
47
+ ctx = TemplateContext.new @options, @files
48
+ ctx.extend ClassesHelper
49
+ ctx.extend FileHelper
50
+
51
+ @files.each do |file|
52
+ ctx.file = file
53
+
54
+ file_path = File.join @op_dir, file.path
55
+ FileUtils.mkdir_p File.dirname file_path
56
+ relative_path = File.join(
57
+ *File.dirname(file.path).split(File::SEPARATOR).map { |x|
58
+ '..'
59
+ })
60
+ ctx.relative_prefix = relative_path
61
+ ctx.style_url = File.join relative_path, 'rdoc-style.css'
62
+
63
+ File.open(file_path, 'wb') do |fh|
64
+ src = layout 'application.html.erb', ctx do
65
+ ctx.eval File.read(filename), filename
66
+ end
67
+ fh.write src
68
+ end
69
+ end
70
+ end
71
+
72
+ def write_classes
73
+ filename = File.join @app_root, 'app', 'views', 'classes', 'show.html.erb'
74
+ ctx = TemplateContext.new @options, @methods
75
+ ctx.extend ClassesHelper
76
+
77
+ @classes.each do |klass|
78
+ ctx.klass = klass
79
+ file_path = File.join @op_dir, klass.path
80
+ FileUtils.mkdir_p File.dirname file_path
81
+
82
+ relative_path = File.join(
83
+ *File.dirname(klass.path).split(File::SEPARATOR).map { |x|
84
+ '..'
85
+ })
86
+ ctx.relative_prefix = relative_path
87
+ ctx.style_url = File.join relative_path, 'rdoc-style.css'
88
+
89
+ File.open(file_path, 'wb') do |fh|
90
+ src = layout 'application.html.erb', ctx do
91
+ ctx.eval File.read(filename), filename
92
+ end
93
+ fh.write src
94
+ end
95
+ end
96
+ end
97
+
98
+ def write_method_index
99
+ filename = File.join @app_root, 'app', 'views', 'methods', 'index.html.erb'
100
+ ctx = TemplateContext.new @options, @methods
101
+
102
+ ctx.extend FileIndexHelper
103
+ ctx.list_title = 'Methods'
104
+
105
+ File.open(File.join(@op_dir, 'fr_method_index.html'), 'wb') do |fh|
106
+ fh.write ctx.eval File.read(filename), filename
107
+ end
108
+ end
109
+
110
+ def write_class_index
111
+ filename = File.join @app_root, 'app', 'views', 'classes', 'index.html.erb'
112
+ ctx = TemplateContext.new @options, @classes
113
+
114
+ ctx.extend FileIndexHelper
115
+ ctx.list_title = 'Classes'
116
+
117
+ File.open(File.join(@op_dir, 'fr_class_index.html'), 'wb') do |fh|
118
+ fh.write ctx.eval File.read(filename), filename
119
+ end
120
+ end
121
+
122
+ def write_file_index
123
+ filename = File.join @app_root, 'app', 'views', 'files', 'index.html.erb'
124
+ ctx = TemplateContext.new @options, @files
125
+
126
+ ctx.extend FileIndexHelper
127
+ ctx.list_title = 'Files'
128
+
129
+ File.open(File.join(@op_dir, 'fr_file_index.html'), 'wb') do |fh|
130
+ fh.write ctx.eval File.read(filename), filename
131
+ end
132
+ end
133
+
134
+ def write_index
135
+ filename = File.join @app_root, 'app', 'views', 'root', 'index.html.erb'
136
+ ctx = TemplateContext.new @options, @files
137
+
138
+ File.open(File.join(@op_dir, 'index.html'), 'wb') do |fh|
139
+ fh.write ctx.eval File.read(filename), filename
140
+ end
141
+ end
142
+
143
+ def write_static_files
144
+ FileUtils.cp_r Dir[File.join(@app_root, 'public', '*')], @op_dir
145
+ end
146
+
147
+ module FileHelper
148
+ attr_accessor :file
149
+
150
+ def title
151
+ "File: #{file.base_name}"
152
+ end
153
+ end
154
+
155
+ module FileIndexHelper
156
+ attr_accessor :list_title
157
+ end
158
+
159
+ module ClassesHelper
160
+ attr_accessor :klass
161
+ attr_accessor :style_url
162
+ attr_accessor :relative_prefix
163
+
164
+ def title
165
+ (klass.module? ? 'Module: ' : 'Class: ') + klass.full_name
166
+ end
167
+
168
+ def link_to text, path
169
+ "<a href=\"#{path}\">#{text}</a>"
170
+ end
171
+ end
172
+
173
+ class TemplateContext < Struct.new :options, :files
174
+ def eval src, filename
175
+ template = ERB.new src, nil, '><'
176
+ template.filename = filename
177
+ template.result binding
178
+ end
179
+
180
+ def title
181
+ options.title
182
+ end
183
+
184
+ def charset
185
+ options.charset
186
+ end
187
+
188
+ def main_page
189
+ files.find { |x| x.name == options.main_page } ||
190
+ files.find { |x| x.name =~ /README/i } ||
191
+ files.sort_by { |x| x.name }.first
192
+ end
193
+ end
194
+ end
@@ -0,0 +1,90 @@
1
+ require 'test/unit'
2
+ require 'rdoc/generator/horo'
3
+ require 'tempfile'
4
+ require 'nokogiri'
5
+
6
+ module Horo
7
+ class Foo
8
+ end
9
+
10
+ class TestDocs < Foo
11
+ end
12
+ end
13
+
14
+ class TestHoro < Test::Unit::TestCase
15
+ def setup
16
+ $-w = false
17
+ rdoc = RDoc::RDoc.new
18
+
19
+ @title = 'Ruby on Rails Documentation'
20
+ @encoding = 'utf-8'
21
+ @main = 'README.rdoc'
22
+
23
+ rdoc.document [
24
+ '-q',
25
+ '-f', 'horo',
26
+ '--title', @title,
27
+ '--main', @main,
28
+ '--charset', @encoding,
29
+ ]
30
+ $-w = true
31
+ end
32
+
33
+ def test_index
34
+ doc = html_doc 'doc/index.html'
35
+
36
+ assert_equal @title, doc.css('title').first.content
37
+ assert_equal @encoding, doc.encoding
38
+ main_frame = doc.at_css 'frame[name = "docwin"]'
39
+ assert_equal "files/#{@main.gsub(/\./, '_')}.html", main_frame['src']
40
+ end
41
+
42
+ def test_file_index
43
+ doc = html_doc 'doc/index.html'
44
+ assert doc.at_css('frame[src="fr_file_index.html"]'), "index links to files"
45
+ assert_file 'doc/fr_file_index.html'
46
+ end
47
+
48
+ def test_class_index
49
+ doc = html_doc 'doc/index.html'
50
+ assert doc.at_css('frame[src="fr_class_index.html"]'), "missing frame"
51
+ assert_file 'doc/fr_class_index.html'
52
+ end
53
+
54
+ def test_method_index
55
+ doc = html_doc 'doc/index.html'
56
+ assert doc.at_css('frame[src="fr_method_index.html"]'), "missing frame"
57
+ assert_file 'doc/fr_method_index.html'
58
+ end
59
+
60
+ def test_class_show
61
+ doc = html_doc 'doc/classes/Horo.html'
62
+ assert_match(/Module:\s+Horo/, doc.at('title').content)
63
+
64
+ style_link = doc.css('link[rel = "stylesheet"]').first
65
+ assert_equal '../rdoc-style.css', style_link['href']
66
+
67
+ link = doc.css('a').find { |x| x.content == 'lib/horo.rb' }
68
+ assert_equal '../files/lib/horo_rb.html', link['href']
69
+ end
70
+
71
+ def test_class_parent
72
+ doc = html_doc 'doc/classes/Horo/TestDocs.html'
73
+ link = doc.css('a').find { |x| x.content == 'Horo::Foo' }
74
+ assert_equal 'Foo.html', link['href']
75
+ end
76
+
77
+ def teardown
78
+ FileUtils.rm_rf(File.join(File.dirname(__FILE__), '..', 'doc'))
79
+ end
80
+
81
+ private
82
+ def html_doc file
83
+ assert_file file
84
+ doc = File.open(file, 'rb') { |f| Nokogiri.HTML f }
85
+ end
86
+
87
+ def assert_file name
88
+ assert File.exists?(name), "missing file: #{name}"
89
+ end
90
+ end
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: horo
3
+ version: !ruby/object:Gem::Version
4
+ hash: 62196353
5
+ prerelease: true
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ - beta
11
+ - 1
12
+ version: 1.0.0.beta.1
13
+ platform: ruby
14
+ authors:
15
+ - Aaron Patterson
16
+ autorequire:
17
+ bindir: bin
18
+ cert_chain: []
19
+
20
+ date: 2010-07-14 00:00:00 -07:00
21
+ default_executable:
22
+ dependencies:
23
+ - !ruby/object:Gem::Dependency
24
+ name: rubyforge
25
+ prerelease: false
26
+ requirement: &id001 !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ hash: 7
32
+ segments:
33
+ - 2
34
+ - 0
35
+ - 4
36
+ version: 2.0.4
37
+ type: :development
38
+ version_requirements: *id001
39
+ - !ruby/object:Gem::Dependency
40
+ name: nokogiri
41
+ prerelease: false
42
+ requirement: &id002 !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ hash: 3
48
+ segments:
49
+ - 1
50
+ - 4
51
+ - 2
52
+ version: 1.4.2
53
+ type: :development
54
+ version_requirements: *id002
55
+ - !ruby/object:Gem::Dependency
56
+ name: hoe
57
+ prerelease: false
58
+ requirement: &id003 !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ hash: 23
64
+ segments:
65
+ - 2
66
+ - 6
67
+ - 0
68
+ version: 2.6.0
69
+ type: :development
70
+ version_requirements: *id003
71
+ description: |-
72
+ An RDoc template extracted from Ruby on Rails. Provides the same documetation
73
+ style and format used for Ruby on Rails API documentation.
74
+ email:
75
+ - aaron@tenderlovemaking.com
76
+ executables: []
77
+
78
+ extensions: []
79
+
80
+ extra_rdoc_files:
81
+ - Manifest.txt
82
+ - CHANGELOG.rdoc
83
+ - README.rdoc
84
+ files:
85
+ - .autotest
86
+ - CHANGELOG.rdoc
87
+ - Manifest.txt
88
+ - README.rdoc
89
+ - Rakefile
90
+ - lib/app/views/classes/index.html.erb
91
+ - lib/app/views/classes/show.html.erb
92
+ - lib/app/views/files/index.html.erb
93
+ - lib/app/views/files/show.html.erb
94
+ - lib/app/views/layouts/application.html.erb
95
+ - lib/app/views/methods/index.html.erb
96
+ - lib/app/views/root/index.html.erb
97
+ - lib/horo.rb
98
+ - lib/public/rdoc-style.css
99
+ - lib/rdoc/discover.rb
100
+ - lib/rdoc/generator/horo.rb
101
+ - test/test_horo.rb
102
+ has_rdoc: true
103
+ homepage: http://github.com/tenderlove/horo
104
+ licenses: []
105
+
106
+ post_install_message:
107
+ rdoc_options:
108
+ - --main
109
+ - README.rdoc
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ hash: 3
118
+ segments:
119
+ - 0
120
+ version: "0"
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ">"
125
+ - !ruby/object:Gem::Version
126
+ hash: 25
127
+ segments:
128
+ - 1
129
+ - 3
130
+ - 1
131
+ version: 1.3.1
132
+ requirements: []
133
+
134
+ rubyforge_project: horo
135
+ rubygems_version: 1.3.7
136
+ signing_key:
137
+ specification_version: 3
138
+ summary: An RDoc template extracted from Ruby on Rails
139
+ test_files:
140
+ - test/test_horo.rb