yard 0.7.1 → 0.7.2

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.

Files changed (44) hide show
  1. data/ChangeLog +180 -0
  2. data/README.md +12 -3
  3. data/docs/GettingStarted.md +2 -2
  4. data/lib/yard.rb +1 -1
  5. data/lib/yard/autoload.rb +2 -1
  6. data/lib/yard/cli/command.rb +4 -2
  7. data/lib/yard/cli/server.rb +4 -3
  8. data/lib/yard/cli/stats.rb +2 -2
  9. data/lib/yard/cli/yardoc.rb +11 -9
  10. data/lib/yard/code_objects/macro_object.rb +2 -2
  11. data/lib/yard/config.rb +35 -1
  12. data/lib/yard/handlers/base.rb +1 -5
  13. data/lib/yard/handlers/ruby/legacy/macro_handler.rb +0 -1
  14. data/lib/yard/handlers/ruby/macro_handler.rb +0 -1
  15. data/lib/yard/handlers/ruby/macro_handler_methods.rb +1 -1
  16. data/lib/yard/logging.rb +13 -0
  17. data/lib/yard/parser/c_parser.rb +4 -8
  18. data/lib/yard/parser/ruby/legacy/statement_list.rb +1 -1
  19. data/lib/yard/parser/ruby/ruby_parser.rb +3 -3
  20. data/lib/yard/parser/source_parser.rb +1 -1
  21. data/lib/yard/server/commands/frames_command.rb +1 -1
  22. data/lib/yard/server/commands/library_command.rb +2 -1
  23. data/lib/yard/tags/library.rb +1 -1
  24. data/lib/yard/templates/helpers/html_helper.rb +13 -2
  25. data/lib/yard/templates/helpers/text_helper.rb +6 -2
  26. data/spec/cli/command_spec.rb +36 -0
  27. data/spec/cli/diff_spec.rb +2 -0
  28. data/spec/cli/server_spec.rb +7 -7
  29. data/spec/cli/yardoc_spec.rb +20 -4
  30. data/spec/handlers/examples/macro_handler_001.rb.txt +10 -0
  31. data/spec/handlers/examples/method_handler_001.rb.txt +12 -0
  32. data/spec/handlers/macro_handler_spec.rb +17 -0
  33. data/spec/handlers/method_handler_spec.rb +8 -0
  34. data/spec/parser/base_spec.rb +2 -1
  35. data/spec/parser/c_parser_spec.rb +30 -2
  36. data/spec/parser/ruby/ruby_parser_spec.rb +9 -0
  37. data/spec/registry_spec.rb +23 -11
  38. data/spec/templates/helpers/html_helper_spec.rb +39 -3
  39. data/spec/templates/helpers/shared_signature_examples.rb +10 -0
  40. data/spec/templates/helpers/text_helper_spec.rb +2 -1
  41. data/spec/templates/onefile_spec.rb +3 -3
  42. data/templates/default/fulldoc/html/setup.rb +0 -2
  43. data/templates/default/onefile/html/setup.rb +1 -0
  44. metadata +4 -3
