voloko-sdoc 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/rdoc/History.txt +254 -0
  2. data/rdoc/Manifest.txt +126 -0
  3. data/rdoc/README.txt +47 -0
  4. data/rdoc/RI.txt +58 -0
  5. data/rdoc/Rakefile +70 -0
  6. data/rdoc/bin/rdoc +35 -0
  7. data/rdoc/bin/ri +5 -0
  8. data/rdoc/lib/rdoc/alias.rb +54 -0
  9. data/rdoc/lib/rdoc/anon_class.rb +10 -0
  10. data/rdoc/lib/rdoc/any_method.rb +190 -0
  11. data/rdoc/lib/rdoc/attr.rb +79 -0
  12. data/rdoc/lib/rdoc/cache.rb +41 -0
  13. data/rdoc/lib/rdoc/class_module.rb +87 -0
  14. data/rdoc/lib/rdoc/code_object.rb +152 -0
  15. data/rdoc/lib/rdoc/code_objects.rb +23 -0
  16. data/rdoc/lib/rdoc/constant.rb +36 -0
  17. data/rdoc/lib/rdoc/context.rb +712 -0
  18. data/rdoc/lib/rdoc/diagram.rb +340 -0
  19. data/rdoc/lib/rdoc/dot.rb +249 -0
  20. data/rdoc/lib/rdoc/generator/darkfish.rb +455 -0
  21. data/rdoc/lib/rdoc/generator/markup.rb +194 -0
  22. data/rdoc/lib/rdoc/generator/ri.rb +230 -0
  23. data/rdoc/lib/rdoc/generator/template/darkfish/classpage.rhtml +281 -0
  24. data/rdoc/lib/rdoc/generator/template/darkfish/filepage.rhtml +112 -0
  25. data/rdoc/lib/rdoc/generator/template/darkfish/images/brick.png +0 -0
  26. data/rdoc/lib/rdoc/generator/template/darkfish/images/brick_link.png +0 -0
  27. data/rdoc/lib/rdoc/generator/template/darkfish/images/bug.png +0 -0
  28. data/rdoc/lib/rdoc/generator/template/darkfish/images/bullet_black.png +0 -0
  29. data/rdoc/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png +0 -0
  30. data/rdoc/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png +0 -0
  31. data/rdoc/lib/rdoc/generator/template/darkfish/images/date.png +0 -0
  32. data/rdoc/lib/rdoc/generator/template/darkfish/images/find.png +0 -0
  33. data/rdoc/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif +0 -0
  34. data/rdoc/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png +0 -0
  35. data/rdoc/lib/rdoc/generator/template/darkfish/images/package.png +0 -0
  36. data/rdoc/lib/rdoc/generator/template/darkfish/images/page_green.png +0 -0
  37. data/rdoc/lib/rdoc/generator/template/darkfish/images/page_white_text.png +0 -0
  38. data/rdoc/lib/rdoc/generator/template/darkfish/images/page_white_width.png +0 -0
  39. data/rdoc/lib/rdoc/generator/template/darkfish/images/plugin.png +0 -0
  40. data/rdoc/lib/rdoc/generator/template/darkfish/images/ruby.png +0 -0
  41. data/rdoc/lib/rdoc/generator/template/darkfish/images/tag_green.png +0 -0
  42. data/rdoc/lib/rdoc/generator/template/darkfish/images/wrench.png +0 -0
  43. data/rdoc/lib/rdoc/generator/template/darkfish/images/wrench_orange.png +0 -0
  44. data/rdoc/lib/rdoc/generator/template/darkfish/images/zoom.png +0 -0
  45. data/rdoc/lib/rdoc/generator/template/darkfish/index.rhtml +64 -0
  46. data/rdoc/lib/rdoc/generator/template/darkfish/js/darkfish.js +116 -0
  47. data/rdoc/lib/rdoc/generator/template/darkfish/js/jquery.js +32 -0
  48. data/rdoc/lib/rdoc/generator/template/darkfish/js/quicksearch.js +114 -0
  49. data/rdoc/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js +10 -0
  50. data/rdoc/lib/rdoc/generator/template/darkfish/rdoc.css +696 -0
  51. data/rdoc/lib/rdoc/generator.rb +8 -0
  52. data/rdoc/lib/rdoc/ghost_method.rb +8 -0
  53. data/rdoc/lib/rdoc/include.rb +39 -0
  54. data/rdoc/lib/rdoc/known_classes.rb +68 -0
  55. data/rdoc/lib/rdoc/markup/attribute_manager.rb +311 -0
  56. data/rdoc/lib/rdoc/markup/formatter.rb +25 -0
  57. data/rdoc/lib/rdoc/markup/fragments.rb +377 -0
  58. data/rdoc/lib/rdoc/markup/inline.rb +126 -0
  59. data/rdoc/lib/rdoc/markup/lines.rb +156 -0
  60. data/rdoc/lib/rdoc/markup/preprocess.rb +80 -0
  61. data/rdoc/lib/rdoc/markup/to_flow.rb +211 -0
  62. data/rdoc/lib/rdoc/markup/to_html.rb +406 -0
  63. data/rdoc/lib/rdoc/markup/to_html_crossref.rb +140 -0
  64. data/rdoc/lib/rdoc/markup/to_latex.rb +328 -0
  65. data/rdoc/lib/rdoc/markup/to_test.rb +53 -0
  66. data/rdoc/lib/rdoc/markup/to_texinfo.rb +73 -0
  67. data/rdoc/lib/rdoc/markup.rb +378 -0
  68. data/rdoc/lib/rdoc/meta_method.rb +8 -0
  69. data/rdoc/lib/rdoc/normal_class.rb +18 -0
  70. data/rdoc/lib/rdoc/normal_module.rb +34 -0
  71. data/rdoc/lib/rdoc/options.rb +542 -0
  72. data/rdoc/lib/rdoc/parser/c.rb +678 -0
  73. data/rdoc/lib/rdoc/parser/perl.rb +165 -0
  74. data/rdoc/lib/rdoc/parser/ruby.rb +2904 -0
  75. data/rdoc/lib/rdoc/parser/simple.rb +39 -0
  76. data/rdoc/lib/rdoc/parser.rb +138 -0
  77. data/rdoc/lib/rdoc/rdoc.rb +375 -0
  78. data/rdoc/lib/rdoc/require.rb +32 -0
  79. data/rdoc/lib/rdoc/ri/cache.rb +187 -0
  80. data/rdoc/lib/rdoc/ri/descriptions.rb +156 -0
  81. data/rdoc/lib/rdoc/ri/display.rb +340 -0
  82. data/rdoc/lib/rdoc/ri/driver.rb +828 -0
  83. data/rdoc/lib/rdoc/ri/formatter.rb +654 -0
  84. data/rdoc/lib/rdoc/ri/paths.rb +93 -0
  85. data/rdoc/lib/rdoc/ri/reader.rb +106 -0
  86. data/rdoc/lib/rdoc/ri/util.rb +79 -0
  87. data/rdoc/lib/rdoc/ri/writer.rb +68 -0
  88. data/rdoc/lib/rdoc/ri.rb +8 -0
  89. data/rdoc/lib/rdoc/single_class.rb +8 -0
  90. data/rdoc/lib/rdoc/stats.rb +178 -0
  91. data/rdoc/lib/rdoc/task.rb +276 -0
  92. data/rdoc/lib/rdoc/tokenstream.rb +33 -0
  93. data/rdoc/lib/rdoc/top_level.rb +242 -0
  94. data/rdoc/lib/rdoc.rb +398 -0
  95. metadata +1 -1
