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.

@@ -1,4 +1,4 @@
1
- YARD Release 0.2.3.2 (July 6th 2009)
1
+ YARD Release 0.2.3.3 (July 26th 2009)
2
2
  =====================================
3
3
 
4
4
  **Homepage**: [http://yard.rubyforge.org](http://yard.rubyforge.org)
@@ -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 => YARD::Serializers::ProcessSerializer.new('less')
17
+ :serializer => output
11
18
  }
12
19
 
13
20
  YARD::Generators::QuickDocGenerator.new(options).generate(object)
@@ -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
- alias install_ri_yard_orig install_ri
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
- alias install_rdoc_yard_orig install_rdoc
90
+ @@install_rdoc_yard_orig = instance_method(:install_rdoc)
90
91
  alias install_rdoc install_rdoc_yard
91
92
  end
@@ -1,5 +1,5 @@
1
1
  module YARD
2
- VERSION = "0.2.3.2"
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
- $:.unshift(YARD::ROOT)
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
- files = ['yard/logging', 'yard/autoload']
16
- files += Dir.glob File.join(YARD::ROOT, 'yard/core_ext/*')
17
- files.each {|file| require file.gsub(/\.rb$/, '') }
18
+ ['autoload', 'globals'].each do |file|
19
+ require File.join(YARD::ROOT, 'yard', file)
20
+ end
@@ -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, 'yard/cli/yard_graph.rb'
4
- autoload :Yardoc, 'yard/cli/yardoc.rb'
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, 'yard/code_objects/base'
9
- autoload :CodeObjectList, 'yard/code_objects/base'
10
- autoload :ClassObject, 'yard/code_objects/class_object'
11
- autoload :ClassVariableObject, 'yard/code_objects/class_variable_object'
12
- autoload :ConstantObject, 'yard/code_objects/constant_object'
13
- autoload :ExtendedMethodObject, 'yard/code_objects/extended_method_object'
14
- autoload :MethodObject, 'yard/code_objects/method_object'
15
- autoload :ModuleObject, 'yard/code_objects/module_object'
16
- autoload :NamespaceObject, 'yard/code_objects/namespace_object'
17
- autoload :Proxy, 'yard/code_objects/proxy'
18
- autoload :ProxyMethodError, 'yard/code_objects/proxy'
19
- autoload :RootObject, 'yard/code_objects/root_object'
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, 'yard/code_objects/base'
22
- autoload :BUILTIN_CLASSES, 'yard/code_objects/base'
23
- autoload :BUILTIN_MODULES, 'yard/code_objects/base'
24
- autoload :BUILTIN_EXCEPTIONS, 'yard/code_objects/base'
25
- autoload :CONSTANTMATCH, 'yard/code_objects/base'
26
- autoload :METHODMATCH, 'yard/code_objects/base'
27
- autoload :METHODNAMEMATCH, 'yard/code_objects/base'
28
- autoload :NAMESPACEMATCH, 'yard/code_objects/base'
29
- autoload :NSEP, 'yard/code_objects/base'
30
- autoload :NSEPQ, 'yard/code_objects/base'
31
- autoload :ISEP, 'yard/code_objects/base'
32
- autoload :ISEPQ, 'yard/code_objects/base'
33
- autoload :CSEP, 'yard/code_objects/base'
34
- autoload :CSEPQ, 'yard/code_objects/base'
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, 'yard/generators/helpers/base_helper'
40
- autoload :FilterHelper, 'yard/generators/helpers/filter_helper'
41
- autoload :HtmlHelper, 'yard/generators/helpers/html_helper'
42
- autoload :HtmlSyntaxHighlightHelper, 'yard/generators/helpers/html_syntax_highlight_helper'
43
- autoload :MarkupHelper, 'yard/generators/helpers/markup_helper'
44
- autoload :MethodHelper, 'yard/generators/helpers/method_helper'
45
- autoload :UMLHelper, 'yard/generators/helpers/uml_helper'
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, 'yard/generators/attributes_generator'
49
- autoload :Base, 'yard/generators/base'
50
- autoload :ClassGenerator, 'yard/generators/class_generator'
51
- autoload :ConstantsGenerator, 'yard/generators/constants_generator'
52
- autoload :ConstructorGenerator, 'yard/generators/constructor_generator'
53
- autoload :DeprecatedGenerator, 'yard/generators/deprecated_generator'
54
- autoload :DocstringGenerator, 'yard/generators/docstring_generator'
55
- autoload :FullDocGenerator, 'yard/generators/full_doc_generator'
56
- autoload :InheritanceGenerator, 'yard/generators/inheritance_generator'
57
- autoload :MethodGenerator, 'yard/generators/method_generator'
58
- autoload :MethodDetailsGenerator, 'yard/generators/method_details_generator'
59
- autoload :MethodListingGenerator, 'yard/generators/method_listing_generator'
60
- autoload :MethodMissingGenerator, 'yard/generators/method_missing_generator'
61
- autoload :MethodSignatureGenerator, 'yard/generators/method_signature_generator'
62
- autoload :MethodSummaryGenerator, 'yard/generators/method_summary_generator'
63
- autoload :MixinsGenerator, 'yard/generators/mixins_generator'
64
- autoload :ModuleGenerator, 'yard/generators/module_generator'
65
- autoload :QuickDocGenerator, 'yard/generators/quick_doc_generator'
66
- autoload :RootGenerator, 'yard/generators/root_generator'
67
- autoload :SourceGenerator, 'yard/generators/source_generator'
68
- autoload :TagsGenerator, 'yard/generators/tags_generator'
69
- autoload :UMLGenerator, 'yard/generators/uml_generator'
70
- autoload :VisibilityGroupGenerator, 'yard/generators/visibility_group_generator'
71
- autoload :OverloadsGenerator, 'yard/generators/overloads_generator'
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, 'yard/handlers/ruby/legacy/base'
79
+ autoload :Base, __p('handlers/ruby/legacy/base')
78
80
 
