gerbil 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -2,29 +2,40 @@
2
2
  # See the file named LICENSE for details.
3
3
 
4
4
  require 'rake/clean'
5
+ require 'rake/rdoctask'
5
6
  require 'rake/gempackagetask'
6
7
 
7
8
  # documentation
8
- desc "Generate documentation."
9
- task :doc => 'doc/guide.html'
9
+ desc "Build the documentation."
10
+ task :doc
10
11
 
12
+ # the user guide
11
13
  file 'doc/guide.html' => 'doc/guide.erb' do |t|
12
14
  sh "ruby bin/gerbil html #{t.prerequisites} > #{t.name}"
13
15
  end
14
-
16
+ task :doc => 'doc/guide.html'
15
17
  CLOBBER.include 'doc/guide.html'
16
18
 
19
+ # API reference
20
+ Rake::RDocTask.new 'doc/api' do |t|
21
+ t.rdoc_dir = t.name
22
+ t.rdoc_files.exclude('_darcs', 'pkg').include('**/*.rb')
23
+ end
24
+ task :doc => 'doc/api'
25
+
17
26
  # packaging
18
27
  require 'lib/gerbil' # project info
19
28
 
20
29
  spec = Gem::Specification.new do |s|
21
- s.name = 'gerbil'
22
- s.version = Gerbil[:version]
23
- s.summary = 'Extensible document generator based on eRuby.'
24
- s.description = s.summary
25
- s.homepage = Gerbil[:website]
26
- s.files = FileList['**/*'].exclude('_darcs')
27
- s.executables = s.name
30
+ s.name = Gerbil[:name].downcase
31
+ s.version = Gerbil[:version]
32
+ s.summary = 'Extensible document generator based on eRuby.'
33
+ s.description = s.summary
34
+ s.homepage = Gerbil[:website]
35
+ s.files = FileList['**/*'].exclude('_darcs')
36
+ s.executables = s.name
37
+ s.rubyforge_project = s.name
38
+ s.has_rdoc = true
28
39
 
29
40
  s.add_dependency 'RedCloth' # needed by the default 'html' format
30
41
  s.add_dependency 'coderay' # needed by the default 'html' format
@@ -36,8 +47,8 @@ require 'rake/gempackagetask'
36
47
  end
37
48
 
38
49
  # releasing
39
- desc 'Build packages for distribution.'
40
- task :release => [:clobber, :doc] do
50
+ desc 'Build release packages.'
51
+ task :dist => [:clobber, :doc] do
41
52
  system 'rake package'
42
53
  end
43
54
 
data/bin/gerbil CHANGED
@@ -118,8 +118,9 @@ if __FILE__ == $0 or File.basename(__FILE__) == File.basename($0)
118
118
  end
119
119
 
120
120
  opts.on '-v', '--version', 'show version information' do
121
- puts "%s %s (%s) %s %s" %
122
- [:name, :version, :release, :website, :home].map { |m| Gerbil[m] }
121
+ puts "%s %s (%s) %s %s" % [
122
+ :name, :version, :release, :website, :home
123
+ ].map {|m| Gerbil[m] }
123
124
  exit
124
125
  end
125
126
 
@@ -157,11 +158,11 @@ if __FILE__ == $0 or File.basename(__FILE__) == File.basename($0)
157
158
  template = Template.new('INPUT', input)
158
159
 
159
160
  templateVars = {
160
- :@spec => specData,
161
+ :@spec => specData,
161
162
  :@roots => roots = [], # root nodes of all trees
162
163
  :@nodes => nodes = [], # all nodes in the forest
163
164
  :@types => types = Hash.new {|h,k| h[k] = []}, # nodes by type
164
- }.each_pair { |k,v| template.instance_variable_set(k, v) }
165
+ }.each_pair {|k,v| template.instance_variable_set(k, v) }
165
166
 
166
167
  nodeDefs = specData['nodes'].each_pair do |name, info|