data/ChangeLog CHANGED
@@ -1,11 +1,191 @@
1
+ 2011-06-14 Loren Segal <lsegal@soen.ca>
2
+
3
+ * ChangeLog, README.md, lib/yard.rb: 0.7.2 release
4
+
5
+ * lib/yard/templates/helpers/html_helper.rb,
6
+ spec/templates/helpers/html_helper_spec.rb: Add extra spec for `{http://...}`
7
+ links (and fix behaviour)
8
+
9
+ * lib/yard/templates/helpers/html_helper.rb,
10
+ spec/templates/helpers/html_helper_spec.rb: Support YARD style `{http://...
11
+ title}` links when using markdown provider that performs URL autolinking.
12
+ Closes #353
13
+
14
+ 2011-06-13 Loren Segal <lsegal@soen.ca>
15
+
16
+ * lib/yard/parser/ruby/ruby_parser.rb, spec/parser/ruby/ruby_parser_spec.rb:
17
+ Print correct constant values when using %w() arrays Closes #348
18
+
19
+ * lib/yard/cli/yardoc.rb, spec/cli/yardoc_spec.rb: Use capitalized tag name
20
+ if title is not provided in --tag Closes #352
21
+
22
+ * .gitignore, Gemfile: Add Gemfile for Bundler support
23
+
24
+ 2011-06-12 Loren Segal <lsegal@soen.ca>
25
+
26
+ * lib/yard/tags/library.rb: Fix typo in transitive_tags docs
27
+
28
+ 2011-06-11 Michael S. Klishin <michael@novemberain.com>
29
+
30
+ * spec/registry_spec.rb: Eliminate deadlocks for thread-local spec group on
31
+ 1.8.7-p334 Ruby 1.8.7 seems to treat empty while loops "specially". As soon
32
+ as a Kernel#puts call or a variable assignment happens in the while loop
33
+ body, deadlocks are gone. Note that synchronization alone wasn't sufficient.
34
+
35
+ 2011-06-07 Akzhan Abdulin <akzhan.abdulin@gmail.com>
36
+
37
+ * lib/yard/autoload.rb: __p method should not depend on / file path
38
+ separator. Actually it has only one parameter.
39
+
40
+ 2011-06-06 Loren Segal <lsegal@soen.ca>
41
+
42
+ * lib/yard/cli/yardoc.rb, spec/cli/yardoc_spec.rb,
43
+ spec/templates/onefile_spec.rb, templates/default/onefile/html/setup.rb: Fix
44
+ readme logic using --one-file and add tests
45
+
46
+ * templates/default/fulldoc/html/setup.rb: No longer need to add
47
+ files/readmes in templates (done inside CLI::Yardoc)
48
+
49
+ * spec/cli/yardoc_spec.rb: Stub out README in extra files spec
50
+
51
+ 2011-06-05 Nick Plante <nap@zerosum.org>
52
+
53
+ * lib/yard/cli/yardoc.rb: ensure that readme isn't duplicated in file list
54
+
55
+ * lib/yard/cli/yardoc.rb, lib/yard/server/commands/frames_command.rb,
56
+ lib/yard/server/commands/library_command.rb, spec/cli/yardoc_spec.rb: Fix
57
+ readme option display for YARD server (frames)
58
+
59
+ 2011-06-03 Loren Segal <lsegal@soen.ca>
60
+
61
+ * lib/yard/parser/ruby/legacy/statement_list.rb,
62
+ spec/handlers/examples/method_handler_001.rb.txt,
63
+ spec/handlers/method_handler_spec.rb: Properly handle 'def end' in legacy
64
+ parser Closes #343
65
+
66
+ 2011-05-27 Loren Segal <lsegal@soen.ca>
67
+
68
+ * spec/cli/diff_spec.rb: Make File mocks in diff_spec.rb more resilient to
69
+ different environments (bundler)
70
+
71
+ * lib/yard/templates/helpers/text_helper.rb,
72
+ spec/templates/helpers/text_helper_spec.rb: Make overload fix work with text
73
+ helper as well
74
+
75
+ * lib/yard/server/commands/library_command.rb: Require 'thread' in
76
+ LibraryCommand Closes #338
77
+
78
+ 2011-05-24 Franklin Webber <franklin.webber@gmail.com>
79
+
80
+ * lib/yard/config.rb: YARD::Config - fixed typo Thanks Loren
81
+
82
+ * lib/yard/config.rb: YARD Configuration Documentation Included example of
83
+ using the YARD::Config from the point-of-view of plugin designer.
84
+
85
+ 2011-05-24 Jon Wood <jon@blankpad.net>
86
+
87
+ * README.md: Fix a type in the query documentation.
88
+
89
+ 2011-05-23 Loren Segal <lsegal@soen.ca>
90
+
91
+ * lib/yard/templates/helpers/html_helper.rb,
92
+ spec/templates/helpers/html_helper_spec.rb,
93
+ .../templates/helpers/shared_signature_examples.rb: Method signature should
94
+ use regular return tag if @overload is empty
95
+
96
+ * lib/yard/code_objects/macro_object.rb: Fix documentation for macro
97
+ interpolation ($* not $&)
98
+
99
+ * lib/yard/handlers/ruby/macro_handler_methods.rb,
100
+ spec/handlers/examples/macro_handler_001.rb.txt,
101
+ spec/handlers/macro_handler_spec.rb: The @attribute tag should allow setting
102
+ the method name
103
+
104
+ * lib/yard/templates/helpers/html_helper.rb,
105
+ spec/templates/helpers/html_helper_spec.rb: Link to correct object when
106
+ `@overload` tag uses different method name Reported by @ryansobol Closes
107
+ #330
108
+
109
+ * lib/yard/cli/yardoc.rb: Don't use --charset in 1.8
110
+
111
+ * spec/templates/helpers/html_helper_spec.rb: Load markup provider before
112
+ stubbing file so specs pass
113
+
114
+ * lib/yard/cli/server.rb: Simplify the assignment of expanded library path
115
+
116
+ 2011-05-23 Rob Gleeson <rob@flowof.info>
117
+
118
+ * lib/yard/cli/server.rb, spec/cli/server_spec.rb: Fix failing specs.
119
+
120
+ 2011-05-22 Rob Gleeson <rob@flowof.info>
121
+
122
+ * lib/yard/cli/server.rb: Resolve relative links in daemon mode.
123
+
124
+ 2011-05-22 Loren Segal <lsegal@soen.ca>
125
+
126
+ * lib/yard/templates/helpers/html_helper.rb,
127
+ spec/templates/helpers/html_helper_spec.rb: Handles the valid 'utf8' locale
128
+ value as 'utf-8' Supporting #317
129
+
130
+ * spec/templates/helpers/html_helper_spec.rb: Stub ENV for charset test
131
+ Closes #317
132
+
133
+ 2011-05-21 Loren Segal <lsegal@soen.ca>
134
+
135
+ * lib/yard/parser/source_parser.rb: Fix documentation claiming that
136
+ SourceParser.parse returns a parser object; it returns void. Closes #325
137
+
138
+ * spec/cli/command_spec.rb: Add more tests for unrecognized options in yard
139
+ commands
140
+
141
+ * lib/yard/cli/command.rb, spec/cli/command_spec.rb: Try to continue parsing
142
+ options if one argument failed to parse
143
+
144
+ 2011-05-20 Loren Segal <lsegal@soen.ca>
145
+
146
+ * lib/yard/cli/yardoc.rb: Remove default parsing of --help/--version in
147
+ OptionParser so that yardoc --help shows up again Closes #324
148
+
149
+ * lib/yard/handlers/ruby/legacy/macro_handler.rb,
150
+ lib/yard/handlers/ruby/macro_handler.rb,
151
+ spec/handlers/examples/macro_handler_001.rb.txt,
152
+ spec/handlers/macro_handler_spec.rb: Enable DSL/macro detection in top level
153
+ namespace Closes #321
154
+
155
+ * lib/yard/parser/c_parser.rb, spec/parser/c_parser_spec.rb: Don't enforce
156
+ K&R C syntax when searching for CRuby function bodies Closes #320
157
+
158
+ * lib/yard/parser/c_parser.rb, spec/parser/c_parser_spec.rb: Refactor C
159
+ Parser tests and ensure that comments are no longer part of the method body
160
+
161
+ * lib/yard/handlers/base.rb, lib/yard/logging.rb,
162
+ lib/yard/parser/c_parser.rb: Add Logger#warn_no_continuations to refactor the
163
+ multiple calls to this global warning switch
164
+
165
+ * lib/yard/autoload.rb: Add NamespaceMissingError to autoload
166
+
167
+ 2011-05-20 Rob Gleeson <rob@flowof.info>
168
+
169
+ * lib/yard/cli/yardoc.rb: Provide a solution to issue #322. Ask 'Encoding'
170
+ does it respond to default_external= before assuming that it does.
171
+
1
172
  2011-05-18 Loren Segal <lsegal@soen.ca>
2
173
 
174
+ * lib/yard/cli/stats.rb, spec/parser/base_spec.rb: Fix some incompatible
175
+ specs on Rubinius
176
+
177
+ * .gitignore: Ignore .rbc files from project
178
+
3
179
  * ChangeLog, lib/yard.rb: Update version / changelog
4
180
 
5
181
  * README.md: Bump to 0.7.1
6
182
 
7
183
  * spec/code_objects/constants_spec.rb: Fix a spec
8
184
 
185
+ 2011-05-18 Simone Carletti <weppos@weppos.net>
186
+
187
+ * docs/GettingStarted.md: Fixed broken links.
188
+
9
189
  2011-05-17 Loren Segal <lsegal@soen.ca>
10
190
 
11
191
  * templates/default/fulldoc/html/setup.rb: Oops, yard server sets @items
data/README.md CHANGED
@@ -8,8 +8,8 @@ YARD: Yay! A Ruby Documentation Tool
8
8
  **Contributors**: See Contributors section below
9
9
  **Copyright**: 2007-2011
10
10
  **License**: MIT License
11
- **Latest Version**: 0.7.1 (codename "Heroes")
12
- **Release Date**: May 18th 2011
11
+ **Latest Version**: 0.7.2 (codename "Heroes")
12
+ **Release Date**: June 14th 2011
13
13
 
14
14
  Synopsis
15
15
  --------
@@ -202,7 +202,7 @@ Multiple `--query` arguments are allowed in the command line parameters. The
202
202
  following two lines both check for the existence of a return and param tag:
203
203
 
204
204
  --query '@return' --query '@param'
205
- --query '@rturn && @param'
205
+ --query '@return && @param'
206
206
 
207
207
  For more information about the query syntax, see the {YARD::Verifier} class.
208
208
 
@@ -289,6 +289,15 @@ More options can be seen by typing `yard-graph --help`, but here is an example:
289
289
  Changelog
290
290
  ---------
291
291
 
292
+ - **June.14.11**: 0.7.2 release
293
+ - Fix `yard --help` not showing proper output
294
+ - YARD now expands path to `.yardoc` file in daemon mode for server (#328)
295
+ - Fix `@overload` tag linking to wrong method (#330)
296
+ - Fix incorrect return type when using `@macro` (#334)
297
+ - YARD now requires 'thread' to support RubyGems 1.7+ (#338)
298
+ - Fix bug in constant documentation when using `%w()` (#348)
299
+ - Fix YARD style URL links when using autolinking markdown (#353)
300
+
292
301
  - **May.18.11**: 0.7.1 release
293
302
  - Fixes a bug in `yard server` not displaying class list properly.
294
303
 
@@ -181,7 +181,7 @@ Symbols:
181
181
  We mentioned that these type fields are "mostly" free-form. In truth, they
182
182
  are defined "by convention". To view samples of common type specifications
183
183
  and recommended conventions for writing type specifications, see
184
- {http://yardoc.org/types.html}. Note that these conventions may change every now
184
+ http://yardoc.org/types.html. Note that these conventions may change every now
185
185
  and then, although we are working on a more "formal" type specification proposal.
186
186
 
187
187
  ## Documenting DSL Methods
@@ -191,7 +191,7 @@ The most common is the `attr_accessor` method, which of course has built-in
191
191
  support in YARD. However, frameworks and libraries often expose custom
192
192
  methods that perform similar metaprogramming tasks, and it is often useful
193
193
  to document their functionality in your application. Consider the `property`
194
- method in a project like {http://datamapper.org DataMapper}, which creates
194
+ method in a project like [DataMapper](http://datamapper.org), which creates
195
195
  a typed attribute for a database model. The code might look like:
196
196
 
197
197
  class Post
data/lib/yard.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module YARD
2
- VERSION = "0.7.1"
2
+ VERSION = "0.7.2"
3
3
 
4
4
  # The root path for YARD source libraries
5
5
  ROOT = File.expand_path(File.dirname(__FILE__))
data/lib/yard/autoload.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # @private
2
- def __p(*path) File.join(YARD::ROOT, 'yard', *path) end
2
+ def __p(path) File.join(YARD::ROOT, 'yard', *path.split('/')); end
3
3
 
4
4
  module YARD
5
5
  module CLI # Namespace for command-line interface components
@@ -101,6 +101,7 @@ module YARD
101
101
  end
102
102
 
103
103
  autoload :Base, __p('handlers/base')
104
+ autoload :NamespaceMissingError, __p('handlers/base')
104
105
  autoload :Processor, __p('handlers/processor')
105
106
  end
106
107
 
@@ -50,8 +50,10 @@ module YARD
50
50
  # @return [void]
51
51
  def parse_options(opts, args)
52
52
  opts.parse!(args)
53
- rescue OptionParser::InvalidOption => e
54
- log.warn "Unrecognized/#{e.message}"
53
+ rescue OptionParser::ParseError => err
54
+ log.warn "Unrecognized/#{err.message}"
55
+ args.shift if args.first && args.first[0,1] != '-'
56
+ retry
55
57
  end
56
58
 
57
59
  # Loads a Ruby script. If +Config.options[:safe_mode]+ is enabled,
@@ -68,6 +68,7 @@ module YARD
68
68
  (0...args.size).step(2) do |index|
69
69
  library, yardoc = args[index], args[index + 1]
70
70
  yardoc ||= '.yardoc'
71
+ yardoc = File.expand_path(yardoc)
71
72
  if File.exist?(yardoc)
72
73
  libraries[library] ||= []
73
74
  libraries[library] << YARD::Server::LibraryVersion.new(library, nil, yardoc)
@@ -142,13 +143,13 @@ module YARD
142
143
  parse_options(opts, args)
143
144
 
144
145
  if args.empty? && libraries.empty?
145
- if !File.exist?('.yardoc')
146
+ if !File.exist? File.expand_path('.yardoc')
146
147
  log.enter_level(Logger::INFO) do
147
148
  log.info "No .yardoc file found in current directory, parsing source before starting server..."
148
149
  end
149
150
  Yardoc.run('-n')
150
151
  end
151
- add_libraries([File.basename(Dir.pwd), '.yardoc'])
152
+ add_libraries([File.basename(Dir.pwd), File.expand_path('.yardoc')])
152
153
  else
153
154
  add_libraries(args)
154
155
  options[:single_library] = false if libraries.size > 1
@@ -156,4 +157,4 @@ module YARD
156
157
  end
157
158
  end
158
159
  end
159
- end
160
+ end
@@ -141,9 +141,9 @@ module YARD
141
141
  @total += data if data.is_a?(Integer) && undoc
142
142
  @undocumented += undoc if undoc.is_a?(Integer)
143
143
  if undoc
144
- data = ("% 5s (% 5d undocumented)" % [data, undoc])
144
+ data = ("%5s (% 5d undocumented)" % [data, undoc])
145
145
  else
146
- data = "% 5s" % data
146
+ data = "%5s" % data
147
147
  end
148
148
  puts("%-12s %s" % [name + ":", data])
149
149
  end
@@ -186,8 +186,8 @@ module YARD
186
186
  @save_yardoc = true
187
187
  @has_markup = false
188
188
 
189
- if defined?(Encoding)
190
- Encoding.default_external, Encoding.default_internal = 'utf-8', 'utf-8'
189
+ if defined?(::Encoding) && ::Encoding.respond_to?(:default_external=)
190
+ ::Encoding.default_external, ::Encoding.default_internal = 'utf-8', 'utf-8'
191
191
  end
192
192
  end
193
193
 
@@ -248,15 +248,13 @@ module YARD
248
248
  self.files = ['{lib,app}/**/*.rb', 'ext/**/*.c'] if self.files.empty?
249
249
  self.files.delete_if {|x| x =~ /\A\s*\Z/ } # remove empty ones
250
250
  readme = Dir.glob('README*').first
251
+ readme ||= Dir.glob(files.first).first if options[:onefile]
251
252
  options[:readme] ||= CodeObjects::ExtraFileObject.new(readme) if readme
252
- if options[:onefile]
253
- options[:files] << options[:readme] if options[:readme]
254
- readme = Dir.glob(files.first).first
255
- options[:readme] = CodeObjects::ExtraFileObject.new(readme) if readme
256
- end
253
+ options[:files].unshift(options[:readme]).uniq! if options[:readme]
254
+
257
255
  Tags::Library.visible_tags -= hidden_tags
258
256
  add_visibility_verifier
259
-
257
+
260
258
  if generate && !verify_markup_options
261
259
  false
262
260
  else
@@ -355,6 +353,7 @@ module YARD
355
353
  # Parses out the yardopts/document options
356
354
  def parse_yardopts_options(*args)
357
355
  opts = OptionParser.new
356
+ opts.base.long.clear # HACK: why are --help and --version defined?
358
357
  yardopts_options(opts)
359
358
  begin
360
359
  opts.parse(args)
@@ -430,6 +429,7 @@ module YARD
430
429
  # @since 0.6.0
431
430
  def add_tag(tag_data, factory_method = nil)
432
431
  tag, title = *tag_data.split(':')
432
+ title ||= tag.capitalize
433
433
  Tags::Library.define_tag(title, tag.to_sym, factory_method)
434
434
  Tags::Library.visible_tags |= [tag.to_sym]
435
435
  end
@@ -621,7 +621,9 @@ module YARD
621
621
  opts.on('--charset ENC', 'Character set to use when parsing files ',
622
622
  ' (default is system locale)') do |encoding|
623
623
  begin
624
- Encoding.default_external, Encoding.default_internal = encoding, encoding
624
+ if defined?(Encoding) && Encoding.respond_to?(:default_external=)
625
+ Encoding.default_external, Encoding.default_internal = encoding, encoding
626
+ end
625
627
  rescue ArgumentError => e
626
628
  raise OptionParser::InvalidOption, e
627
629
  end
@@ -80,7 +80,7 @@ module YARD
80
80
  #
81
81
  # Interpolation rules:
82
82
  # * $0, $1, $2, ... = the Nth parameter in +call_params+
83
- # * $& = the full statement source (excluding block)
83
+ # * $* = the full statement source (excluding block)
84
84
  # * Also supports $\{N-M} ranges, as well as negative indexes on N or M
85
85
  # * Use \$ to escape the variable name in a macro.
86
86
  #
@@ -88,7 +88,7 @@ module YARD
88
88
  # @param [Array<String>] call_params the method name and parameters
89
89
  # to the method call. These arguments will fill \$0-N
90
90
  # @param [String] full_source the full source line (excluding block)
91
- # interpolated as \$&
91
+ # interpolated as \$*
92
92
  # @param [String] block_source Currently unused. Will support
93
93
  # interpolating the block data as a variable.
94
94
  # @return [String] the expanded macro data
data/lib/yard/config.rb CHANGED
@@ -45,7 +45,41 @@ module YARD
45
45
  # loaded with safe mode on, because plugins are properly namespaced with
46
46
  # a 'yard-' prefix, must be installed as a gem, and therefore cannot be
47
47
  # touched by the user. To specify safe mode, use the +safe_mode+ key.
48
- #
48
+ #
49
+ # == Plugin Specific Configuration
50
+ #
51
+ # Additional settings can be defined within the configuration file
52
+ # specifically to provide configuration for a plugin. A plugin that utilizes
53
+ # the YARD configuration is strongly encouraged to utilize namespacing of
54
+ # their configuration content.
55
+ #
56
+ # !!!yaml
57
+ # load_plugins: true # Auto-load plugins when YARD starts
58
+ # ignored_plugins:
59
+ # - yard-broken
60
+ # - broken2 # yard- prefix not necessary
61
+ # autoload_plugins:
62
+ # - yard-rspec
63
+ # # Plugin Specific Configuration
64
+ # yard-sample-plugin:
65
+ # show-results-inline: true
66
+ #
67
+ # As the configuration is available system wide, it can be
68
+ # accessed within the plugin code.
69
+ #
70
+ #
71
+ # if YARD::Config.options['yard-sample-plugin'] and
72
+ # YARD::Config.options['yard-sample-plugin']['show-results-inline']
73
+ # # ... perform the action that places the results inline ...
74
+ # else
75
+ # # ... do the default behavior of not showing the results inline ...
76
+ # end
77
+ #
78
+ # When accessing the configuration, be aware that this file is user managed
79
+ # so configuration keys and values may not be present. Make no assumptions and
80
+ # instead ensure that you check for the existence of keys before proceeding to
81
+ # retrieve values.
82
+ #
49
83
  # @since 0.6.2
50
84
  # @see options
51
85
  class Config
@@ -478,11 +478,7 @@ module YARD
478
478
  end
479
479
 
480
480
  unless CONTINUATIONS_SUPPORTED
481
- unless $NO_CONTINUATION_WARNING
482
- $NO_CONTINUATION_WARNING = true
483
- log.warn "JRuby/MacRuby/Rubinius do not implement Kernel#callcc and cannot " +
484
- "load files in order. You must specify the correct order manually."
485
- end
481
+ log.warn_no_continuations
486
482
  raise NamespaceMissingError, object
487
483
  end
488
484