@@ -0,0 +1,190 @@
1
+ require 'rdoc/code_object'
2
+ require 'rdoc/tokenstream'
3
+
4
+ ##
5
+ # AnyMethod is the base class for objects representing methods
6
+
7
+ class RDoc::AnyMethod < RDoc::CodeObject
8
+
9
+ ##
10
+ # Method name
11
+
12
+ attr_writer :name
13
+
14
+ ##
15
+ # public, protected, private
16
+
17
+ attr_accessor :visibility
18
+
19
+ ##
20
+ # Parameters yielded by the called block
21
+
22
+ attr_accessor :block_params
23
+
24
+ ##
25
+ # Don't rename \#initialize to \::new
26
+
27
+ attr_accessor :dont_rename_initialize
28
+
29
+ ##
30
+ # Is this a singleton method?
31
+
32
+ attr_accessor :singleton
33
+
34
+ ##
35
+ # Source file token stream
36
+
37
+ attr_reader :text
38
+
39
+ ##
40
+ # Array of other names for this method
41
+
42
+ attr_reader :aliases
43
+
44
+ ##
45
+ # Fragment reference for this method
46
+
47
+ attr_reader :aref
48
+
49
+ ##
50
+ # The method we're aliasing
51
+
52
+ attr_accessor :is_alias_for
53
+
54
+ ##
55
+ # Parameters for this method
56
+
57
+ attr_overridable :params, :param, :parameters, :parameter
58
+
59
+ ##
60
+ # Different ways to call this method
61
+
62
+ attr_accessor :call_seq
63
+
64
+ include RDoc::TokenStream
65
+
66
+ ##
67
+ # Resets method fragment reference counter
68
+
69
+ def self.reset
70
+ @@aref = 'M000000'
71
+ end
72
+
73
+ reset
74
+
75
+ def initialize(text, name)
76
+ super()
77
+ @text = text
78
+ @name = name
79
+ @token_stream = nil
80
+ @visibility = :public
81
+ @dont_rename_initialize = false
82
+ @block_params = nil
83
+ @aliases = []
84
+ @is_alias_for = nil
85
+ @call_seq = nil
86
+
87
+ @aref = @@aref
88
+ @@aref = @@aref.succ
89
+ end
90
+
91
+ ##
92
+ # Order by #singleton then #name
93
+
94
+ def <=>(other)
95
+ [@singleton ? 0 : 1, @name] <=> [other.singleton ? 0 : 1, other.name]
96
+ end
97
+
98
+ ##
99
+ # Adds +method+ as an alias for this method
100
+
101
+ def add_alias(method)
102
+ @aliases << method
103
+ end
104
+
105
+ ##
106
+ # HTML id-friendly method name
107
+
108
+ def html_name
109
+ @name.gsub(/[^a-z]+/, '-')
110
+ end
111
+
112
+ def inspect # :nodoc:
113
+ alias_for = @is_alias_for ? " (alias for #{@is_alias_for.name})" : nil
114
+ "#<%s:0x%x %s%s%s (%s)%s>" % [
115
+ self.class, object_id,
116
+ parent_name,
117
+ singleton ? '::' : '#',
118
+ name,
119
+ visibility,
120
+ alias_for,
121
+ ]
122
+ end
123
+
124
+ ##
125
+ # Full method name including namespace
126
+
127
+ def full_name
128
+ "#{@parent.full_name}#{pretty_name}"
129
+ end
130
+
131
+ ##
132
+ # Method name
133
+
134
+ def name
135
+ return @name if @name
136
+
137
+ @name = @call_seq[/^.*?\.(\w+)/, 1] || @call_seq
138
+ end
139
+
140
+ ##
141
+ # Pretty parameter list for this method
142
+
143
+ def param_seq
144
+ params = params.gsub(/\s*\#.*/, '')
145
+ params = params.tr("\n", " ").squeeze(" ")
146
+ params = "(#{params})" unless p[0] == ?(
147
+
148
+ if block = block_params then # yes, =
149
+ # If this method has explicit block parameters, remove any explicit
150
+ # &block
151
+ params.sub!(/,?\s*&\w+/)
152
+
153
+ block.gsub!(/\s*\#.*/, '')
154
+ block = block.tr("\n", " ").squeeze(" ")
155
+ if block[0] == ?(
156
+ block.sub!(/^\(/, '').sub!(/\)/, '')
157
+ end
158
+ params << " { |#{block}| ... }"
159
+ end
160
+
161
+ params
162
+ end
163
+
164
+ ##
165
+ # Path to this method
166
+
167
+ def path
168
+ "#{@parent.path}##{@aref}"
169
+ end
170
+
171
+ ##
172
+ # Method name with class/instance indicator
173
+
174
+ def pretty_name
175
+ "#{singleton ? '::' : '#'}#{@name}"
176
+ end
177
+
178
+ def to_s # :nodoc:
179
+ "#{self.class.name}: #{full_name} (#{@text})\n#{@comment}"
180
+ end
181
+
182
+ ##
183
+ # Type of method (class or instance)
184
+
185
+ def type
186
+ singleton ? 'class' : 'instance'
187
+ end
188
+
189
+ end
190
+
@@ -0,0 +1,79 @@
1
+ require 'rdoc/code_object'
2
+
3
+ ##
4
+ # An attribute created by \#attr, \#attr_reader, \#attr_writer or
5
+ # \#attr_accessor
6
+
7
+ class RDoc::Attr < RDoc::CodeObject
8
+
9
+ ##
10
+ # Name of the attribute
11
+
12
+ attr_accessor :name
13
+
14
+ ##
15
+ # Is the attribute readable, writable or both?
16
+
17
+ attr_accessor :rw
18
+
19
+ ##
20
+ # Source file token stream
21
+
22
+ attr_accessor :text
23
+
24
+ ##
25
+ # public, protected, private
26
+
27
+ attr_accessor :visibility
28
+
29
+ def initialize(text, name, rw, comment)
30
+ super()
31
+ @text = text
32
+ @name = name
33
+ @rw = rw
34
+ @visibility = :public
35
+ self.comment = comment
36
+ end
37
+
38
+ ##
39
+ # Attributes are ordered by name
40
+
41
+ def <=>(other)
42
+ self.name <=> other.name
43
+ end
44
+
45
+ ##
46
+ # An HTML id-friendly representation of #name
47
+
48
+ def html_name
49
+ @name.gsub(/[^a-z]+/, '-')
50
+ end
51
+
52
+ def inspect # :nodoc:
53
+ attr = case rw
54
+ when 'RW' then :attr_accessor
55
+ when 'R' then :attr_reader
56
+ when 'W' then :attr_writer
57
+ else
58
+ " (#{rw})"
59
+ end
60
+
61
+ "#<%s:0x%x %s.%s :%s>" % [
62
+ self.class, object_id,
63
+ parent_name, attr, @name,
64
+ ]
65
+ end
66
+
67
+ ##
68
+ # URL path for this attribute
69
+
70
+ def path
71
+ "#{@parent.path}##{@name}"
72
+ end
73
+
74
+ def to_s # :nodoc:
75
+ "attr: #{self.name} #{self.rw}\n#{self.comment}"
76
+ end
77
+
78
+ end
79
+
@@ -0,0 +1,41 @@
1
+ require 'thread'
2
+ require 'singleton'
3
+
4
+ ##
5
+ # A generic, thread-safe in-memory cache. It's used for caching
6
+ # RDoc::TemplatePage objects when generating RDoc output.
7
+
8
+ class RDoc::Cache
9
+
10
+ include Singleton
11
+
12
+ ##
13
+ # Creates a new, empty cache
14
+
15
+ def initialize
16
+ @contents = {}
17
+ @lock = Mutex.new
18
+ end
19
+
20
+ ##
21
+ # Checks whether there's a value in the cache with key +key+. If so, then
22
+ # that value will be returned. Otherwise, the given block will be run, and
23
+ # its return value will be put into the cache, and returned.
24
+
25
+ def cache(key)
26
+ @lock.synchronize do
27
+ @contents[key] ||= yield
28
+ end
29
+ end
30
+
31
+ ##
32
+ # Clears the contents of the cache
33
+
34
+ def clear
35
+ @lock.synchronize do
36
+ @contents.clear
37
+ end
38
+ end
39
+
40
+ end
41
+
@@ -0,0 +1,87 @@
1
+ require 'rdoc/context'
2
+
3
+ ##
4
+ # ClassModule is the base class for objects representing either a class or a
5
+ # module.
6
+
7
+ class RDoc::ClassModule < RDoc::Context
8
+
9
+ attr_accessor :diagram
10
+
11
+ ##
12
+ # Creates a new ClassModule with +name+ with optional +superclass+
13
+
14
+ def initialize(name, superclass = 'Object')
15
+ @diagram = nil
16
+ @full_name = nil
17
+ @name = name
18
+ @superclass = superclass
19
+ super()
20
+ end
21
+
22
+ ##
23
+ # Finds a class or module with +name+ in this namespace or its descendents
24
+
25
+ def find_class_named(name)
26
+ return self if full_name == name
27
+ @classes.each_value {|c| return c if c.find_class_named(name) }
28
+ nil
29
+ end
30
+
31
+ ##
32
+ # Return the fully qualified name of this class or module
33
+
34
+ def full_name
35
+ @full_name ||= if RDoc::ClassModule === @parent then
36
+ "#{@parent.full_name}::#{@name}"
37
+ else
38
+ @name
39
+ end
40
+ end
41
+
42
+ ##
43
+ # 'module' or 'class'
44
+
45
+ def type
46
+ module? ? 'module' : 'class'
47
+ end
48
+
49
+ ##
50
+ # Does this object represent a module?
51
+
52
+ def module?
53
+ false
54
+ end
55
+
56
+ ##
57
+ # Path to this class or module
58
+
59
+ def path
60
+ http_url RDoc::RDoc.current.generator.class_dir
61
+ end
62
+
63
+ ##
64
+ # Get the superclass of this class. Attempts to retrieve the superclass
65
+ # object, returns the name if it is not known.
66
+
67
+ def superclass
68
+ raise NoMethodError, "#{full_name} is a module" if module?
69
+
70
+ RDoc::TopLevel.find_class_named(@superclass) || @superclass
71
+ end
72
+
73
+ ##
74
+ # Set the superclass of this class to +superclass+
75
+
76
+ def superclass=(superclass)
77
+ raise NoMethodError, "#{full_name} is a module" if module?
78
+
79
+ @superclass = superclass if @superclass.nil? or @superclass == 'Object'
80
+ end
81
+
82
+ def to_s # :nodoc:
83
+ "#{self.class}: #{full_name} #{@comment} #{super}"
84
+ end
85
+
86
+ end
87
+
@@ -0,0 +1,152 @@
1
+ require 'rdoc'
2
+
3
+ ##
4
+ # We contain the common stuff for contexts (which are containers) and other
5
+ # elements (methods, attributes and so on)
6
+
7
+ class RDoc::CodeObject
8
+
9
+ ##
10
+ # Our comment
11
+
12
+ attr_reader :comment
13
+
14
+ ##
15
+ # Do we document our children?
16
+
17
+ attr_reader :document_children
18
+
19
+ ##
20
+ # Do we document ourselves?
21
+
22
+ attr_reader :document_self
23
+
24
+ ##
25
+ # Are we done documenting (ie, did we come across a :enddoc:)?
26
+
27
+ attr_accessor :done_documenting
28
+
29
+ ##
30
+ # Force documentation of this CodeObject
31
+
32
+ attr_accessor :force_documentation
33
+
34
+ ##
35
+ # Our parent CodeObject
36
+
37
+ attr_accessor :parent
38
+
39
+ ##
40
+ # Which section are we in
41
+
42
+ attr_accessor :section
43
+
44
+ ##
45
+ # We are the model of the code, but we know that at some point we will be
46
+ # worked on by viewers. By implementing the Viewable protocol, viewers can
47
+ # associated themselves with these objects.
48
+
49
+ attr_accessor :viewer
50
+
51
+ ##
52
+ # There's a wee trick we pull. Comment blocks can have directives that
53
+ # override the stuff we extract during the parse. So, we have a special
54
+ # class method, attr_overridable, that lets code objects list those
55
+ # directives. When a comment is assigned, we then extract out any matching
56
+ # directives and update our object
57
+
58
+ def self.attr_overridable(name, *aliases)
59
+ @overridables ||= {}
60
+
61
+ attr_accessor name
62
+
63
+ aliases.unshift name
64
+
65
+ aliases.each do |directive_name|
66
+ @overridables[directive_name.to_s] = name
67
+ end
68
+ end
69
+
70
+ ##
71
+ # Creates a new CodeObject that will document itself and its children
72
+
73
+ def initialize
74
+ @comment = nil
75
+ @document_children = true
76
+ @document_self = true
77
+ @done_documenting = false
78
+ @force_documentation = false
79
+ @parent = nil
80
+ end
81
+
82
+ ##
83
+ # Replaces our comment with +comment+, unless it is empty.
84
+
85
+ def comment=(comment)
86
+ @comment = comment unless comment.empty?
87
+ end
88
+
89
+ ##
90
+ # Enables or disables documentation of this CodeObject's children. Calls
91
+ # remove_classes_and_modules when disabling.
92
+
93
+ def document_children=(document_children)
94
+ @document_children = document_children
95
+ remove_classes_and_modules unless document_children
96
+ end
97
+
98
+ ##
99
+ # Enables or disables documentation of this CodeObject. Calls
100
+ # remove_methods_etc when disabling.
101
+
102
+ def document_self=(document_self)
103
+ @document_self = document_self
104
+ remove_methods_etc unless document_self
105
+ end
106
+
107
+ ##
108
+ # File name of our parent
109
+
110
+ def parent_file_name
111
+ @parent ? @parent.base_name : '(unknown)'
112
+ end
113
+
114
+ ##
115
+ # Name of our parent
116
+
117
+ def parent_name
118
+ @parent ? @parent.full_name : '(unknown)'
119
+ end
120
+
121
+ ##
122
+ # Callback called upon disabling documentation of children. See
123
+ # #document_children=
124
+
125
+ def remove_classes_and_modules
126
+ end
127
+
128
+ ##
129
+ # Callback called upon disabling documentation of ourself. See
130
+ # #document_self=
131
+
132
+ def remove_methods_etc
133
+ end
134
+
135
+ ##
136
+ # Enable capture of documentation
137
+
138
+ def start_doc
139
+ @document_self = true
140
+ @document_children = true
141
+ end
142
+
143
+ ##
144
+ # Disable capture of documentation
145
+
146
+ def stop_doc
147
+ @document_self = false
148
+ @document_children = false
149
+ end
150
+
151
+ end
152
+
@@ -0,0 +1,23 @@
1
+ # We represent the various high-level code constructs that appear in Ruby
2
+ # programs: classes, modules, methods, and so on.
3
+
4
+ require 'rdoc/code_object'
5
+ require 'rdoc/context'
6
+ require 'rdoc/top_level'
7
+
8
+ require 'rdoc/class_module'
9
+ require 'rdoc/normal_class'
10
+ require 'rdoc/normal_module'
11
+ require 'rdoc/anon_class'
12
+ require 'rdoc/single_class'
13
+
14
+ require 'rdoc/any_method'
15
+ require 'rdoc/alias'
16
+ require 'rdoc/ghost_method'
17
+ require 'rdoc/meta_method'
18
+
19
+ require 'rdoc/attr'
20
+ require 'rdoc/constant'
21
+ require 'rdoc/require'
22
+ require 'rdoc/include'
23
+
@@ -0,0 +1,36 @@
1
+ require 'rdoc/code_object'
2
+
3
+ ##
4
+ # A constant
5
+
6
+ class RDoc::Constant < RDoc::CodeObject
7
+
8
+ ##
9
+ # The constant's name
10
+
11
+ attr_accessor :name
12
+
13
+ ##
14
+ # The constant's value
15
+
16
+ attr_accessor :value
17
+
18
+ ##
19
+ # Creates a new constant with +name+, +value+ and +comment+
20
+
21
+ def initialize(name, value, comment)
22
+ super()
23
+ @name = name
24
+ @value = value
25
+ self.comment = comment
26
+ end
27
+
28
+ ##
29
+ # Path to this constant
30
+
31
+ def path
32
+ "#{@parent.path}##{@name}"
33
+ end
34
+
35
+ end
36
+