mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix dependency issue
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
84f0b051de
commit
d3b74e1806
4 changed files with 295 additions and 18 deletions
|
|
@ -236,7 +236,13 @@ module Generators
|
|||
namespace = rdr.top_level_namespace
|
||||
namespace = rdr.lookup_namespace_in(cls_desc.name, namespace)
|
||||
if namespace.empty?
|
||||
raise RiError.new("Nothing known about #{arg}")
|
||||
$stderr.puts "You asked me to merge this source into existing "
|
||||
$stderr.puts "documentation. This file references a class or "
|
||||
$stderr.puts "module called #{cls_desc.name} which I don't"
|
||||
$stderr.puts "have existing documentation for."
|
||||
$stderr.puts
|
||||
$stderr.puts "Perhaps you need to generate its documentation first"
|
||||
exit 1
|
||||
else
|
||||
old_cls = namespace[0]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,29 +5,64 @@ require 'yaml'
|
|||
# tree. ri then reads these to generate the documentation
|
||||
|
||||
module RI
|
||||
Alias = Struct.new(:old_name, :new_name)
|
||||
AliasName = Struct.new(:name)
|
||||
Attribute = Struct.new(:name, :rw, :comment)
|
||||
Constant = Struct.new(:name, :value, :comment)
|
||||
IncludedModule = Struct.new(:name)
|
||||
|
||||
class MethodSummary
|
||||
attr_accessor :name
|
||||
def initialize(name="")
|
||||
class NamedThing
|
||||
attr_reader :name
|
||||
def initialize(name)
|
||||
@name = name
|
||||
end
|
||||
|
||||
def <=>(other)
|
||||
self.name <=> other.name
|
||||
@name <=> other.name
|
||||
end
|
||||
|
||||
def hash
|
||||
@name.hash
|
||||
end
|
||||
|
||||
def eql?(other)
|
||||
@name.eql?(other)
|
||||
end
|
||||
end
|
||||
|
||||
# Alias = Struct.new(:old_name, :new_name)
|
||||
|
||||
class AliasName < NamedThing
|
||||
end
|
||||
|
||||
class Attribute < NamedThing
|
||||
attr_reader :rw, :comment
|
||||
def initialize(name, rw, comment)
|
||||
super(name)
|
||||
@rw = rw
|
||||
@comment = comment
|
||||
end
|
||||
end
|
||||
|
||||
class Constant < NamedThing
|
||||
attr_reader :value, :comment
|
||||
def initialize(name, value, comment)
|
||||
super(name)
|
||||
@value = value
|
||||
@comment = comment
|
||||
end
|
||||
end
|
||||
|
||||
class IncludedModule < NamedThing
|
||||
end
|
||||
|
||||
|
||||
class MethodSummary < NamedThing
|
||||
def initialize(name="")
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class Description
|
||||
attr_accessor :name
|
||||
attr_accessor :full_name
|
||||
attr_accessor :comment
|
||||
|
||||
|
||||
def serialize
|
||||
self.to_yaml
|
||||
end
|
||||
|
|
@ -35,6 +70,10 @@ module RI
|
|||
def Description.deserialize(from)
|
||||
YAML.load(from)
|
||||
end
|
||||
|
||||
def <=>(other)
|
||||
@name <=> other.name
|
||||
end
|
||||
end
|
||||
|
||||
class ClassDescription < Description
|
||||
|
|
@ -48,11 +87,20 @@ module RI
|
|||
|
||||
# merge in another class desscription into this one
|
||||
def merge_in(old)
|
||||
@class_methods.concat(old.class_methods).sort!
|
||||
@instance_methods.concat(old.instance_methods).sort!
|
||||
@attributes.concat(old.attributes).sort!
|
||||
@constants.concat(old.constants).sort!
|
||||
@includes.concat(old.includes).sort!
|
||||
merge(@class_methods, old.class_methods)
|
||||
merge(@instance_methods, old.instance_methods)
|
||||
merge(@attributes, old.attributes)
|
||||
merge(@constants, old.constants)
|
||||
merge(@includes, old.includes)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def merge(into, from)
|
||||
names = {}
|
||||
into.each {|i| names[i.name] = i }
|
||||
from.each {|i| names[i.name] = i }
|
||||
into.replace(names.keys.sort.map {|n| names[n]})
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue