yard 0.2.3.2 → 0.2.3.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of yard might be problematic. Click here for more details.
- data/README.markdown +1 -1
- data/benchmarks/marshal_vs_dbm.rb +63 -0
- data/benchmarks/ri_vs_yri.rb +18 -0
- data/bin/yri +8 -1
- data/lib/rubygems_plugin.rb +5 -4
- data/lib/yard.rb +8 -5
- data/lib/yard/autoload.rb +118 -119
- data/lib/yard/code_objects/proxy.rb +0 -10
- data/lib/yard/docstring.rb +4 -3
- data/lib/yard/globals.rb +15 -0
- data/lib/yard/logging.rb +10 -7
- data/spec/docstring_spec.rb +5 -0
- metadata +5 -3
- data/lib/yard/core_ext/logger.rb +0 -5
data/README.markdown
CHANGED
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'benchmark'
|
2
|
+
require 'dbm'
|
3
|
+
|
4
|
+
MARSHAL_FILE = "marshal_test.db"
|
5
|
+
DBM_FILE = "dbm_test"
|
6
|
+
WRITE_TIMES = 1
|
7
|
+
READ_TIMES = 100
|
8
|
+
NUM_INDICES = 10000
|
9
|
+
INDICES = ['33', '857', '5022', '8555']
|
10
|
+
|
11
|
+
def generate_index
|
12
|
+
'0' * (rand * 4096).floor
|
13
|
+
end
|
14
|
+
|
15
|
+
def write_dbm
|
16
|
+
File.unlink(DBM_FILE + ".db") if File.exist?(DBM_FILE + ".db")
|
17
|
+
handle = DBM.new(DBM_FILE)
|
18
|
+
NUM_INDICES.times {|t| handle[t.to_s] = Marshal.dump(generate_index) }
|
19
|
+
handle.close
|
20
|
+
end
|
21
|
+
|
22
|
+
def read_dbm
|
23
|
+
db = DBM.open(DBM_FILE)
|
24
|
+
INDICES.each {|index| Marshal.load(db[index]) }
|
25
|
+
db.close
|
26
|
+
end
|
27
|
+
|
28
|
+
def write_marshal
|
29
|
+
File.unlink(MARSHAL_FILE) if File.exist?(MARSHAL_FILE)
|
30
|
+
handle = {}
|
31
|
+
NUM_INDICES.times {|t| handle[t.to_s] = generate_index }
|
32
|
+
File.open(MARSHAL_FILE, "w") {|f| f.write(Marshal.dump(handle)) }
|
33
|
+
end
|
34
|
+
|
35
|
+
def read_marshal
|
36
|
+
db = Marshal.load(File.read(MARSHAL_FILE))
|
37
|
+
INDICES.each {|index| db[index] }
|
38
|
+
end
|
39
|
+
|
40
|
+
Benchmark.bmbm do |x|
|
41
|
+
x.report("marshal-write") { WRITE_TIMES.times { write_marshal } }
|
42
|
+
x.report("dbm-write") { WRITE_TIMES.times { write_dbm } }
|
43
|
+
x.report("marshal-read ") { READ_TIMES.times { read_marshal } }
|
44
|
+
x.report("dbm-read ") { READ_TIMES.times { read_dbm } }
|
45
|
+
end
|
46
|
+
|
47
|
+
File.unlink(MARSHAL_FILE)
|
48
|
+
File.unlink(DBM_FILE + ".db")
|
49
|
+
|
50
|
+
__END__
|
51
|
+
|
52
|
+
Rehearsal -------------------------------------------------
|
53
|
+
marshal-write 0.090000 0.070000 0.160000 ( 0.465820)
|
54
|
+
dbm-write 0.560000 0.570000 1.130000 ( 3.045556)
|
55
|
+
marshal-read 4.640000 3.180000 7.820000 ( 7.821978)
|
56
|
+
dbm-read 0.020000 0.020000 0.040000 ( 0.070920)
|
57
|
+
---------------------------------------- total: 9.150000sec
|
58
|
+
|
59
|
+
user system total real
|
60
|
+
marshal-write 0.080000 0.050000 0.130000 ( 0.436561)
|
61
|
+
dbm-write 0.560000 0.550000 1.110000 ( 2.030530)
|
62
|
+
marshal-read 4.670000 3.180000 7.850000 ( 7.842232)
|
63
|
+
dbm-read 0.010000 0.020000 0.030000 ( 0.053928)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "benchmark"
|
2
|
+
|
3
|
+
TIMES = 10
|
4
|
+
Benchmark.bmbm do |x|
|
5
|
+
x.report("ri") { TIMES.times { `ri -T YARD::Tags::Library` } }
|
6
|
+
x.report("yri") { TIMES.times { `./bin/yri -T YARD::Tags::Library` } }
|
7
|
+
end
|
8
|
+
|
9
|
+
__END__
|
10
|
+
|
11
|
+
Rehearsal ---------------------------------------
|
12
|
+
ri 0.000000 0.020000 6.880000 ( 6.929591)
|
13
|
+
yri 0.000000 0.000000 1.060000 ( 1.074840)
|
14
|
+
------------------------------ total: 7.940000sec
|
15
|
+
|
16
|
+
user system total real
|
17
|
+
ri 0.000000 0.020000 6.850000 ( 6.871660)
|
18
|
+
yri 0.000000 0.010000 1.060000 ( 1.067585)
|
data/bin/yri
CHANGED
@@ -3,11 +3,18 @@ require File.dirname(__FILE__) + '/../lib/yard'
|
|
3
3
|
|
4
4
|
YARD::Registry.load
|
5
5
|
|
6
|
+
if ARGV[0] == '-T' || ARGV[0] == '--no-pager'
|
7
|
+
output = YARD::Serializers::StdoutSerializer.new
|
8
|
+
ARGV.shift
|
9
|
+
else
|
10
|
+
output = YARD::Serializers::ProcessSerializer.new('less')
|
11
|
+
end
|
12
|
+
|
6
13
|
object = YARD::Registry.at(ARGV[0])
|
7
14
|
options = {
|
8
15
|
:format => :text,
|
9
16
|
:template => :default,
|
10
|
-
:serializer =>
|
17
|
+
:serializer => output
|
11
18
|
}
|
12
19
|
|
13
20
|
YARD::Generators::QuickDocGenerator.new(options).generate(object)
|
data/lib/rubygems_plugin.rb
CHANGED
@@ -74,18 +74,19 @@ class Gem::DocManager
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def install_ri_yard
|
77
|
-
install_ri_yard_orig if @spec.has_rdoc?
|
77
|
+
@@install_ri_yard_orig.bind(self).call if @spec.has_rdoc?
|
78
78
|
end
|
79
|
-
|
79
|
+
@@install_ri_yard_orig = instance_method(:install_ri)
|
80
80
|
alias install_ri install_ri_yard
|
81
81
|
|
82
|
+
|
82
83
|
def install_rdoc_yard
|
83
84
|
if @spec.has_rdoc?
|
84
|
-
install_rdoc_yard_orig
|
85
|
+
@@install_rdoc_yard_orig.bind(self).call
|
85
86
|
elsif @spec.has_yardoc?
|
86
87
|
install_yardoc
|
87
88
|
end
|
88
89
|
end
|
89
|
-
|
90
|
+
@@install_rdoc_yard_orig = instance_method(:install_rdoc)
|
90
91
|
alias install_rdoc install_rdoc_yard
|
91
92
|
end
|
data/lib/yard.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module YARD
|
2
|
-
VERSION = "0.2.3.
|
2
|
+
VERSION = "0.2.3.3"
|
3
3
|
ROOT = File.dirname(__FILE__)
|
4
4
|
TEMPLATE_ROOT = File.join(File.dirname(__FILE__), '..', 'templates')
|
5
5
|
|
@@ -10,8 +10,11 @@ end
|
|
10
10
|
# Keep track of Ruby version for compatibility code
|
11
11
|
RUBY19, RUBY18 = *(RUBY_VERSION >= "1.9" ? [true, false] : [false, true])
|
12
12
|
|
13
|
-
|
13
|
+
# Load Ruby core extension classes
|
14
|
+
Dir.glob(File.join(YARD::ROOT, 'yard', 'core_ext', '*')).each do |file|
|
15
|
+
require file.gsub(/\.rb$/, '')
|
16
|
+
end
|
14
17
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
+
['autoload', 'globals'].each do |file|
|
19
|
+
require File.join(YARD::ROOT, 'yard', file)
|
20
|
+
end
|
data/lib/yard/autoload.rb
CHANGED
@@ -1,164 +1,163 @@
|
|
1
|
+
def __p(*path) File.join(YARD::ROOT, 'yard', *path) end
|
2
|
+
|
1
3
|
module YARD
|
2
4
|
module CLI
|
3
|
-
autoload :YardGraph, '
|
4
|
-
autoload :Yardoc, '
|
5
|
+
autoload :YardGraph, __p('cli/yard_graph')
|
6
|
+
autoload :Yardoc, __p('cli/yardoc')
|
5
7
|
end
|
6
8
|
|
7
9
|
module CodeObjects
|
8
|
-
autoload :Base, '
|
9
|
-
autoload :CodeObjectList, '
|
10
|
-
autoload :ClassObject, '
|
11
|
-
autoload :ClassVariableObject, '
|
12
|
-
autoload :ConstantObject, '
|
13
|
-
autoload :ExtendedMethodObject, '
|
14
|
-
autoload :MethodObject, '
|
15
|
-
autoload :ModuleObject, '
|
16
|
-
autoload :NamespaceObject, '
|
17
|
-
autoload :Proxy, '
|
18
|
-
autoload :ProxyMethodError, '
|
19
|
-
autoload :RootObject, '
|
10
|
+
autoload :Base, __p('code_objects/base')
|
11
|
+
autoload :CodeObjectList, __p('code_objects/base')
|
12
|
+
autoload :ClassObject, __p('code_objects/class_object')
|
13
|
+
autoload :ClassVariableObject, __p('code_objects/class_variable_object')
|
14
|
+
autoload :ConstantObject, __p('code_objects/constant_object')
|
15
|
+
autoload :ExtendedMethodObject, __p('code_objects/extended_method_object')
|
16
|
+
autoload :MethodObject, __p('code_objects/method_object')
|
17
|
+
autoload :ModuleObject, __p('code_objects/module_object')
|
18
|
+
autoload :NamespaceObject, __p('code_objects/namespace_object')
|
19
|
+
autoload :Proxy, __p('code_objects/proxy')
|
20
|
+
autoload :ProxyMethodError, __p('code_objects/proxy')
|
21
|
+
autoload :RootObject, __p('code_objects/root_object')
|
20
22
|
|
21
|
-
autoload :BUILTIN_ALL, '
|
22
|
-
autoload :BUILTIN_CLASSES, '
|
23
|
-
autoload :BUILTIN_MODULES, '
|
24
|
-
autoload :BUILTIN_EXCEPTIONS, '
|
25
|
-
autoload :CONSTANTMATCH, '
|
26
|
-
autoload :METHODMATCH, '
|
27
|
-
autoload :METHODNAMEMATCH, '
|
28
|
-
autoload :NAMESPACEMATCH, '
|
29
|
-
autoload :NSEP, '
|
30
|
-
autoload :NSEPQ, '
|
31
|
-
autoload :ISEP, '
|
32
|
-
autoload :ISEPQ, '
|
33
|
-
autoload :CSEP, '
|
34
|
-
autoload :CSEPQ, '
|
23
|
+
autoload :BUILTIN_ALL, __p('code_objects/base')
|
24
|
+
autoload :BUILTIN_CLASSES, __p('code_objects/base')
|
25
|
+
autoload :BUILTIN_MODULES, __p('code_objects/base')
|
26
|
+
autoload :BUILTIN_EXCEPTIONS, __p('code_objects/base')
|
27
|
+
autoload :CONSTANTMATCH, __p('code_objects/base')
|
28
|
+
autoload :METHODMATCH, __p('code_objects/base')
|
29
|
+
autoload :METHODNAMEMATCH, __p('code_objects/base')
|
30
|
+
autoload :NAMESPACEMATCH, __p('code_objects/base')
|
31
|
+
autoload :NSEP, __p('code_objects/base')
|
32
|
+
autoload :NSEPQ, __p('code_objects/base')
|
33
|
+
autoload :ISEP, __p('code_objects/base')
|
34
|
+
autoload :ISEPQ, __p('code_objects/base')
|
35
|
+
autoload :CSEP, __p('code_objects/base')
|
36
|
+
autoload :CSEPQ, __p('code_objects/base')
|
35
37
|
end
|
36
38
|
|
37
39
|
module Generators
|
38
40
|
module Helpers
|
39
|
-
autoload :BaseHelper, '
|
40
|
-
autoload :FilterHelper, '
|
41
|
-
autoload :HtmlHelper, '
|
42
|
-
autoload :HtmlSyntaxHighlightHelper, '
|
43
|
-
autoload :MarkupHelper, '
|
44
|
-
autoload :MethodHelper, '
|
45
|
-
autoload :UMLHelper, '
|
41
|
+
autoload :BaseHelper, __p('generators/helpers/base_helper')
|
42
|
+
autoload :FilterHelper, __p('generators/helpers/filter_helper')
|
43
|
+
autoload :HtmlHelper, __p('generators/helpers/html_helper')
|
44
|
+
autoload :HtmlSyntaxHighlightHelper, __p('generators/helpers/html_syntax_highlight_helper')
|
45
|
+
autoload :MarkupHelper, __p('generators/helpers/markup_helper')
|
46
|
+
autoload :MethodHelper, __p('generators/helpers/method_helper')
|
47
|
+
autoload :UMLHelper, __p('generators/helpers/uml_helper')
|
46
48
|
end
|
47
49
|
|
48
|
-
autoload :AttributesGenerator, '
|
49
|
-
autoload :Base, '
|
50
|
-
autoload :ClassGenerator, '
|
51
|
-
autoload :ConstantsGenerator, '
|
52
|
-
autoload :ConstructorGenerator, '
|
53
|
-
autoload :DeprecatedGenerator, '
|
54
|
-
autoload :DocstringGenerator, '
|
55
|
-
autoload :FullDocGenerator, '
|
56
|
-
autoload :InheritanceGenerator, '
|
57
|
-
autoload :MethodGenerator, '
|
58
|
-
autoload :MethodDetailsGenerator, '
|
59
|
-
autoload :MethodListingGenerator, '
|
60
|
-
autoload :MethodMissingGenerator, '
|
61
|
-
autoload :MethodSignatureGenerator, '
|
62
|
-
autoload :MethodSummaryGenerator, '
|
63
|
-
autoload :MixinsGenerator, '
|
64
|
-
autoload :ModuleGenerator, '
|
65
|
-
autoload :QuickDocGenerator, '
|
66
|
-
autoload :RootGenerator, '
|
67
|
-
autoload :SourceGenerator, '
|
68
|
-
autoload :TagsGenerator, '
|
69
|
-
autoload :UMLGenerator, '
|
70
|
-
autoload :VisibilityGroupGenerator, '
|
71
|
-
autoload :OverloadsGenerator, '
|
50
|
+
autoload :AttributesGenerator, __p('generators/attributes_generator')
|
51
|
+
autoload :Base, __p('generators/base')
|
52
|
+
autoload :ClassGenerator, __p('generators/class_generator')
|
53
|
+
autoload :ConstantsGenerator, __p('generators/constants_generator')
|
54
|
+
autoload :ConstructorGenerator, __p('generators/constructor_generator')
|
55
|
+
autoload :DeprecatedGenerator, __p('generators/deprecated_generator')
|
56
|
+
autoload :DocstringGenerator, __p('generators/docstring_generator')
|
57
|
+
autoload :FullDocGenerator, __p('generators/full_doc_generator')
|
58
|
+
autoload :InheritanceGenerator, __p('generators/inheritance_generator')
|
59
|
+
autoload :MethodGenerator, __p('generators/method_generator')
|
60
|
+
autoload :MethodDetailsGenerator, __p('generators/method_details_generator')
|
61
|
+
autoload :MethodListingGenerator, __p('generators/method_listing_generator')
|
62
|
+
autoload :MethodMissingGenerator, __p('generators/method_missing_generator')
|
63
|
+
autoload :MethodSignatureGenerator, __p('generators/method_signature_generator')
|
64
|
+
autoload :MethodSummaryGenerator, __p('generators/method_summary_generator')
|
65
|
+
autoload :MixinsGenerator, __p('generators/mixins_generator')
|
66
|
+
autoload :ModuleGenerator, __p('generators/module_generator')
|
67
|
+
autoload :QuickDocGenerator, __p('generators/quick_doc_generator')
|
68
|
+
autoload :RootGenerator, __p('generators/root_generator')
|
69
|
+
autoload :SourceGenerator, __p('generators/source_generator')
|
70
|
+
autoload :TagsGenerator, __p('generators/tags_generator')
|
71
|
+
autoload :UMLGenerator, __p('generators/uml_generator')
|
72
|
+
autoload :VisibilityGroupGenerator, __p('generators/visibility_group_generator')
|
73
|
+
autoload :OverloadsGenerator, __p('generators/overloads_generator')
|
72
74
|
end
|
73
75
|
|
74
76
|
module Handlers
|
75
77
|
module Ruby
|
76
78
|
module Legacy
|
77
|
-
autoload :Base, '
|
79
|
+
autoload :Base, __p('handlers/ruby/legacy/base')
|
78
80
|
|
79
|
-
autoload :AliasHandler, '
|
80
|
-
autoload :AttributeHandler, '
|
81
|
-
autoload :ClassHandler, '
|
82
|
-
autoload :ClassVariableHandler, '
|
83
|
-
autoload :ConstantHandler, '
|
84
|
-
autoload :ExceptionHandler, '
|
85
|
-
autoload :ExtendHandler, '
|
86
|
-
autoload :MethodHandler, '
|
87
|
-
autoload :MixinHandler, '
|
88
|
-
autoload :ModuleHandler, '
|
89
|
-
autoload :VisibilityHandler, '
|
90
|
-
autoload :YieldHandler, '
|
81
|
+
autoload :AliasHandler, __p('handlers/ruby/legacy/alias_handler')
|
82
|
+
autoload :AttributeHandler, __p('handlers/ruby/legacy/attribute_handler')
|
83
|
+
autoload :ClassHandler, __p('handlers/ruby/legacy/class_handler')
|
84
|
+
autoload :ClassVariableHandler, __p('handlers/ruby/legacy/class_variable_handler')
|
85
|
+
autoload :ConstantHandler, __p('handlers/ruby/legacy/constant_handler')
|
86
|
+
autoload :ExceptionHandler, __p('handlers/ruby/legacy/exception_handler')
|
87
|
+
autoload :ExtendHandler, __p('handlers/ruby/legacy/extend_handler')
|
88
|
+
autoload :MethodHandler, __p('handlers/ruby/legacy/method_handler')
|
89
|
+
autoload :MixinHandler, __p('handlers/ruby/legacy/mixin_handler')
|
90
|
+
autoload :ModuleHandler, __p('handlers/ruby/legacy/module_handler')
|
91
|
+
autoload :VisibilityHandler, __p('handlers/ruby/legacy/visibility_handler')
|
92
|
+
autoload :YieldHandler, __p('handlers/ruby/legacy/yield_handler')
|
91
93
|
end
|
92
94
|
|
93
|
-
autoload :Base, '
|
95
|
+
autoload :Base, __p('handlers/ruby/base')
|
94
96
|
|
95
|
-
autoload :AliasHandler, '
|
96
|
-
autoload :AttributeHandler, '
|
97
|
-
autoload :ClassHandler, '
|
98
|
-
autoload :ClassConditionHandler, '
|
99
|
-
autoload :ClassVariableHandler, '
|
100
|
-
autoload :ConstantHandler, '
|
101
|
-
autoload :ExceptionHandler, '
|
102
|
-
autoload :ExtendHandler, '
|
103
|
-
autoload :MethodHandler, '
|
104
|
-
autoload :MethodConditionHandler, '
|
105
|
-
autoload :MixinHandler, '
|
106
|
-
autoload :ModuleHandler, '
|
107
|
-
autoload :VisibilityHandler, '
|
108
|
-
autoload :YieldHandler, '
|
97
|
+
autoload :AliasHandler, __p('handlers/ruby/alias_handler')
|
98
|
+
autoload :AttributeHandler, __p('handlers/ruby/attribute_handler')
|
99
|
+
autoload :ClassHandler, __p('handlers/ruby/class_handler')
|
100
|
+
autoload :ClassConditionHandler, __p('handlers/ruby/class_condition_handler')
|
101
|
+
autoload :ClassVariableHandler, __p('handlers/ruby/class_variable_handler')
|
102
|
+
autoload :ConstantHandler, __p('handlers/ruby/constant_handler')
|
103
|
+
autoload :ExceptionHandler, __p('handlers/ruby/exception_handler')
|
104
|
+
autoload :ExtendHandler, __p('handlers/ruby/extend_handler')
|
105
|
+
autoload :MethodHandler, __p('handlers/ruby/method_handler')
|
106
|
+
autoload :MethodConditionHandler, __p('handlers/ruby/method_condition_handler')
|
107
|
+
autoload :MixinHandler, __p('handlers/ruby/mixin_handler')
|
108
|
+
autoload :ModuleHandler, __p('handlers/ruby/module_handler')
|
109
|
+
autoload :VisibilityHandler, __p('handlers/ruby/visibility_handler')
|
110
|
+
autoload :YieldHandler, __p('handlers/ruby/yield_handler')
|
109
111
|
end
|
110
112
|
|
111
|
-
autoload :Base,
|
112
|
-
autoload :Processor,
|
113
|
+
autoload :Base, __p('handlers/base')
|
114
|
+
autoload :Processor, __p('handlers/processor')
|
113
115
|
end
|
114
116
|
|
115
117
|
module Parser
|
116
118
|
module Ruby
|
117
119
|
module Legacy
|
118
|
-
autoload :
|
119
|
-
autoload :
|
120
|
-
autoload :
|
121
|
-
|
122
|
-
module RubyToken
|
123
|
-
require 'yard/parser/ruby/legacy/ruby_lex' # Too much to include manually
|
124
|
-
end
|
120
|
+
autoload :RubyToken, __p('parser/ruby/legacy/ruby_lex')
|
121
|
+
autoload :Statement, __p('parser/ruby/legacy/statement')
|
122
|
+
autoload :StatementList, __p('parser/ruby/legacy/statement_list')
|
123
|
+
autoload :TokenList, __p('parser/ruby/legacy/token_list')
|
125
124
|
end
|
126
125
|
|
127
|
-
autoload :AstNode, '
|
128
|
-
autoload :ParserSyntaxError, '
|
129
|
-
autoload :RubyParser, '
|
126
|
+
autoload :AstNode, __p('parser/ruby/ast_node')
|
127
|
+
autoload :ParserSyntaxError, __p('parser/ruby/ruby_parser')
|
128
|
+
autoload :RubyParser, __p('parser/ruby/ruby_parser')
|
130
129
|
end
|
131
130
|
|
132
|
-
autoload :SourceParser, '
|
133
|
-
autoload :UndocumentableError, '
|
131
|
+
autoload :SourceParser, __p('parser/source_parser')
|
132
|
+
autoload :UndocumentableError, __p('parser/source_parser')
|
134
133
|
end
|
135
134
|
|
136
135
|
module Rake
|
137
|
-
autoload :YardocTask, '
|
136
|
+
autoload :YardocTask, __p('rake/yardoc_task')
|
138
137
|
end
|
139
138
|
|
140
139
|
module Serializers
|
141
|
-
autoload :Base, '
|
142
|
-
autoload :FileSystemSerializer, '
|
143
|
-
autoload :ProcessSerializer, '
|
144
|
-
autoload :StdoutSerializer, '
|
140
|
+
autoload :Base, __p('serializers/base')
|
141
|
+
autoload :FileSystemSerializer, __p('serializers/file_system_serializer')
|
142
|
+
autoload :ProcessSerializer, __p('serializers/process_serializer')
|
143
|
+
autoload :StdoutSerializer, __p('serializers/stdout_serializer')
|
145
144
|
end
|
146
145
|
|
147
146
|
module Tags
|
148
|
-
autoload :DefaultFactory, '
|
149
|
-
autoload :DefaultTag, '
|
150
|
-
autoload :Library, '
|
151
|
-
autoload :OptionTag, '
|
152
|
-
autoload :OverloadTag, '
|
153
|
-
autoload :RefTag, '
|
154
|
-
autoload :RefTagList, '
|
155
|
-
autoload :Tag, '
|
156
|
-
autoload :TagFormatError, '
|
147
|
+
autoload :DefaultFactory, __p('tags/default_factory')
|
148
|
+
autoload :DefaultTag, __p('tags/default_tag')
|
149
|
+
autoload :Library, __p('tags/library')
|
150
|
+
autoload :OptionTag, __p('tags/option_tag')
|
151
|
+
autoload :OverloadTag, __p('tags/overload_tag')
|
152
|
+
autoload :RefTag, __p('tags/ref_tag')
|
153
|
+
autoload :RefTagList, __p('tags/ref_tag_list')
|
154
|
+
autoload :Tag, __p('tags/tag')
|
155
|
+
autoload :TagFormatError, __p('tags/tag_format_error')
|
157
156
|
end
|
158
157
|
|
159
|
-
autoload :Docstring, '
|
160
|
-
autoload :
|
158
|
+
autoload :Docstring, __p('docstring')
|
159
|
+
autoload :Logger, __p('logging')
|
160
|
+
autoload :Registry, __p('registry')
|
161
161
|
end
|
162
162
|
|
163
|
-
|
164
|
-
YARD::CodeObjects::Proxy
|
163
|
+
undef __p
|
@@ -171,13 +171,3 @@ module YARD
|
|
171
171
|
end
|
172
172
|
end
|
173
173
|
end
|
174
|
-
|
175
|
-
# Shortcut for creating a YARD::CodeObjects::Proxy
|
176
|
-
# via a path
|
177
|
-
#
|
178
|
-
# @see YARD::CodeObjects::Proxy
|
179
|
-
# @see YARD::Registry#resolve
|
180
|
-
def P(namespace, name = nil)
|
181
|
-
namespace, name = nil, namespace if name.nil?
|
182
|
-
YARD::Registry.resolve(namespace, name, false, true)
|
183
|
-
end
|
data/lib/yard/docstring.rb
CHANGED
@@ -28,9 +28,10 @@ module YARD
|
|
28
28
|
#
|
29
29
|
# @return [String] The first line or paragraph of the docstring; always ends with a period.
|
30
30
|
def summary
|
31
|
-
@
|
32
|
-
|
33
|
-
|
31
|
+
return @summary if @summary
|
32
|
+
summary = split(/\.|\r?\n\r?\n/).first || ''
|
33
|
+
summary += '.' unless summary.empty?
|
34
|
+
@summary = summary
|
34
35
|
end
|
35
36
|
|
36
37
|
##
|
data/lib/yard/globals.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Global methods
|
2
|
+
|
3
|
+
# Shortcut for creating a YARD::CodeObjects::Proxy
|
4
|
+
# via a path
|
5
|
+
#
|
6
|
+
# @see YARD::CodeObjects::Proxy
|
7
|
+
# @see YARD::Registry#resolve
|
8
|
+
def P(namespace, name = nil)
|
9
|
+
namespace, name = nil, namespace if name.nil?
|
10
|
+
YARD::Registry.resolve(namespace, name, false, true)
|
11
|
+
end
|
12
|
+
|
13
|
+
def log
|
14
|
+
YARD::Logger.instance
|
15
|
+
end
|
data/lib/yard/logging.rb
CHANGED
@@ -1,10 +1,15 @@
|
|
1
|
-
require
|
1
|
+
require 'logger'
|
2
2
|
|
3
3
|
module YARD
|
4
4
|
class Logger < ::Logger
|
5
|
+
def self.instance(pipe = STDERR)
|
6
|
+
@logger ||= new(pipe)
|
7
|
+
end
|
8
|
+
|
5
9
|
def initialize(*args)
|
6
10
|
super
|
7
11
|
self.level = INFO
|
12
|
+
self.formatter = method(:format_log)
|
8
13
|
end
|
9
14
|
|
10
15
|
def debug(*args)
|
@@ -17,11 +22,9 @@ module YARD
|
|
17
22
|
yield
|
18
23
|
self.level = old_level
|
19
24
|
end
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
25
|
+
|
26
|
+
def format_log(sev, time, prog, msg)
|
27
|
+
"[#{sev.downcase}]: #{msg}\n"
|
28
|
+
end
|
24
29
|
end
|
25
30
|
end
|
26
|
-
|
27
|
-
def log; YARD.logger end
|
data/spec/docstring_spec.rb
CHANGED
@@ -33,6 +33,11 @@ describe YARD::Docstring do
|
|
33
33
|
o1 = Docstring.new
|
34
34
|
o1.summary.should == ""
|
35
35
|
end
|
36
|
+
|
37
|
+
it "should handle multiple calls to #summary" do
|
38
|
+
o1 = Docstring.new("Hello. world")
|
39
|
+
5.times { o1.summary.should == "Hello." }
|
40
|
+
end
|
36
41
|
|
37
42
|
it "should return the first sentence with #summary" do
|
38
43
|
o = Docstring.new("DOCSTRING. Another sentence")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.3.
|
4
|
+
version: 0.2.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Loren Segal
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-07-
|
12
|
+
date: 2009-07-26 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -58,7 +58,6 @@ files:
|
|
58
58
|
- lib/yard/code_objects/proxy.rb
|
59
59
|
- lib/yard/code_objects/root_object.rb
|
60
60
|
- lib/yard/core_ext/file.rb
|
61
|
-
- lib/yard/core_ext/logger.rb
|
62
61
|
- lib/yard/core_ext/module.rb
|
63
62
|
- lib/yard/core_ext/string.rb
|
64
63
|
- lib/yard/core_ext/symbol_hash.rb
|
@@ -94,6 +93,7 @@ files:
|
|
94
93
|
- lib/yard/generators/tags_generator.rb
|
95
94
|
- lib/yard/generators/uml_generator.rb
|
96
95
|
- lib/yard/generators/visibility_group_generator.rb
|
96
|
+
- lib/yard/globals.rb
|
97
97
|
- lib/yard/handlers/base.rb
|
98
98
|
- lib/yard/handlers/processor.rb
|
99
99
|
- lib/yard/handlers/ruby/alias_handler.rb
|
@@ -340,8 +340,10 @@ files:
|
|
340
340
|
- benchmarks/erb_vs_erubis.rb
|
341
341
|
- benchmarks/format_args.rb
|
342
342
|
- benchmarks/generation.rb
|
343
|
+
- benchmarks/marshal_vs_dbm.rb
|
343
344
|
- benchmarks/parsing.rb
|
344
345
|
- benchmarks/rdoc_vs_yardoc.rb
|
346
|
+
- benchmarks/ri_vs_yri.rb
|
345
347
|
- benchmarks/ripper_parser.rb
|
346
348
|
- LICENSE
|
347
349
|
- README.markdown
|