voloko-sdoc 0.1.7 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +21 -0
- data/VERSION.yml +4 -0
- data/lib/sdoc/generator/shtml.rb +1 -4
- data/lib/sdoc.rb +0 -1
- metadata +32 -101
- data/rdoc/History.txt +0 -254
- data/rdoc/Manifest.txt +0 -126
- data/rdoc/README.txt +0 -47
- data/rdoc/RI.txt +0 -58
- data/rdoc/Rakefile +0 -70
- data/rdoc/bin/rdoc +0 -35
- data/rdoc/bin/ri +0 -5
- data/rdoc/lib/rdoc/alias.rb +0 -54
- data/rdoc/lib/rdoc/anon_class.rb +0 -10
- data/rdoc/lib/rdoc/any_method.rb +0 -190
- data/rdoc/lib/rdoc/attr.rb +0 -79
- data/rdoc/lib/rdoc/cache.rb +0 -41
- data/rdoc/lib/rdoc/class_module.rb +0 -87
- data/rdoc/lib/rdoc/code_object.rb +0 -152
- data/rdoc/lib/rdoc/code_objects.rb +0 -23
- data/rdoc/lib/rdoc/constant.rb +0 -36
- data/rdoc/lib/rdoc/context.rb +0 -712
- data/rdoc/lib/rdoc/diagram.rb +0 -340
- data/rdoc/lib/rdoc/dot.rb +0 -249
- data/rdoc/lib/rdoc/generator/darkfish.rb +0 -455
- data/rdoc/lib/rdoc/generator/markup.rb +0 -194
- data/rdoc/lib/rdoc/generator/ri.rb +0 -230
- data/rdoc/lib/rdoc/generator/template/darkfish/classpage.rhtml +0 -281
- data/rdoc/lib/rdoc/generator/template/darkfish/filepage.rhtml +0 -112
- data/rdoc/lib/rdoc/generator/template/darkfish/images/brick.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/brick_link.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/bug.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/bullet_black.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/date.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/find.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/package.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/page_green.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/page_white_text.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/page_white_width.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/plugin.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/ruby.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/tag_green.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/wrench.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/wrench_orange.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/zoom.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/index.rhtml +0 -64
- data/rdoc/lib/rdoc/generator/template/darkfish/js/darkfish.js +0 -116
- data/rdoc/lib/rdoc/generator/template/darkfish/js/jquery.js +0 -32
- data/rdoc/lib/rdoc/generator/template/darkfish/js/quicksearch.js +0 -114
- data/rdoc/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js +0 -10
- data/rdoc/lib/rdoc/generator/template/darkfish/rdoc.css +0 -696
- data/rdoc/lib/rdoc/generator.rb +0 -8
- data/rdoc/lib/rdoc/ghost_method.rb +0 -8
- data/rdoc/lib/rdoc/include.rb +0 -39
- data/rdoc/lib/rdoc/known_classes.rb +0 -68
- data/rdoc/lib/rdoc/markup/attribute_manager.rb +0 -311
- data/rdoc/lib/rdoc/markup/formatter.rb +0 -25
- data/rdoc/lib/rdoc/markup/fragments.rb +0 -377
- data/rdoc/lib/rdoc/markup/inline.rb +0 -126
- data/rdoc/lib/rdoc/markup/lines.rb +0 -156
- data/rdoc/lib/rdoc/markup/preprocess.rb +0 -80
- data/rdoc/lib/rdoc/markup/to_flow.rb +0 -211
- data/rdoc/lib/rdoc/markup/to_html.rb +0 -406
- data/rdoc/lib/rdoc/markup/to_html_crossref.rb +0 -140
- data/rdoc/lib/rdoc/markup/to_latex.rb +0 -328
- data/rdoc/lib/rdoc/markup/to_test.rb +0 -53
- data/rdoc/lib/rdoc/markup/to_texinfo.rb +0 -73
- data/rdoc/lib/rdoc/markup.rb +0 -378
- data/rdoc/lib/rdoc/meta_method.rb +0 -8
- data/rdoc/lib/rdoc/normal_class.rb +0 -18
- data/rdoc/lib/rdoc/normal_module.rb +0 -34
- data/rdoc/lib/rdoc/options.rb +0 -542
- data/rdoc/lib/rdoc/parser/c.rb +0 -678
- data/rdoc/lib/rdoc/parser/perl.rb +0 -165
- data/rdoc/lib/rdoc/parser/ruby.rb +0 -2904
- data/rdoc/lib/rdoc/parser/simple.rb +0 -39
- data/rdoc/lib/rdoc/parser.rb +0 -138
- data/rdoc/lib/rdoc/rdoc.rb +0 -375
- data/rdoc/lib/rdoc/require.rb +0 -32
- data/rdoc/lib/rdoc/ri/cache.rb +0 -187
- data/rdoc/lib/rdoc/ri/descriptions.rb +0 -156
- data/rdoc/lib/rdoc/ri/display.rb +0 -340
- data/rdoc/lib/rdoc/ri/driver.rb +0 -828
- data/rdoc/lib/rdoc/ri/formatter.rb +0 -654
- data/rdoc/lib/rdoc/ri/paths.rb +0 -93
- data/rdoc/lib/rdoc/ri/reader.rb +0 -106
- data/rdoc/lib/rdoc/ri/util.rb +0 -79
- data/rdoc/lib/rdoc/ri/writer.rb +0 -68
- data/rdoc/lib/rdoc/ri.rb +0 -8
- data/rdoc/lib/rdoc/single_class.rb +0 -8
- data/rdoc/lib/rdoc/stats.rb +0 -178
- data/rdoc/lib/rdoc/task.rb +0 -276
- data/rdoc/lib/rdoc/tokenstream.rb +0 -33
- data/rdoc/lib/rdoc/top_level.rb +0 -242
- data/rdoc/lib/rdoc.rb +0 -398
data/rdoc/lib/rdoc/task.rb
DELETED
@@ -1,276 +0,0 @@
|
|
1
|
-
# Copyright (c) 2003, 2004 Jim Weirich, 2009 Eric Hodel
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
# a copy of this software and associated documentation files (the
|
5
|
-
# "Software"), to deal in the Software without restriction, including
|
6
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
# the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be
|
12
|
-
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
-
|
22
|
-
require 'rubygems'
|
23
|
-
begin
|
24
|
-
gem 'rdoc'
|
25
|
-
rescue Gem::LoadError
|
26
|
-
end
|
27
|
-
|
28
|
-
begin
|
29
|
-
gem 'rake'
|
30
|
-
rescue Gem::LoadError
|
31
|
-
end
|
32
|
-
|
33
|
-
require 'rdoc'
|
34
|
-
require 'rake'
|
35
|
-
require 'rake/tasklib'
|
36
|
-
|
37
|
-
##
|
38
|
-
# Create a documentation task that will generate the RDoc files for a project.
|
39
|
-
#
|
40
|
-
# The RDoc::Task will create the following targets:
|
41
|
-
#
|
42
|
-
# [<b><em>rdoc</em></b>]
|
43
|
-
# Main task for this RDoc task.
|
44
|
-
#
|
45
|
-
# [<b>:clobber_<em>rdoc</em></b>]
|
46
|
-
# Delete all the rdoc files. This target is automatically added to the main
|
47
|
-
# clobber target.
|
48
|
-
#
|
49
|
-
# [<b>:re<em>rdoc</em></b>]
|
50
|
-
# Rebuild the rdoc files from scratch, even if they are not out of date.
|
51
|
-
#
|
52
|
-
# Simple Example:
|
53
|
-
#
|
54
|
-
# RDoc::Task.new do |rd|
|
55
|
-
# rd.main = "README.rdoc"
|
56
|
-
# rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
|
57
|
-
# end
|
58
|
-
#
|
59
|
-
# The +rd+ object passed to the block is an RDoc::Task object. See the
|
60
|
-
# attributes list for the RDoc::Task class for available customization options.
|
61
|
-
#
|
62
|
-
# == Specifying different task names
|
63
|
-
#
|
64
|
-
# You may wish to give the task a different name, such as if you are
|
65
|
-
# generating two sets of documentation. For instance, if you want to have a
|
66
|
-
# development set of documentation including private methods:
|
67
|
-
#
|
68
|
-
# RDoc::Task.new :rdoc_dev do |rd|
|
69
|
-
# rd.main = "README.doc"
|
70
|
-
# rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
|
71
|
-
# rd.options << "--all"
|
72
|
-
# end
|
73
|
-
#
|
74
|
-
# The tasks would then be named :<em>rdoc_dev</em>,
|
75
|
-
# :clobber_<em>rdoc_dev</em>, and :re<em>rdoc_dev</em>.
|
76
|
-
#
|
77
|
-
# If you wish to have completely different task names, then pass a Hash as
|
78
|
-
# first argument. With the <tt>:rdoc</tt>, <tt>:clobber_rdoc</tt> and
|
79
|
-
# <tt>:rerdoc</tt> options, you can customize the task names to your liking.
|
80
|
-
#
|
81
|
-
# For example:
|
82
|
-
#
|
83
|
-
# RDoc::Task.new(:rdoc => "rdoc", :clobber_rdoc => "rdoc:clean",
|
84
|
-
# :rerdoc => "rdoc:force")
|
85
|
-
#
|
86
|
-
# This will create the tasks <tt>:rdoc</tt>, <tt>:rdoc_clean</tt> and
|
87
|
-
# <tt>:rdoc:force</tt>.
|
88
|
-
|
89
|
-
class RDoc::Task < Rake::TaskLib
|
90
|
-
|
91
|
-
##
|
92
|
-
# Name of the main, top level task. (default is :rdoc)
|
93
|
-
|
94
|
-
attr_accessor :name
|
95
|
-
|
96
|
-
##
|
97
|
-
# Name of directory to receive the html output files. (default is "html")
|
98
|
-
|
99
|
-
attr_accessor :rdoc_dir
|
100
|
-
|
101
|
-
##
|
102
|
-
# Title of RDoc documentation. (defaults to rdoc's default)
|
103
|
-
|
104
|
-
attr_accessor :title
|
105
|
-
|
106
|
-
##
|
107
|
-
# Name of file to be used as the main, top level file of the RDoc. (default
|
108
|
-
# is none)
|
109
|
-
|
110
|
-
attr_accessor :main
|
111
|
-
|
112
|
-
##
|
113
|
-
# Name of template to be used by rdoc. (defaults to rdoc's default)
|
114
|
-
|
115
|
-
attr_accessor :template
|
116
|
-
|
117
|
-
##
|
118
|
-
# List of files to be included in the rdoc generation. (default is [])
|
119
|
-
|
120
|
-
attr_accessor :rdoc_files
|
121
|
-
|
122
|
-
##
|
123
|
-
# Additional list of options to be passed rdoc. (default is [])
|
124
|
-
|
125
|
-
attr_accessor :options
|
126
|
-
|
127
|
-
##
|
128
|
-
# Whether to run the rdoc process as an external shell (default is false)
|
129
|
-
|
130
|
-
attr_accessor :external
|
131
|
-
|
132
|
-
##
|
133
|
-
# Create an RDoc task with the given name. See the RDoc::Task class overview
|
134
|
-
# for documentation.
|
135
|
-
|
136
|
-
def initialize(name = :rdoc) # :yield: self
|
137
|
-
if name.is_a? Hash then
|
138
|
-
invalid_options = name.keys.map { |k| k.to_sym } -
|
139
|
-
[:rdoc, :clobber_rdoc, :rerdoc]
|
140
|
-
|
141
|
-
unless invalid_options.empty? then
|
142
|
-
raise ArgumentError, "invalid options: #{invalid_options.join(", ")}"
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
@name = name
|
147
|
-
@rdoc_files = Rake::FileList.new
|
148
|
-
@rdoc_dir = 'html'
|
149
|
-
@main = nil
|
150
|
-
@title = nil
|
151
|
-
@template = nil
|
152
|
-
@external = false
|
153
|
-
@options = []
|
154
|
-
yield self if block_given?
|
155
|
-
define
|
156
|
-
end
|
157
|
-
|
158
|
-
##
|
159
|
-
# Create the tasks defined by this task lib.
|
160
|
-
|
161
|
-
def define
|
162
|
-
if rdoc_task_name != "rdoc" then
|
163
|
-
desc "Build the RDoc HTML Files"
|
164
|
-
else
|
165
|
-
desc "Build the #{rdoc_task_name} HTML Files"
|
166
|
-
end
|
167
|
-
task rdoc_task_name
|
168
|
-
|
169
|
-
desc "Force a rebuild of the RDoc files"
|
170
|
-
task rerdoc_task_name => [clobber_task_name, rdoc_task_name]
|
171
|
-
|
172
|
-
desc "Remove RDoc products"
|
173
|
-
task clobber_task_name do
|
174
|
-
rm_r rdoc_dir rescue nil
|
175
|
-
end
|
176
|
-
|
177
|
-
task :clobber => [clobber_task_name]
|
178
|
-
|
179
|
-
directory @rdoc_dir
|
180
|
-
task rdoc_task_name => [rdoc_target]
|
181
|
-
file rdoc_target => @rdoc_files + [Rake.application.rakefile] do
|
182
|
-
rm_r @rdoc_dir rescue nil
|
183
|
-
@before_running_rdoc.call if @before_running_rdoc
|
184
|
-
args = option_list + @rdoc_files
|
185
|
-
|
186
|
-
if @external then
|
187
|
-
argstring = args.join(' ')
|
188
|
-
sh %{ruby -Ivendor vendor/rd #{argstring}}
|
189
|
-
else
|
190
|
-
if Rake.application.options.trace then
|
191
|
-
$stderr.puts "rdoc #{args.join ' '}"
|
192
|
-
end
|
193
|
-
require 'rdoc/rdoc'
|
194
|
-
RDoc::RDoc.new.document(args)
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
self
|
199
|
-
end
|
200
|
-
|
201
|
-
def option_list
|
202
|
-
result = @options.dup
|
203
|
-
result << "-o" << @rdoc_dir
|
204
|
-
result << "--main" << quote(main) if main
|
205
|
-
result << "--title" << quote(title) if title
|
206
|
-
result << "-T" << quote(template) if template
|
207
|
-
result
|
208
|
-
end
|
209
|
-
|
210
|
-
def quote(str)
|
211
|
-
if @external
|
212
|
-
"'#{str}'"
|
213
|
-
else
|
214
|
-
str
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
|
-
def option_string
|
219
|
-
option_list.join(' ')
|
220
|
-
end
|
221
|
-
|
222
|
-
##
|
223
|
-
# The block passed to this method will be called just before running the
|
224
|
-
# RDoc generator. It is allowed to modify RDoc::Task attributes inside the
|
225
|
-
# block.
|
226
|
-
|
227
|
-
def before_running_rdoc(&block)
|
228
|
-
@before_running_rdoc = block
|
229
|
-
end
|
230
|
-
|
231
|
-
private
|
232
|
-
|
233
|
-
def rdoc_target
|
234
|
-
"#{rdoc_dir}/index.html"
|
235
|
-
end
|
236
|
-
|
237
|
-
def rdoc_task_name
|
238
|
-
case name
|
239
|
-
when Hash
|
240
|
-
(name[:rdoc] || "rdoc").to_s
|
241
|
-
else
|
242
|
-
name.to_s
|
243
|
-
end
|
244
|
-
end
|
245
|
-
|
246
|
-
def clobber_task_name
|
247
|
-
case name
|
248
|
-
when Hash
|
249
|
-
(name[:clobber_rdoc] || "clobber_rdoc").to_s
|
250
|
-
else
|
251
|
-
"clobber_#{name}"
|
252
|
-
end
|
253
|
-
end
|
254
|
-
|
255
|
-
def rerdoc_task_name
|
256
|
-
case name
|
257
|
-
when Hash
|
258
|
-
(name[:rerdoc] || "rerdoc").to_s
|
259
|
-
else
|
260
|
-
"re#{name}"
|
261
|
-
end
|
262
|
-
end
|
263
|
-
|
264
|
-
end
|
265
|
-
|
266
|
-
# :stopdoc:
|
267
|
-
module Rake
|
268
|
-
|
269
|
-
##
|
270
|
-
# For backwards compatibility
|
271
|
-
|
272
|
-
RDocTask = RDoc::Task
|
273
|
-
|
274
|
-
end
|
275
|
-
# :startdoc:
|
276
|
-
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module RDoc; end
|
2
|
-
|
3
|
-
##
|
4
|
-
# A TokenStream is a list of tokens, gathered during the parse of some entity
|
5
|
-
# (say a method). Entities populate these streams by being registered with the
|
6
|
-
# lexer. Any class can collect tokens by including TokenStream. From the
|
7
|
-
# outside, you use such an object by calling the start_collecting_tokens
|
8
|
-
# method, followed by calls to add_token and pop_token.
|
9
|
-
|
10
|
-
module RDoc::TokenStream
|
11
|
-
|
12
|
-
def token_stream
|
13
|
-
@token_stream
|
14
|
-
end
|
15
|
-
|
16
|
-
def start_collecting_tokens
|
17
|
-
@token_stream = []
|
18
|
-
end
|
19
|
-
|
20
|
-
def add_token(tk)
|
21
|
-
@token_stream << tk
|
22
|
-
end
|
23
|
-
|
24
|
-
def add_tokens(tks)
|
25
|
-
tks.each {|tk| add_token(tk)}
|
26
|
-
end
|
27
|
-
|
28
|
-
def pop_token
|
29
|
-
@token_stream.pop
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
|
data/rdoc/lib/rdoc/top_level.rb
DELETED
@@ -1,242 +0,0 @@
|
|
1
|
-
require 'thread'
|
2
|
-
require 'rdoc/context'
|
3
|
-
|
4
|
-
##
|
5
|
-
# A TopLevel context is a representation of the contents of a single file
|
6
|
-
|
7
|
-
class RDoc::TopLevel < RDoc::Context
|
8
|
-
|
9
|
-
##
|
10
|
-
# This TopLevel's File::Stat struct
|
11
|
-
|
12
|
-
attr_accessor :file_stat
|
13
|
-
|
14
|
-
##
|
15
|
-
# Relative name of this file
|
16
|
-
|
17
|
-
attr_accessor :relative_name
|
18
|
-
|
19
|
-
##
|
20
|
-
# Absolute name of this file
|
21
|
-
|
22
|
-
attr_accessor :absolute_name
|
23
|
-
|
24
|
-
attr_accessor :diagram
|
25
|
-
|
26
|
-
##
|
27
|
-
# The parser that processed this file
|
28
|
-
|
29
|
-
attr_accessor :parser
|
30
|
-
|
31
|
-
##
|
32
|
-
# Returns all classes and modules discovered by RDoc
|
33
|
-
|
34
|
-
def self.all_classes_and_modules
|
35
|
-
classes_hash.values + modules_hash.values
|
36
|
-
end
|
37
|
-
|
38
|
-
##
|
39
|
-
# Returns all classes discovered by RDoc
|
40
|
-
|
41
|
-
def self.classes
|
42
|
-
classes_hash.values
|
43
|
-
end
|
44
|
-
|
45
|
-
##
|
46
|
-
# Hash of all classes known to RDoc
|
47
|
-
|
48
|
-
def self.classes_hash
|
49
|
-
@all_classes
|
50
|
-
end
|
51
|
-
|
52
|
-
##
|
53
|
-
# All TopLevels known to RDoc
|
54
|
-
|
55
|
-
def self.files
|
56
|
-
@all_files.values
|
57
|
-
end
|
58
|
-
|
59
|
-
##
|
60
|
-
# Hash of all files known to RDoc
|
61
|
-
|
62
|
-
def self.files_hash
|
63
|
-
@all_files
|
64
|
-
end
|
65
|
-
|
66
|
-
##
|
67
|
-
# Finds the class with +name+ in all discovered classes
|
68
|
-
|
69
|
-
def self.find_class_named(name)
|
70
|
-
@lock.synchronize do
|
71
|
-
classes_hash.values.find do |c|
|
72
|
-
c.find_class_named name
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
##
|
78
|
-
# Finds the file with +name+ in all discovered files
|
79
|
-
|
80
|
-
def self.find_file_named(name)
|
81
|
-
@lock.synchronize do
|
82
|
-
@all_files[name]
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
##
|
87
|
-
# Finds the module with +name+ in all discovered modules
|
88
|
-
|
89
|
-
def self.find_module_named(name)
|
90
|
-
@lock.synchronize do
|
91
|
-
modules_hash.values.find do |c|
|
92
|
-
c.find_module_named name
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
@lock = Mutex.new
|
98
|
-
|
99
|
-
##
|
100
|
-
# Lock for global class, module and file stores
|
101
|
-
|
102
|
-
def self.lock
|
103
|
-
@lock
|
104
|
-
end
|
105
|
-
|
106
|
-
##
|
107
|
-
# Returns all modules discovered by RDoc
|
108
|
-
|
109
|
-
def self.modules
|
110
|
-
modules_hash.values
|
111
|
-
end
|
112
|
-
|
113
|
-
##
|
114
|
-
# Hash of all modules known to RDoc
|
115
|
-
|
116
|
-
def self.modules_hash
|
117
|
-
@all_modules
|
118
|
-
end
|
119
|
-
|
120
|
-
##
|
121
|
-
# Empties RDoc of stored class, module and file information
|
122
|
-
|
123
|
-
def self.reset
|
124
|
-
@lock.synchronize do
|
125
|
-
@all_classes = {}
|
126
|
-
@all_modules = {}
|
127
|
-
@all_files = {}
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
reset
|
132
|
-
|
133
|
-
##
|
134
|
-
# Creates a new TopLevel for +file_name+
|
135
|
-
|
136
|
-
def initialize(file_name)
|
137
|
-
super()
|
138
|
-
@name = nil
|
139
|
-
@relative_name = file_name
|
140
|
-
@absolute_name = file_name
|
141
|
-
@file_stat = File.stat(file_name) rescue nil # HACK for testing
|
142
|
-
@diagram = nil
|
143
|
-
@parser = nil
|
144
|
-
|
145
|
-
RDoc::TopLevel.lock.synchronize do
|
146
|
-
RDoc::TopLevel.files_hash[file_name] = self
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
##
|
151
|
-
# Adds +method+ to Object instead of RDoc::TopLevel
|
152
|
-
|
153
|
-
def add_method(method)
|
154
|
-
object = self.class.find_class_named 'Object'
|
155
|
-
object = add_class RDoc::NormalClass, 'Object' unless object
|
156
|
-
|
157
|
-
object.add_method method
|
158
|
-
end
|
159
|
-
|
160
|
-
##
|
161
|
-
# Base name of this file
|
162
|
-
|
163
|
-
def base_name
|
164
|
-
File.basename @absolute_name
|
165
|
-
end
|
166
|
-
|
167
|
-
##
|
168
|
-
# Find class or module named +symbol+ in all discovered classes and
|
169
|
-
# modules
|
170
|
-
|
171
|
-
def find_class_or_module_named(symbol)
|
172
|
-
RDoc::TopLevel.classes_hash.each_value do |c|
|
173
|
-
return c if c.full_name == symbol
|
174
|
-
end
|
175
|
-
|
176
|
-
RDoc::TopLevel.modules_hash.each_value do |m|
|
177
|
-
return m if m.full_name == symbol
|
178
|
-
end
|
179
|
-
|
180
|
-
nil
|
181
|
-
end
|
182
|
-
|
183
|
-
##
|
184
|
-
# Finds a class or module named +symbol+
|
185
|
-
|
186
|
-
def find_local_symbol(symbol)
|
187
|
-
find_class_or_module_named(symbol) || super
|
188
|
-
end
|
189
|
-
|
190
|
-
##
|
191
|
-
# Finds a module or class with +name+
|
192
|
-
|
193
|
-
def find_module_named(name)
|
194
|
-
find_class_or_module_named(name) || find_enclosing_module_named(name)
|
195
|
-
end
|
196
|
-
|
197
|
-
##
|
198
|
-
# The name of this file
|
199
|
-
|
200
|
-
def full_name
|
201
|
-
@relative_name
|
202
|
-
end
|
203
|
-
|
204
|
-
##
|
205
|
-
# URL for this with a +prefix+
|
206
|
-
|
207
|
-
def http_url(prefix)
|
208
|
-
path = [prefix, @relative_name.tr('.', '_')]
|
209
|
-
|
210
|
-
File.join(*path.compact) + '.html'
|
211
|
-
end
|
212
|
-
|
213
|
-
def inspect # :nodoc:
|
214
|
-
"#<%s:0x%x %p modules: %p classes: %p>" % [
|
215
|
-
self.class, object_id,
|
216
|
-
base_name,
|
217
|
-
@modules.map { |n,m| m },
|
218
|
-
@classes.map { |n,c| c }
|
219
|
-
]
|
220
|
-
end
|
221
|
-
|
222
|
-
##
|
223
|
-
# Date this file was last modified, if known
|
224
|
-
|
225
|
-
def last_modified
|
226
|
-
@file_stat ? file_stat.mtime.to_s : 'Unknown'
|
227
|
-
end
|
228
|
-
|
229
|
-
##
|
230
|
-
# Base name of this file
|
231
|
-
|
232
|
-
alias name base_name
|
233
|
-
|
234
|
-
##
|
235
|
-
# Path to this file
|
236
|
-
|
237
|
-
def path
|
238
|
-
http_url RDoc::RDoc.current.generator.file_dir
|
239
|
-
end
|
240
|
-
|
241
|
-
end
|
242
|
-
|