resh 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog ADDED
@@ -0,0 +1,4 @@
1
+ 2007-10-08 SATOH Hiroh <cho45@lowreal.net>
2
+
3
+ * init
4
+
data/README ADDED
@@ -0,0 +1,38 @@
1
+
2
+ = resh
3
+
4
+
5
+ == Description
6
+
7
+ Resh is a HTML template for RDoc.
8
+
9
+ http://coderepos.org/share/wiki/Resh
10
+
11
+ == Installation
12
+
13
+ === Archive Installation
14
+
15
+ rake install
16
+
17
+ === Gem Installation
18
+
19
+ gem install resh
20
+
21
+
22
+ == Features/Problems
23
+
24
+ RubyGems install this to GEMHOME, so raw rdoc command is not able to find
25
+ 'resh'. In like this case, use RUBYOPT to load rubygems
26
+
27
+ RUBYOPT="-rubygems" rdoc --template resh foobar
28
+
29
+ Any other gem loaded context, above option is not required.
30
+
31
+ * Rake::RDocTask
32
+ * ~/.gemrc
33
+
34
+ == Copyright
35
+
36
+ Author:: cho45 <cho45@lowreal.net>
37
+ Copyright:: Copyright (c) 2007 cho45
38
+ License:: Ruby's
data/Rakefile ADDED
@@ -0,0 +1,144 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/clean'
4
+ require 'rake/testtask'
5
+ require 'rake/packagetask'
6
+ require 'rake/gempackagetask'
7
+ require 'rake/rdoctask'
8
+ require 'rake/contrib/rubyforgepublisher'
9
+ require 'rubyforge'
10
+ require 'fileutils'
11
+ include FileUtils
12
+
13
+ NAME = "resh"
14
+ AUTHOR = "cho45"
15
+ EMAIL = "cho45@lowreal.net"
16
+ DESCRIPTION = "A RDoc template."
17
+ RUBYFORGE_PROJECT = "lowreal"
18
+ HOMEPATH = "http://coderepos.org/share/wiki/Resh"
19
+ BIN_FILES = %w( )
20
+ VERS = "0.0.1"
21
+
22
+ REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
23
+ CLEAN.include ['**/.*.sw?', '*.gem', '.config']
24
+ CLOBBER.include ['lib/rdoc/generators/template/html/resh/*']
25
+ RDOC_OPTS = ['--title', "#{NAME} documentation",
26
+ "--charset", "utf-8",
27
+ "--opname", "index.html",
28
+ "--line-numbers",
29
+ "--main", "README",
30
+ "--inline-source",
31
+ ]
32
+
33
+ desc "Packages up #{NAME} gem."
34
+ task :default => [:test]
35
+ task :package => [:clean]
36
+
37
+ Rake::TestTask.new("test") { |t|
38
+ t.libs << "test"
39
+ t.pattern = "test/**/*_test.rb"
40
+ t.verbose = true
41
+ }
42
+
43
+ spec = Gem::Specification.new do |s|
44
+ s.name = NAME
45
+ s.version = VERS
46
+ s.platform = Gem::Platform::RUBY
47
+ s.has_rdoc = true
48
+ s.extra_rdoc_files = ["README", "ChangeLog"]
49
+ s.rdoc_options += RDOC_OPTS + ['--exclude', '^(examples|extras)/']
50
+ s.summary = DESCRIPTION
51
+ s.description = DESCRIPTION
52
+ s.author = AUTHOR
53
+ s.email = EMAIL
54
+ s.homepage = HOMEPATH
55
+ s.executables = BIN_FILES
56
+ s.rubyforge_project = RUBYFORGE_PROJECT
57
+ s.bindir = "bin"
58
+ s.require_path = "lib"
59
+ s.autorequire = "rdoc/generators/template/html/resh"
60
+ s.test_files = Dir["test/test_*.rb"]
61
+
62
+ #s.add_dependency('activesupport', '>=1.3.1')
63
+ #s.required_ruby_version = '>= 1.8.2'
64
+
65
+ files = Dir["../*"]
66
+ files.delete("../#{File.basename(Dir.pwd)}")
67
+ FileUtils.cp_r files, "lib/rdoc/generators/template/html/resh/", :verbose => true
68
+ s.files = %w(README ChangeLog Rakefile) +
69
+ Dir.glob("{bin,doc,test,lib,templates,generator,extras,website,script}/**/*") +
70
+ Dir.glob("ext/**/*.{h,c,rb}") +
71
+ Dir.glob("examples/**/*.rb") +
72
+ Dir.glob("tools/*.rb")
73
+
74
+ s.extensions = FileList["ext/**/extconf.rb"].to_a
75
+ end
76
+
77
+ Rake::GemPackageTask.new(spec) do |p|
78
+ p.need_tar = true
79
+ p.gem_spec = spec
80
+ end
81
+
82
+ task :install do
83
+ name = "#{NAME}-#{VERS}.gem"
84
+ sh %{rake package}
85
+ sh %{sudo gem install pkg/#{name}}
86
+ end
87
+
88
+ task :uninstall => [:clean] do
89
+ sh %{sudo gem uninstall #{NAME}}
90
+ end
91
+
92
+
93
+ Rake::RDocTask.new do |rdoc|
94
+ rdoc.rdoc_dir = 'html'
95
+ rdoc.options += RDOC_OPTS
96
+ rdoc.template = "#{ENV["HOME"]}/coderepos/lang/ruby/rdoc/generators/template/html/resh/resh.rb"
97
+ #rdoc.template = "#{ENV['template']}.rb" if ENV['template']
98
+ if ENV['DOC_FILES']
99
+ rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
100
+ else
101
+ rdoc.rdoc_files.include('README', 'ChangeLog')
102
+ rdoc.rdoc_files.include('lib/**/*.rb')
103
+ rdoc.rdoc_files.include('ext/**/*.c')
104
+ end
105
+ end
106
+
107
+ desc "Publish to RubyForge"
108
+ task :rubyforge => [:rdoc, :package] do
109
+ SshDirPublisher.new(
110
+ "cho45@rubyforge.org",
111
+ "/var/www/gforge-projects/#{RUBYFORGE_PROJECT}/#{NAME}",
112
+ "html"
113
+ ).upload
114
+ end
115
+
116
+ desc 'Package and upload the release to rubyforge.'
117
+ task :release => [:clean, :package, :release_local] do |t|
118
+ v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
119
+ abort "Versions don't match #{v} vs #{VERS}" unless v == VERS
120
+ pkg = "pkg/#{NAME}-#{VERS}"
121
+
122
+ rf = RubyForge.new
123
+ puts "Logging in"
124
+ rf.login
125
+
126
+ c = rf.userconfig
127
+ # c["release_notes"] = description if description
128
+ # c["release_changes"] = changes if changes
129
+ c["preformatted"] = true
130
+
131
+ files = [
132
+ "#{pkg}.tgz",
133
+ "#{pkg}.gem"
134
+ ].compact
135
+
136
+ puts "Releasing #{NAME} v. #{VERS}"
137
+ rf.add_release RUBYFORGE_PROJECT, NAME, VERS, *files
138
+ end
139
+
140
+ desc "Package and upload the release to local gem repos."
141
+ task :release_local => [:clean, :package] do |t|
142
+ name = "#{NAME}-#{VERS}.gem"
143
+ sh %{scp pkg/#{name} c:/srv/www/lab.lowreal.net/public/gems/gems}
144
+ end
@@ -0,0 +1,3 @@
1
+
2
+ require "rdoc/generators/template/html/resh/resh"
3
+
@@ -0,0 +1,232 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <% extend ERB::Util %>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=<%=@options.charset%>">
6
+ <meta http-equiv="Content-Style-Type" content="text/css">
7
+ <meta http-equiv="Content-Script-Type" content="text/javascript">
8
+
9
+ <link rel="stylesheet" type="text/css" href="<%=values["style_url"]%>" media="screen,tv"/>
10
+
11
+ <!-- <script type="text/javascript" src="/site-script.js"></script> -->
12
+ <title><%=values["title"]%></title>
13
+ </head>
14
+ <body>
15
+ <% index = Pathname.new("").relative_path_from(Pathname.new(f.path).parent) + "index.html"%>
16
+ <div id="whole">
17
+ <h1 id="top"><a href="<%=index%>"><%=values["title"]%></a></h1>
18
+ <div class="class-information">
19
+ <p class="full-name">
20
+ <%=values["full_name"]%>
21
+ <span class="classmod">(<%=values["classmod"]%>)</span>
22
+ </p>
23
+
24
+ <dl>
25
+ <dt>In files</dt>
26
+ <% values["infiles"].each do |f| %>
27
+ <% if f["full_path_url"]%>
28
+ <dd class="full-path-url">
29
+ <a href="<%=f["full_path_url"]%>">
30
+ <%=f["full_path"]%>
31
+ </a>
32
+ </dd>
33
+ <% end %>
34
+ <% end %>
35
+
36
+ <% if values["parent"] %>
37
+ <dt>Parent</dt>
38
+ <dd class="parent">
39
+ <% if values["par_url"]%>
40
+ <a href="<%=h values["par_url"]%>">
41
+ <%= values["parent"]%>
42
+ </a>
43
+ <% else %>
44
+ <%= values["parent"]%>
45
+ <% end %>
46
+ </dd>
47
+ <% end %>
48
+ </dl>
49
+ </div>
50
+
51
+ <div id="content">
52
+ <% if values["diagram"]%>
53
+ <div class="diagram">
54
+ <%=values["diagram"]%>
55
+ </div>
56
+ <% end %>
57
+
58
+ <% if values["description"]%>
59
+ <div class="description">
60
+ <%=values["description"]%>
61
+ </div>
62
+ <% end %>
63
+
64
+ <% if values["requires"]%>
65
+ <div class="requires-list">
66
+ <h2>Required files</h2>
67
+
68
+ <ul class="requires">
69
+ <% values["requires"].each do |i| %>
70
+ <li><a href="#<%=i["aref"]%>"><%=i["name"]%></a></li>
71
+ <% end %>
72
+ </ul>
73
+ </div>
74
+ <% end %>
75
+
76
+ <% if values["toc"]%>
77
+ <div class="toc">
78
+ <h2>Contents</h2>
79
+ <ul>
80
+ <% values["toc"].each do |i| %>
81
+ <li><a href="#<%=i["href"]%>"><%=i["secname"]%></a></li>
82
+ <% end %>
83
+ </ul>
84
+ </div>
85
+ <% end %>
86
+
87
+ <% if values["methods"]%>
88
+ <div class="method-list">
89
+ <h2>Methods</h2>
90
+
91
+ <ul class="methods">
92
+ <% values["methods"].each do |i| %>
93
+ <li><a href="<%=i["aref"]%>"><%=i["name"]%></a></li>
94
+ <% end %>
95
+ </ul>
96
+ </div>
97
+ <% end %>
98
+
99
+ <!-- if includes -->
100
+ <% if values["includes"]%>
101
+ <div id="includes">
102
+ <h2>Included Modules</h2>
103
+
104
+ <ul class="includes">
105
+ <% values["includes"].each do |i| %>
106
+ <li><a href="<%=i["aref"]%>"><%=i["name"]%></a></li>
107
+ <% end %>
108
+ </div>
109
+ </div>
110
+ <% end %>
111
+
112
+ <% values["sections"].each do |sec| %>
113
+ <div class="section" id="<%=sec["sectitle"]%>">
114
+ <% if sec["sectitle"] %>
115
+ <h2><%=sec["sectitle"]%></a></h2>
116
+ <% if sec["seccomment"] %>
117
+ <div class="section-comment">
118
+ <%=sec["seccomment"]%>
119
+ </div>
120
+ <% end %>
121
+ <% end %>
122
+
123
+ <% if sec["classlist"] %>
124
+ <div id="class-list">
125
+ <h2>Classes and Modules</h2>
126
+
127
+ <%=sec["classlist"]%>
128
+ </div>
129
+ <% end %>
130
+
131
+ <% if sec["constants"] %>
132
+ <div id="constants-list">
133
+ <h2>Constants</h2>
134
+
135
+ <dl class="constants">
136
+ <% sec["constants"].each do |c| %>
137
+ <dt><%=c["name"]%></dt>
138
+ <dd><code><%=c["value"]%></code></dd>
139
+ <% if c["desc"] %><dd><%=c["desc"]%></dd><% end %>
140
+ <% end %>
141
+ </dl>
142
+ </div>
143
+ <% end %>
144
+
145
+ <% if sec["aliases"] %>
146
+ <div class="aliases-list">
147
+ <h2>External Aliases</h2>
148
+
149
+ <dl class="aliases">
150
+ <% sec["aliases"].each do |a| %>
151
+ <dt><code><%=a["old_name"]%></code>-><code><%=a["new_name"]%></code></dt>
152
+ <% if a["desc"] %><dd><%= a["desc"] %></dd><% end %>
153
+ <% end %>
154
+ </dl>
155
+ </div>
156
+ <% end %>
157
+
158
+
159
+ <% if sec["attributes"] %>
160
+ <div class="attribute-list">
161
+ <h2>Attributes</h2>
162
+
163
+ <dl class="attributes">
164
+ <% sec["attributes"].each do |a| %>
165
+ <dt><%=a["name"]%> <% if a["rw"]; %><span class="perm">[<%=a["rw"]%>]</span><% ;end %></dt>
166
+ <dd><%=a["a_desc"]%></dd>
167
+ <% end %>
168
+ </dl>
169
+ </div>
170
+ <% end %>
171
+
172
+
173
+
174
+ <!-- if method_list -->
175
+ <% if sec["method_list"] %>
176
+ <div class="methods">
177
+ <% sec["method_list"].each do |ml| %>
178
+ <% if ml["methods"] %>
179
+ <h2><%=ml["type"]%> <%=ml["category"]%> methods</h2>
180
+
181
+ <% ml["methods"].each do |m| %>
182
+ <div class="method-detail" id="<%=m["aref"]%>">
183
+ <div class="method-heading">
184
+ <a href="#<%=m["aref"]%>" class="method-signature">
185
+ <% if m["callseq"]%>
186
+ <span class="method-name"><%=m["callseq"]%></span>
187
+ <% else %>
188
+ <span class="method-name"><%=m["name"]%></span><span class="method-args"><%=m["params"]%></span>
189
+ <% end %>
190
+ </a>
191
+ </div>
192
+
193
+ <div class="method-description">
194
+ <%=m["m_desc"]%>
195
+ <% if m["sourcecode"]%>
196
+ <pre class="source" onclick="this.className=this.className=='source'?'source clicked':'source'" title="Click to see code">
197
+ <%=m["sourcecode"]%>
198
+ </pre>
199
+ <% end %>
200
+
201
+ <% if m["codeurl"] %>
202
+ <a href="<%=m["codeurl"]%>" class="code-url">source</a>
203
+ <% end %>
204
+ </div>
205
+ </div>
206
+
207
+ <% end %>
208
+ <% end %>
209
+ <% end %>
210
+ </div>
211
+ <% end %>
212
+ </div>
213
+ <% end %>
214
+ </div>
215
+
216
+ <div id="footer">
217
+ <p class="footer-links"><a href="<%=index%>">&lt;Index</a> <a href="#top">Top^</a></p>
218
+ <p>Created at: <%=require "time"; Time.now.xmlschema %></p>
219
+ <p>
220
+ Powerd by
221
+ <span class="ruby-r">R</span>Doc
222
+ (
223
+ template: <a href="http://coderepos.org/share/wiki/Resh">Resh</a>
224
+ )
225
+ /
226
+ <span class="ruby-r">R</span>uby /
227
+ ruby<%=RUBY_VERSION%>
228
+ </p>
229
+ </div>
230
+ </div>
231
+ </body>
232
+ </html>
@@ -0,0 +1,217 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <% extend ERB::Util %>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=<%=@options.charset%>">
6
+ <meta http-equiv="Content-Style-Type" content="text/css">
7
+ <meta http-equiv="Content-Script-Type" content="text/javascript">
8
+
9
+ <link rel="stylesheet" type="text/css" href="<%=values["style_url"]%>" media="screen,tv"/>
10
+
11
+ <!-- <script type="text/javascript" src="/site-script.js"></script> -->
12
+ <title><%=values["title"]%></title>
13
+ </head>
14
+ <body>
15
+ <% index = Pathname.new("").relative_path_from(Pathname.new(f.path).parent) + "index.html"%>
16
+ <div id="whole">
17
+ <h1 id="top"><a href="<%=index%>"><%=values["title"]%></a></h1>
18
+ <div class="file-information">
19
+ <p class="shot-name">
20
+ <%=values["short_name"]%>
21
+ </p>
22
+
23
+ <dl>
24
+ <dt>Full Path:</dt>
25
+ <dd class="full-path-url">
26
+ <%=values["full_path"]%>
27
+ </dd>
28
+ </dl>
29
+ </div>
30
+
31
+ <div id="content">
32
+ <% if values["diagram"]%>
33
+ <div class="diagram">
34
+ <%=values["diagram"]%>
35
+ </div>
36
+ <% end %>
37
+
38
+ <% if values["description"]%>
39
+ <div class="description">
40
+ <%=values["description"]%>
41
+ </div>
42
+ <% end %>
43
+
44
+ <% if values["requires"]%>
45
+ <div class="requires-list">
46
+ <h2>Required files</h2>
47
+
48
+ <ul class="requires">
49
+ <% values["requires"].each do |i| %>
50
+ <li><a href="#<%=i["aref"]%>"><%=i["name"]%></a></li>
51
+ <% end %>
52
+ </ul>
53
+ </div>
54
+ <% end %>
55
+
56
+ <% if values["toc"]%>
57
+ <div class="toc">
58
+ <h2>Contents</h2>
59
+ <ul>
60
+ <% values["toc"].each do |i| %>
61
+ <li><a href="#<%=i["href"]%>"><%=i["secname"]%></a></li>
62
+ <% end %>
63
+ </ul>
64
+ </div>
65
+ <% end %>
66
+
67
+ <% if values["methods"]%>
68
+ <div class="method-list">
69
+ <h2>Methods</h2>
70
+
71
+ <ul class="methods">
72
+ <% values["methods"].each do |i| %>
73
+ <li><a href="<%=i["aref"]%>"><%=i["name"]%></a></li>
74
+ <% end %>
75
+ </ul>
76
+ </div>
77
+ <% end %>
78
+
79
+ <!-- if includes -->
80
+ <% if values["includes"]%>
81
+ <div id="includes">
82
+ <h2>Included Modules</h2>
83
+
84
+ <ul class="includes">
85
+ <% values["includes"].each do |i| %>
86
+ <li><a href="<%=i["aref"]%>"><%=i["name"]%></a></li>
87
+ <% end %>
88
+ </div>
89
+ </div>
90
+ <% end %>
91
+
92
+ <!-- sections -->
93
+ <% values["sections"].each do |sec| %>
94
+ <div class="section" id="<%=sec["sectitle"]%>">
95
+ <% if sec["sectitle"] %>
96
+ <h2><%=sec["sectitle"]%></a></h2>
97
+ <% if sec["seccomment"] %>
98
+ <div class="section-comment">
99
+ <%=sec["seccomment"]%>
100
+ </div>
101
+ <% end %>
102
+ <% end %>
103
+
104
+ <% if sec["classlist"] %>
105
+ <div id="class-list">
106
+ <h2>Classes and Modules</h2>
107
+
108
+ <%=sec["classlist"]%>
109
+ </div>
110
+ <% end %>
111
+
112
+ <% if sec["constants"] %>
113
+ <div id="constants-list">
114
+ <h2>Constants</h2>
115
+
116
+ <dl class="constants">
117
+ <% sec["constants"].each do |c| %>
118
+ <dt><%=c["name"]%></dt>
119
+ <dd><code><%=c["value"]%></code></dd>
120
+ <% if c["desc"] %><dd><%=c["desc"]%></dd><% end %>
121
+ <% end %>
122
+ </dl>
123
+ </div>
124
+ <% end %>
125
+
126
+ <% if sec["aliases"] %>
127
+ <div class="aliases-list">
128
+ <h2>External Aliases</h2>
129
+
130
+ <dl class="aliases">
131
+ <% sec["aliases"].each do |a| %>
132
+ <dt><code><%=a["old_name"]%></code>-><code><%=a["new_name"]%></code></dt>
133
+ <% if a["desc"] %><dd><%= a["desc"] %></dd><% end %>
134
+ <% end %>
135
+ </dl>
136
+ </div>
137
+ <% end %>
138
+
139
+
140
+ <% if sec["attributes"] %>
141
+ <div class="attribute-list">
142
+ <h2>Attributes</h2>
143
+
144
+ <dl class="attributes">
145
+ <% sec["attributes"].each do |a| %>
146
+ <dt><%=a["name"]%> <% if a["rw"]; %><span class="perm">[<%=a["rw"]%>]</span><% ;end %></dt>
147
+ <dd><%=a["a_desc"]%></dd>
148
+ <% end %>
149
+ </dl>
150
+ </div>
151
+ <% end %>
152
+
153
+ <!-- method_list -->
154
+ <% if sec["method_list"] %>
155
+ <div class="methods">
156
+ <% sec["method_list"].each do |ml| %>
157
+ <% if ml["methods"] %>
158
+ <h2><%=ml["type"]%> <%=ml["category"]%> methods</h2>
159
+
160
+ <% ml["methods"].each do |m| %>
161
+ <div class="method-detail" id="<%=m["aref"]%>">
162
+ <div class="method-heading">
163
+ <a href="#<%=m["aref"]%>" class="method-signature">
164
+ <% if m["callseq"]%>
165
+ <span class="method-name"><%=m["callseq"]%></span>
166
+ <% else %>
167
+ <span class="method-name"><%=m["name"]%></span><span class="method-args"><%=m["params"]%></span>
168
+ <% end %>
169
+ </a>
170
+ </div>
171
+
172
+ <div class="method-description">
173
+ <%=m["m_desc"]%>
174
+ <% if m["sourcecode"]%>
175
+ <pre class="source" onclick="this.className=this.className=='source'?'source clicked':'source'" title="Click to see code">
176
+ <%=m["sourcecode"]%>
177
+ </pre>
178
+ <% end %>
179
+
180
+ <% if m["codeurl"] %>
181
+ <a href="<%=m["codeurl"]%>" class="code-url">source</a>
182
+ <% end %>
183
+ </div>
184
+ </div>
185
+
186
+ <% end %>
187
+ <% end %>
188
+ <% end %>
189
+ </div>
190
+ <!-- /method-list -->
191
+ <% end %>
192
+ </div>
193
+ <% end %>
194
+ <!-- /sections -->
195
+ </div>
196
+ <!-- /#content -->
197
+
198
+ <div id="footer">
199
+ <% require "time" %>
200
+ <p class="footer-links"><a href="<%=index%>">&lt;Index</a> <a href="#top">Top^</a></p>
201
+ <p>Original Document Last-modified: <%=Time.parse(values["dtm_modified"]).xmlschema%></p>
202
+ <p>Created at: <%=require "time"; Time.now.xmlschema %></p>
203
+ <p>
204
+ Powerd by
205
+ <span class="ruby-r">R</span>Doc
206
+ (
207
+ template: <a href="http://coderepos.org/share/wiki/Resh">Resh</a>
208
+ )
209
+ /
210
+ <span class="ruby-r">R</span>uby /
211
+ ruby<%=RUBY_VERSION%>
212
+ </p>
213
+ </div>
214
+ </div>
215
+ </body>
216
+ </html>
217
+
@@ -0,0 +1,102 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <% extend ERB::Util %>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=<%=@options.charset%>">
6
+ <meta http-equiv="Content-Style-Type" content="text/css">
7
+ <meta http-equiv="Content-Script-Type" content="text/javascript">
8
+
9
+
10
+ <link rel="stylesheet" type="text/css" href="<%=values["style_url"]%>" media="screen,tv"/>
11
+
12
+ <!-- <script type="text/javascript" src="/site-script.js"></script> -->
13
+ <title><%=values["title"]%></title>
14
+ </head>
15
+ <body>
16
+ <div id="whole">
17
+ <h1 id="top"><a href=""><%=values["title"]%></a></h1>
18
+
19
+ <div id="content">
20
+ <%
21
+ readme = @files.find {|i| File.basename(i.name) =~ /README/i }
22
+ if readme
23
+ r = readme.value_hash
24
+ %>
25
+ <div class="readme">
26
+ <div class="readme-information">
27
+ <p class="shot-name">
28
+ <%=r["short_name"]%>
29
+ </p>
30
+
31
+ <dl>
32
+ <dt>Full Path:</dt>
33
+ <dd class="full-path-url">
34
+ <a href="<%=readme.path%>"><%=r["full_path"]%></a>
35
+ </dd>
36
+ </dl>
37
+ </div>
38
+ <%=r["description"]%>
39
+ </div>
40
+ <% end %>
41
+ <div class="index-classes">
42
+ <h2>Classes/Modules</h2>
43
+ <% @classes.sort.each do |c|
44
+ next unless c.document_self
45
+ next if c.name.empty?
46
+ cv = c.value_hash
47
+ constants = cv["sections"].inject([]) {|r,i|
48
+ r.concat(i["constants"].map {|j| j["name"]}) if i["constants"]
49
+ r
50
+ }
51
+ %>
52
+ <% if cv["methods"] || !constants.empty? %>
53
+ <div class="class">
54
+ <h3><a href="<%="#{c.path}"%>"><%= c.name %></a></h3>
55
+ <% unless constants.empty? %>
56
+ <ul>
57
+ <% constants.each do |m| %>
58
+ <li><%=h m%></li>
59
+ <% end %>
60
+ </ul>
61
+ <% end %>
62
+ <% if cv["methods"] %>
63
+ <ul>
64
+ <% cv["methods"].sort_by{|i| i["name"]}.each do |m| %>
65
+ <li><a href="<%="#{c.path}#{m["aref"]}"%>"><%=m["name"]%></a></li>
66
+ <% end %>
67
+ </ul>
68
+ <% end %>
69
+ </div>
70
+ <% end %>
71
+ <% end %>
72
+ </div>
73
+ <div class="index-files">
74
+ <h2>Files</h2>
75
+ <ul>
76
+ <% @files.sort.each do |f|
77
+ next unless f.document_self
78
+ fv = f.value_hash
79
+ %>
80
+ <li><a href="<%=h f.path%>"><%=h f.name%></a></li>
81
+ <% end %>
82
+ </ul>
83
+ </div>
84
+ </div>
85
+
86
+ <div id="footer">
87
+ <p class="footer-links"><a href="#top">Top^</a></p>
88
+ <p>Created at: <%=require "time"; Time.now.xmlschema %></p>
89
+ <p>
90
+ Powerd by
91
+ <span class="ruby-r">R</span>Doc
92
+ (
93
+ template: <a href="http://coderepos.org/share/wiki/Resh">Resh</a>
94
+ )
95
+ /
96
+ <span class="ruby-r">R</span>uby /
97
+ ruby<%=RUBY_VERSION%>
98
+ </p>
99
+ </div>
100
+ </div>
101
+ </body>
102
+ </html>
@@ -0,0 +1,156 @@
1
+ #!rdoc --charset utf-8 --template ~/coderepos/lang/ruby/rdoc/generators/template/html/resh/resh.rb /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/{README,lib/*,doc/*}
2
+ #!rdoc --charset utf-8 --inline-source --template ~/coderepos/lang/ruby/rdoc/generators/template/html/erbdeyareyo.rb /opt/ruby1.8.5/lib/ruby/1.8/rdoc/*.rb
3
+
4
+ require "pp"
5
+ require "erb"
6
+ require "pathname"
7
+
8
+ class ::TemplateFile
9
+ def initialize
10
+ raise "DO NOT USE"
11
+ end
12
+ end
13
+
14
+ module ::RDoc::Page
15
+ FILE_INDEX = ""
16
+ CLASS_INDEX = ""
17
+ METHOD_INDEX = ""
18
+ end
19
+ $tmpl = Pathname.new(__FILE__).parent
20
+
21
+ p ::Generators::HtmlClass
22
+ class ::Generators::HtmlClass
23
+ def write_on(f)
24
+ return unless defined? RDoc::Page::CLASS_PAGE
25
+ value_hash
26
+ # template = TemplatePage.new(RDoc::Page::BODY,
27
+ # RDoc::Page::CLASS_PAGE,
28
+ # RDoc::Page::METHOD_LIST)
29
+ # template.write_html_on(f, @values)
30
+ values = @values
31
+ f << ERB.new(File.read($tmpl+RDoc::Page::CLASS_PAGE)).result(binding)
32
+ end
33
+ end
34
+
35
+ p ::Generators::HtmlFile
36
+ class ::Generators::HtmlFile
37
+ def write_on(f)
38
+ return unless defined? RDoc::Page::FILE_PAGE
39
+ value_hash
40
+ # template = TemplatePage.new(RDoc::Page::BODY,
41
+ # RDoc::Page::FILE_PAGE,
42
+ # RDoc::Page::METHOD_LIST)
43
+ # template.write_html_on(f, @values)
44
+ values = @values
45
+ f << ERB.new(File.read($tmpl+RDoc::Page::FILE_PAGE)).result(binding)
46
+ end
47
+ end
48
+
49
+ p ::Generators::HtmlMethod
50
+ class ::Generators::HtmlMethod
51
+ def create_source_code_file(code_body)
52
+ return unless defined? RDoc::Page::SRC_PAGE
53
+ meth_path = @html_class.path.sub(/\.html$/, '.src')
54
+ File.makedirs(meth_path)
55
+ file_path = File.join(meth_path, @seq) + ".html"
56
+
57
+ File.open(file_path, "w") do |f|
58
+ values = {
59
+ 'title' => CGI.escapeHTML(index_name),
60
+ 'code' => code_body,
61
+ 'style_url' => style_url(file_path, @options.css),
62
+ 'charset' => @options.charset
63
+ }
64
+ f << ERB.new(File.read($tmpl+RDoc::Page::SRC_PAGE)).result(binding)
65
+ end
66
+ HTMLGenerator.gen_url(path, file_path)
67
+ end
68
+ end
69
+
70
+ p ::Generators::HTMLGenerator
71
+ class ::Generators::HTMLGenerator
72
+ alias :orig_generate :generate
73
+ def generate(*args)
74
+ @options.instance_eval "@inline_source = true"
75
+ orig_generate(*args)
76
+ end
77
+
78
+ # TemplatePage をつかっているのをぬきだしてきたやつ
79
+ def write_style_sheet
80
+ return unless defined? RDoc::Page::STYLE
81
+ File.open(::Generators::CSS_NAME, "w") {|f|
82
+ f << ERB.new(File.read($tmpl+RDoc::Page::STYLE)).result(binding)
83
+ }
84
+ end
85
+
86
+ def gen_an_index(collection, title, template, filename)
87
+ res = []
88
+ collection.sort.each do |f|
89
+ if f.document_self
90
+ res << { "href" => f.path, "name" => f.index_name }
91
+ end
92
+ end
93
+
94
+ values = {
95
+ "entries" => res,
96
+ 'list_title' => CGI.escapeHTML(title),
97
+ 'index_url' => main_url,
98
+ 'charset' => @options.charset,
99
+ 'style_url' => style_url('', @options.css),
100
+ }
101
+ begin
102
+ File.open(filename, "w") {|f|
103
+ f << ERB.new(File.read($tmpl+RDoc::Page.const_get(title.upcase))).result(binding)
104
+ }
105
+ rescue NameError
106
+ end
107
+ end
108
+
109
+ def gen_main_index
110
+ return unless defined? RDoc::Page::INDEX
111
+ File.open("index.html", "w") do |f|
112
+ values = {
113
+ "initial_page" => main_url,
114
+ 'title' => CGI.escapeHTML(@options.title),
115
+ 'charset' => @options.charset,
116
+ 'style_url' => style_url('', @options.css),
117
+ }
118
+ if @options.inline_source
119
+ values['inline_source'] = true
120
+ end
121
+ f << ERB.new(File.read($tmpl+RDoc::Page::INDEX)).result(binding)
122
+ end
123
+ end
124
+
125
+ def generate_xml
126
+ values = {
127
+ 'charset' => @options.charset,
128
+ 'files' => gen_into(@files),
129
+ 'classes' => gen_into(@classes),
130
+ 'title' => CGI.escapeHTML(@options.title),
131
+ }
132
+
133
+ # this method is defined in the template file
134
+ write_extra_pages if defined? write_extra_pages
135
+
136
+ if @options.op_name
137
+ opfile = File.open(@options.op_name, "w")
138
+ else
139
+ opfile = $stdout
140
+ end
141
+ File.open(opfile, "w") {|f|
142
+ f << ERB.new(File.read($tmpl+RDoc::Page::ONE_PAGE)).result(binding)
143
+ }
144
+ end
145
+ end
146
+
147
+ module RDoc::Page
148
+ INDEX = "index.rhtml"
149
+ CLASS_PAGE = "class.rhtml"
150
+ FILE_PAGE = "file.rhtml"
151
+ # SRC_PAGE = "src.rhtml"
152
+ STYLE = "style.css"
153
+ # ONE_PAGE = "one_page.rhtml"
154
+
155
+
156
+ end
@@ -0,0 +1,210 @@
1
+ body {
2
+ line-height: 1.66;
3
+ padding: 0 5%;
4
+ background: #fff;
5
+ color: #000;
6
+ }
7
+
8
+ a:link {
9
+ color: #006699;
10
+ }
11
+
12
+ a:visited {
13
+ color: #666699;
14
+ }
15
+
16
+ a:hover {
17
+ text-decoration: none;
18
+ }
19
+
20
+ dt {
21
+ font-weight: bold;
22
+ margin: 1em 0 0 0;
23
+ }
24
+
25
+ h2 {
26
+ font-variant: small-caps;
27
+ color: #006699;
28
+ }
29
+
30
+ h3 {
31
+ margin: 0.5em 0 1em 0;
32
+ }
33
+
34
+ h3 a:link ,
35
+ h3 a:visited ,
36
+ h3 a:hover {
37
+ text-decoration: none;
38
+ color: #000;
39
+ }
40
+
41
+ pre {
42
+ border: 1px solid #ccc;
43
+ background: #eee;
44
+ padding: 1em 2em;
45
+ overflow: auto;
46
+ font-size: 80%;
47
+ line-height: 1.33;
48
+ }
49
+
50
+ pre.source {
51
+ height: 0;
52
+ overflow: hidden;
53
+ border: 1px solid #eee;
54
+ background: #f9f9f9;
55
+ color: #f9f9f9;
56
+ }
57
+
58
+ pre.source.clicked {
59
+ height: auto;
60
+ overflow: auto;
61
+ color: #000;
62
+ }
63
+
64
+ #top {
65
+ font-size: 500%;
66
+ line-height: 0.7;
67
+ margin: 0 -0.1em;
68
+ padding: 0;
69
+ color: #d9d9d9;
70
+ letter-spacing: -0.1em;
71
+ }
72
+
73
+ #top a:link ,
74
+ #top a:visited ,
75
+ #top a:hover {
76
+ color: #d9d9d9;
77
+ text-decoration: none;
78
+ }
79
+
80
+ .readme {
81
+ background: #f9f9f9;
82
+ border: 1px solid #eee;
83
+ padding: 1em;
84
+ }
85
+
86
+ .index-files,
87
+ .index-classes {
88
+ clear: both;
89
+ }
90
+
91
+ .index-files h3,
92
+ .index-classes h3 {
93
+ margin: 0.5em 0.5em 1em 0.5em;
94
+ }
95
+
96
+ .index-files .file,
97
+ .index-classes .class {
98
+ width: 20em;
99
+ float: left;
100
+ margin: 1em 1em 1em 0;
101
+ padding: 0 0.5em;
102
+ background: #efefef;
103
+ border: 1px solid #ccc;
104
+ overflow: hidden;
105
+ }
106
+
107
+ .full-name .classmod {
108
+ font-size: 80%;
109
+ color: #999;
110
+ }
111
+
112
+ .readme-information,
113
+ .file-information,
114
+ .class-information {
115
+ font-size: 80%;
116
+ text-align: right;
117
+ float: right;
118
+ border: 1px solid #ccc;
119
+ background: #efefef;
120
+ padding: 0 1em 1em;
121
+ }
122
+
123
+ .readme-information dl,
124
+ .file-information dl,
125
+ .class-information dl {
126
+ margin: 0;
127
+ padding: 0;
128
+ }
129
+
130
+ .readme-information dl dt,
131
+ .file-information dl dt,
132
+ .class-information dl dt {
133
+ margin: 0;
134
+ padding: 0;
135
+ }
136
+
137
+ .readme-information dl dd,
138
+ .file-information dl dd,
139
+ .class-information dl dd {
140
+ margin: 0;
141
+ padding: 0;
142
+ }
143
+
144
+ .attributes .perm {
145
+ font-style: normal;
146
+ font-size: 80%;
147
+ color: #666;
148
+ }
149
+
150
+ .method-name {
151
+ font-weight: bold;
152
+ }
153
+
154
+ a.method-signature:link ,
155
+ a.method-signature:visited ,
156
+ a.method-signature:hover ,
157
+ a.method-signature {
158
+ text-decoration: none;
159
+ }
160
+
161
+ #footer {
162
+ clear: both;
163
+ margin: 4em 0 1em 0;
164
+ padding: 0.5em 1em;
165
+ text-align: right;
166
+ font-size: 80%;
167
+ color: #333;
168
+ }
169
+
170
+ #footer p {
171
+ margin: 0;
172
+ padding: 0;
173
+ }
174
+
175
+ .ruby-r {
176
+ color: #b72134;
177
+ font-weight: bold;
178
+ }
179
+
180
+ /*
181
+ * source code coloring
182
+ */
183
+
184
+ .ruby-comment {
185
+ color: #666;
186
+ }
187
+
188
+ .ruby-keyword {
189
+ color: #006699;
190
+ }
191
+
192
+ .ruby-identifier {
193
+ }
194
+
195
+ .ruby-ivar {
196
+ color: #990000;
197
+ }
198
+
199
+ .ruby-constant {
200
+ color: #990000;
201
+ }
202
+
203
+ .ruby-node {
204
+ color: #006633;
205
+ }
206
+
207
+ .ruby-operator {
208
+ }
209
+
210
+
data/test/resh_test.rb ADDED
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ require "test/unit"
4
+ class ReshTest < Test::Unit::TestCase
5
+ def test_require
6
+ require "rubygems"
7
+ assert_nothing_raised do
8
+ require "resh/resh"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,2 @@
1
+ require 'test/unit'
2
+
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.4
3
+ specification_version: 1
4
+ name: resh
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.0.1
7
+ date: 2007-10-09 00:00:00 +09:00
8
+ summary: A RDoc template.
9
+ require_paths:
10
+ - lib
11
+ email: cho45@lowreal.net
12
+ homepage: http://coderepos.org/share/wiki/Resh
13
+ rubyforge_project: lowreal
14
+ description: A RDoc template.
15
+ autorequire: rdoc/generators/template/html/resh
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ -
22
+ - ">"
23
+ - !ruby/object:Gem::Version
24
+ version: 0.0.0
25
+ version:
26
+ platform: ruby
27
+ signing_key:
28
+ cert_chain:
29
+ post_install_message:
30
+ authors:
31
+ - cho45
32
+ files:
33
+ - README
34
+ - ChangeLog
35
+ - Rakefile
36
+ - test/resh_test.rb
37
+ - test/test_helper.rb
38
+ - lib/rdoc
39
+ - lib/rdoc/generators
40
+ - lib/rdoc/generators/template
41
+ - lib/rdoc/generators/template/html
42
+ - lib/rdoc/generators/template/html/resh
43
+ - lib/rdoc/generators/template/html/resh.rb
44
+ - lib/rdoc/generators/template/html/resh/class.rhtml
45
+ - lib/rdoc/generators/template/html/resh/file.rhtml
46
+ - lib/rdoc/generators/template/html/resh/index.rhtml
47
+ - lib/rdoc/generators/template/html/resh/resh.rb
48
+ - lib/rdoc/generators/template/html/resh/style.css
49
+ test_files:
50
+ - test/test_helper.rb
51
+ rdoc_options:
52
+ - "--title"
53
+ - resh documentation
54
+ - "--charset"
55
+ - utf-8
56
+ - "--opname"
57
+ - index.html
58
+ - "--line-numbers"
59
+ - "--main"
60
+ - README
61
+ - "--inline-source"
62
+ - "--exclude"
63
+ - "^(examples|extras)/"
64
+ extra_rdoc_files:
65
+ - README
66
+ - ChangeLog
67
+ executables: []
68
+ extensions: []
69
+ requirements: []
70
+ dependencies: []