167
168
  template.instance_eval %{
@@ -0,0 +1,164 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: RDoc</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">RDoc</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/gerbil/rdoc_rb.html">
59
+ lib/gerbil/rdoc.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+
76
+
77
+ </div>
78
+
79
+ <div id="method-list">
80
+ <h3 class="section-bar">Methods</h3>
81
+
82
+ <div class="name-list">
83
+ <a href="#M000005">gen_method_infos</a>&nbsp;&nbsp;
84
+ <a href="#M000004">gen_parse_trees</a>&nbsp;&nbsp;
85
+ </div>
86
+ </div>
87
+
88
+ </div>
89
+
90
+
91
+ <!-- if includes -->
92
+
93
+ <div id="section">
94
+
95
+ <div id="class-list">
96
+ <h3 class="section-bar">Classes and Modules</h3>
97
+
98
+ Module <a href="RDoc/DummyMixin.html" class="link">RDoc::DummyMixin</a><br />
99
+ Class <a href="RDoc/DummyMarkup.html" class="link">RDoc::DummyMarkup</a><br />
100
+ Class <a href="RDoc/DummyOptions.html" class="link">RDoc::DummyOptions</a><br />
101
+
102
+ </div>
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+ <!-- if method_list -->
111
+ <div id="methods">
112
+ <h3 class="section-bar">Public Class methods</h3>
113
+
114
+ <div id="method-M000005" class="method-detail">
115
+ <a name="M000005"></a>
116
+
117
+ <div class="method-heading">
118
+ <a href="RDoc.src/M000005.html" target="Code" class="method-signature"
119
+ onclick="popupCode('RDoc.src/M000005.html');return false;">
120
+ <span class="method-name">gen_method_infos</span><span class="method-args">(*aParseTrees)</span>
121
+ </a>
122
+ </div>
123
+
124
+ <div class="method-description">
125
+ <p>
126
+ Returns an array of hashes describing all methods present in the given
127
+ parse trees (which are produced by RDoc::gen_parse_trees).
128
+ </p>
129
+ </div>
130
+ </div>
131
+
132
+ <div id="method-M000004" class="method-detail">
133
+ <a name="M000004"></a>
134
+
135
+ <div class="method-heading">
136
+ <a href="RDoc.src/M000004.html" target="Code" class="method-signature"
137
+ onclick="popupCode('RDoc.src/M000004.html');return false;">
138
+ <span class="method-name">gen_parse_trees</span><span class="method-args">(aCode, aFileName = __FILE__)</span>
139
+ </a>
140
+ </div>
141
+
142
+ <div class="method-description">
143
+ <p>
144
+ Returns an array of <a href="RDoc.html">RDoc</a> parse trees for the given
145
+ code. If the file name (which signifies the origin of the given code) is
146
+ given, it MUST have a &quot;.rb&quot; file extension. Otherwise, <a
147
+ href="RDoc.html">RDoc</a> will give you an empty parse tree! :-(
148
+ </p>
149
+ </div>
150
+ </div>
151
+
152
+
153
+ </div>
154
+
155
+
156
+ </div>
157
+
158
+
159
+ <div id="validator-badges">
160
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
161
+ </div>
162
+
163
+ </body>
164
+ </html>
@@ -0,0 +1,26 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>gen_parse_trees (RDoc)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/gerbil/rdoc.rb, line 33</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gen_parse_trees</span> <span class="ruby-identifier">aCode</span>, <span class="ruby-identifier">aFileName</span> = <span class="ruby-keyword kw">__FILE__</span>
15
+ <span class="ruby-identifier">root</span> = <span class="ruby-constant">TopLevel</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">aFileName</span>)
16
+ <span class="ruby-identifier">parser</span> = <span class="ruby-constant">ParserFactory</span>.<span class="ruby-identifier">parser_for</span>(<span class="ruby-identifier">root</span>, <span class="ruby-identifier">aFileName</span>, <span class="ruby-identifier">aCode</span>, <span class="ruby-constant">DummyOptions</span>.<span class="ruby-identifier">new</span>, <span class="ruby-constant">Stats</span>.<span class="ruby-identifier">new</span>)
17
+ <span class="ruby-identifier">info</span> = <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">scan</span>
18
+
19
+ <span class="ruby-identifier">info</span>.<span class="ruby-identifier">requires</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span>
20
+ <span class="ruby-identifier">f</span> = <span class="ruby-identifier">r</span>.<span class="ruby-identifier">name</span>
21
+ <span class="ruby-identifier">f</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">'.rb'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span> <span class="ruby-identifier">f</span>
22
+ <span class="ruby-identifier">gen_parse_trees</span> <span class="ruby-identifier">f</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span> <span class="ruby-identifier">f</span>
23
+ <span class="ruby-keyword kw">end</span>.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">compact</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">info</span>
24
+ <span class="ruby-keyword kw">end</span></pre>
25
+ </body>
26
+ </html>
@@ -0,0 +1,59 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>gen_method_infos (RDoc)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/gerbil/rdoc.rb, line 47</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gen_method_infos</span> <span class="ruby-operator">*</span><span class="ruby-identifier">aParseTrees</span>
15
+ <span class="ruby-identifier">meths</span> = <span class="ruby-identifier">aParseTrees</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
16
+ [<span class="ruby-identifier">i</span>, <span class="ruby-identifier">i</span>.<span class="ruby-identifier">classes</span>, <span class="ruby-identifier">i</span>.<span class="ruby-identifier">modules</span>].<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">j</span><span class="ruby-operator">|</span> <span class="ruby-identifier">j</span>.<span class="ruby-identifier">method_list</span> }
17
+ <span class="ruby-keyword kw">end</span>.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">uniq</span>
18
+
19
+ <span class="ruby-identifier">meths</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
20
+ <span class="ruby-comment cmt"># determine full path to method (Module::Class::...::method)</span>
21
+ <span class="ruby-identifier">hier</span> = []
22
+ <span class="ruby-identifier">root</span> = <span class="ruby-identifier">m</span>.<span class="ruby-identifier">parent</span>
23
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">root</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">root</span>.<span class="ruby-identifier">parent</span>
24
+ <span class="ruby-identifier">hier</span>.<span class="ruby-identifier">unshift</span> <span class="ruby-identifier">root</span>
25
+ <span class="ruby-identifier">root</span> = <span class="ruby-identifier">root</span>.<span class="ruby-identifier">parent</span>
26
+ <span class="ruby-keyword kw">end</span>
27
+
28
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hier</span>.<span class="ruby-identifier">empty?</span>
29
+ <span class="ruby-identifier">path</span> = <span class="ruby-identifier">m</span>.<span class="ruby-identifier">name</span>
30
+ <span class="ruby-keyword kw">else</span>
31
+ <span class="ruby-identifier">path</span> = <span class="ruby-identifier">hier</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">name</span>}.<span class="ruby-identifier">join</span>(<span class="ruby-value str">'::'</span>)
32
+ <span class="ruby-identifier">path</span> = [<span class="ruby-identifier">path</span>, <span class="ruby-identifier">m</span>.<span class="ruby-identifier">name</span>].<span class="ruby-identifier">join</span>(<span class="ruby-identifier">m</span>.<span class="ruby-identifier">singleton</span> <span class="ruby-value">? </span><span class="ruby-value str">'::'</span> <span class="ruby-operator">:</span> <span class="ruby-value str">'#'</span>)
33
+ <span class="ruby-keyword kw">end</span>
34
+
35
+ <span class="ruby-comment cmt"># determine argument string for method</span>
36
+ <span class="ruby-identifier">args</span> = <span class="ruby-identifier">m</span>.<span class="ruby-identifier">params</span>
37
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">block_params</span>
38
+ <span class="ruby-identifier">args</span>.<span class="ruby-identifier">sub!</span> <span class="ruby-regexp re">%r/\#.*(?=.$)/</span>, <span class="ruby-value str">''</span>
39
+ <span class="ruby-identifier">args</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot; { |#{m.block_params}| ... }&quot;</span>
40
+ <span class="ruby-keyword kw">end</span>
41
+
42
+ {
43
+ <span class="ruby-identifier">:file</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">root</span>.<span class="ruby-identifier">file_absolute_name</span>,
44
+ <span class="ruby-identifier">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">path</span>,
45
+ <span class="ruby-identifier">:args</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">args</span>,
46
+ <span class="ruby-identifier">:decl</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">path</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">args</span>,
47
+ <span class="ruby-identifier">:docs</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">comment</span>,
48
+ <span class="ruby-identifier">:docs_html</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">DummyMarkup</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">markup</span>(<span class="ruby-identifier">m</span>.<span class="ruby-identifier">comment</span>),
49
+
50
+ <span class="ruby-comment cmt"># nodes in the parse tree</span>
51
+ <span class="ruby-identifier">:node</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">m</span>,
52
+ <span class="ruby-identifier">:root</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">root</span>,
53
+ <span class="ruby-comment cmt"># for top level methods, info.parent == root</span>
54
+ <span class="ruby-comment cmt"># for class methods, info.singleton == true</span>
55
+ }
56
+ <span class="ruby-keyword kw">end</span>
57
+ <span class="ruby-keyword kw">end</span></pre>
58
+ </body>
59
+ </html>
@@ -0,0 +1,119 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: RDoc::DummyMarkup</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">RDoc::DummyMarkup</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/gerbil/rdoc_rb.html">
59
+ lib/gerbil/rdoc.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+
82
+
83
+ </div>
84
+
85
+
86
+ </div>
87
+
88
+
89
+ <!-- if includes -->
90
+ <div id="includes">
91
+ <h3 class="section-bar">Included Modules</h3>
92
+
93
+ <div id="includes-list">
94
+ <span class="include-name">Generators::MarkUp</span>
95
+ <span class="include-name"><a href="DummyMixin.html">DummyMixin</a></span>
96
+ </div>
97
+ </div>
98
+
99
+ <div id="section">
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+ <!-- if method_list -->
109
+
110
+
111
+ </div>
112
+
113
+
114
+ <div id="validator-badges">
115
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
116
+ </div>
117
+
118
+ </body>
119
+ </html>