79
- autoload :AliasHandler, 'yard/handlers/ruby/legacy/alias_handler'
80
- autoload :AttributeHandler, 'yard/handlers/ruby/legacy/attribute_handler'
81
- autoload :ClassHandler, 'yard/handlers/ruby/legacy/class_handler'
82
- autoload :ClassVariableHandler, 'yard/handlers/ruby/legacy/class_variable_handler'
83
- autoload :ConstantHandler, 'yard/handlers/ruby/legacy/constant_handler'
84
- autoload :ExceptionHandler, 'yard/handlers/ruby/legacy/exception_handler'
85
- autoload :ExtendHandler, 'yard/handlers/ruby/legacy/extend_handler'
86
- autoload :MethodHandler, 'yard/handlers/ruby/legacy/method_handler'
87
- autoload :MixinHandler, 'yard/handlers/ruby/legacy/mixin_handler'
88
- autoload :ModuleHandler, 'yard/handlers/ruby/legacy/module_handler'
89
- autoload :VisibilityHandler, 'yard/handlers/ruby/legacy/visibility_handler'
90
- autoload :YieldHandler, 'yard/handlers/ruby/legacy/yield_handler'
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, 'yard/handlers/ruby/base'
95
+ autoload :Base, __p('handlers/ruby/base')
94
96
 
95
- autoload :AliasHandler, 'yard/handlers/ruby/alias_handler'
96
- autoload :AttributeHandler, 'yard/handlers/ruby/attribute_handler'
97
- autoload :ClassHandler, 'yard/handlers/ruby/class_handler'
98
- autoload :ClassConditionHandler, 'yard/handlers/ruby/class_condition_handler'
99
- autoload :ClassVariableHandler, 'yard/handlers/ruby/class_variable_handler'
100
- autoload :ConstantHandler, 'yard/handlers/ruby/constant_handler'
101
- autoload :ExceptionHandler, 'yard/handlers/ruby/exception_handler'
102
- autoload :ExtendHandler, 'yard/handlers/ruby/extend_handler'
103
- autoload :MethodHandler, 'yard/handlers/ruby/method_handler'
104
- autoload :MethodConditionHandler, 'yard/handlers/ruby/method_condition_handler'
105
- autoload :MixinHandler, 'yard/handlers/ruby/mixin_handler'
106
- autoload :ModuleHandler, 'yard/handlers/ruby/module_handler'
107
- autoload :VisibilityHandler, 'yard/handlers/ruby/visibility_handler'
108
- autoload :YieldHandler, 'yard/handlers/ruby/yield_handler'
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, 'yard/handlers/base'
112
- autoload :Processor, 'yard/handlers/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 :Statement, 'yard/parser/ruby/legacy/statement'
119
- autoload :StatementList, 'yard/parser/ruby/legacy/statement_list'
120
- autoload :TokenList, 'yard/parser/ruby/legacy/token_list'
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, 'yard/parser/ruby/ast_node'
128
- autoload :ParserSyntaxError, 'yard/parser/ruby/ruby_parser'
129
- autoload :RubyParser, 'yard/parser/ruby/ruby_parser'
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, 'yard/parser/source_parser'
133
- autoload :UndocumentableError, 'yard/parser/source_parser'
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, 'yard/rake/yardoc_task'
136
+ autoload :YardocTask, __p('rake/yardoc_task')
138
137
  end
139
138
 
140
139
  module Serializers
141
- autoload :Base, 'yard/serializers/base'
142
- autoload :FileSystemSerializer, 'yard/serializers/file_system_serializer'
143
- autoload :ProcessSerializer, 'yard/serializers/process_serializer'
144
- autoload :StdoutSerializer, 'yard/serializers/stdout_serializer'
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, 'yard/tags/default_factory'
149
- autoload :DefaultTag, 'yard/tags/default_tag'
150
- autoload :Library, 'yard/tags/library'
151
- autoload :OptionTag, 'yard/tags/option_tag'
152
- autoload :OverloadTag, 'yard/tags/overload_tag'
153
- autoload :RefTag, 'yard/tags/ref_tag'
154
- autoload :RefTagList, 'yard/tags/ref_tag_list'
155
- autoload :Tag, 'yard/tags/tag'
156
- autoload :TagFormatError, 'yard/tags/tag_format_error'
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, 'yard/docstring'
160
- autoload :Registry, 'yard/registry'
158
+ autoload :Docstring, __p('docstring')
159
+ autoload :Logger, __p('logging')
160
+ autoload :Registry, __p('registry')
161
161
  end
162
162
 
163
- # P() needs to be loaded right away
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
@@ -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
- @summmary ||= (split(/\.|\r?\n\r?\n/).first || '')
32
- @summmary += '.' unless @summmary.empty?
33
- @summmary
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
  ##
@@ -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
@@ -1,10 +1,15 @@
1
- require "logger"
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
- end
21
-
22
- def self.logger
23
- @logger ||= YARD::Logger.new(STDERR)
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
@@ -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.2
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-06 00:00:00 -04:00
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
@@ -1,5 +0,0 @@
1
- class Logger::Formatter
2
- def call(sev, time, prog, msg)
3
- "[#{sev.downcase}]: #{msg}\n"
4
- end
5
- end