[DRE-commits] [yard] 01/05: Imported Upstream version 0.8.7.6
Lucas Nussbaum
lucas at moszumanska.debian.org
Wed May 6 09:14:06 UTC 2015
This is an automated email from the git hooks/post-receive script.
lucas pushed a commit to branch master
in repository yard.
commit 1a9467bc4bf65980145011bb7f712b8763256034
Author: Lucas Nussbaum <lucas at debian.org>
Date: Tue May 5 16:51:07 2015 +0200
Imported Upstream version 0.8.7.6
---
.yardopts | 1 +
CHANGELOG.md | 418 +++++++++++++++++++++
README.md | 362 +-----------------
checksums.yaml.gz | Bin 270 -> 0 bytes
docs/WhatsNew.md | 1 +
lib/yard/cli/gems.rb | 1 -
lib/yard/cli/stats.rb | 6 +-
lib/yard/cli/yardoc.rb | 8 +-
lib/yard/docstring_parser.rb | 3 -
lib/yard/handlers/c/symbol_handler.rb | 2 +-
lib/yard/handlers/ruby/method_handler.rb | 40 +-
.../handlers/ruby/private_class_method_handler.rb | 15 +-
lib/yard/i18n/pot_generator.rb | 2 +
lib/yard/logging.rb | 2 +-
lib/yard/parser/ruby/ast_node.rb | 56 ++-
lib/yard/parser/ruby/ruby_parser.rb | 36 +-
lib/yard/rake/yardoc_task.rb | 9 +-
lib/yard/server/commands/library_command.rb | 7 +-
.../templates/default/layout/html/breadcrumb.erb | 2 +-
.../doc_server/processing/html/processing.erb | 3 +-
lib/yard/tags/library.rb | 2 -
lib/yard/templates/helpers/html_helper.rb | 6 +-
lib/yard/templates/template.rb | 6 +-
lib/yard/version.rb | 2 +-
metadata.yml | 86 ++---
spec/cli/yardoc_spec.rb | 12 +-
.../private_class_method_handler_001.rb.txt | 2 +
.../private_class_method_handler_002.rb.txt | 18 +
.../private_class_method_handler_003.rb.txt | 11 +
spec/handlers/private_class_method_handler_spec.rb | 47 ++-
spec/i18n/pot_generator_spec.rb | 30 ++
spec/parser/c_parser_spec.rb | 18 +
spec/parser/ruby/ruby_parser_spec.rb | 43 ++-
spec/parser/source_parser_spec.rb | 20 +-
spec/rake/yardoc_task_spec.rb | 27 ++
spec/spec_helper.rb | 2 +
spec/templates/helpers/html_helper_spec.rb | 32 ++
templates/default/fulldoc/html/full_list.erb | 6 +-
templates/default/fulldoc/html/js/full_list.js | 5 +-
templates/default/tags/html/option.erb | 2 +-
yard.gemspec | 2 +-
41 files changed, 890 insertions(+), 463 deletions(-)
diff --git a/.yardopts b/.yardopts
index 1c4a376..fbd925d 100644
--- a/.yardopts
+++ b/.yardopts
@@ -12,6 +12,7 @@
--hide-tag yard.signature
--load ./docs/templates/plugin.rb
-
+CHANGELOG.md
docs/WhatsNew.md
docs/GettingStarted.md
docs/Tags.md
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..d9adf7a
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,418 @@
+# HEAD
+
+- Support using `@option` tag on keyword arg splat parameter. (#729)
+- Add `.stats_options` for `YardocTask`. (#800, #801)
+
+# 0.8.7.5 - October 26, 2014
+
+- Fix linking of methods in top level namespace in method listing. (#776)
+- Support using C macros in function declarations. (#810)
+- YARD will no longer group comment blocks starting on the same column if they
+ are preceded by code. (#798)
+- Handle anonymous lambda calls in toplevel scope. (#774)
+- Support I18n in `@overload` tags. (#794)
+- Support `yard stats` for objects with no file property. (#792)
+- Support for named arguments in Ruby >= 2.1. (#785)
+- Exclude README backup files from YARD generation. (#790)
+- Turned on the lax spacing option in Redcarpet to comply with the
+ Markdown standard.
+- Escape HTML in YARD server search placeholder template.
+- Fix issue with `private_class_method` support. (#760, #767)
+- Enable tables support by default in Redcarpet Markdown provider. (#765)
+
+# 0.8.7.4 - March 22, 2014
+
+- Mark C methods as explicit but also remove explicit check in stats. (#727)
+- Report unresolved parent namespaces as undocumentable errors instead. (#753)
+- No longer ignore overridden methods from documentation check in stats (#719)
+- Fix JRuby throwing exception when remove_method called on non-existent method. (#732)
+- Add basic support for `private_class_method` (#747)
+- Ensure namespace is always set when parent module is not found. (#753)
+- Set overflow as auto on table of contents.
+- Report 100% documented if nothing is undocumented. (#754)
+- Added support for RubyGems 2.0.0+. (#742)
+- Allow users to enter their own YARD RakeTask name. (#705)
+- Fixed a typo that was causing Windows detection to always fail. (#715)
+- Add debug information when loading a plugin fails. (#711)
+
+# 0.8.7.3 - November 1, 2013
+
+- Handle Unicode method/class/file names in server URL encoding (lsegal/rubydoc.info#69).
+- Style keyword style hashes with same symbol color in code highlighting (#707).
+- Fix broken JS when visiting docs in file:// scheme (#706).
+- Add support for new AsciiDoc file extensions (#704).
+- Fix issues where non-Ruby code blocks would not display in Ruby 2 (#702).
+- Add support for extra Ruby 2 symbol types in Ripper (#701).
+- Ensure config directory exists before saving config file (#700).
+
+# 0.8.7.2 - September 18, 2013
+
+- Disallow absolute URLs when using frame anchor support.
+- Support casted functions in CRuby method declarations (#697)
+
+# 0.8.7.1 - September 11, 2013
+
+- Fix potential XSS issue with frame anchor support.
+- Add support for gettext 3.x gem.
+
+# 0.8.7 - July 26, 2013
+
+- Added `--hide-api API` option to hide objects with a given `@api` tag (#685).
+- Added "Returns ...." prefix to summary when a lone @return tag is used.
+- Fixed issue that caused ref tags to be added to a docstring twice (#678).
+- Fixed formatting issue in docstring summaries (#686)
+
+# 0.8.6.2 - June 27, 2013
+
+- Fixed issue where `yard graph` was not displaying methods
+
+# 0.8.6.1 - April 14, 2013
+
+- Fixed broken links in File menu on default HTML template
+- Added --layout switch to `yard display` to wrap output in layout template.
+- See {file:docs/WhatsNew.md} for more information on added features.
+
+# 0.8.6 - April 13, 2013
+
+- Various fixes and improved Ruby 2.x compatibility support
+- Added support for `asciidoc` markup type
+- Added `yard markups` command to list available markup types
+- Added `yard display` command to display and format an individual object
+- See {file:docs/WhatsNew.md} for more information on added features.
+
+# 0.8.5.2 - February 26, 2013
+
+- Support new keyword argument syntax in method signatures (Ruby 2.x)
+
+# 0.8.5.1 - February 25, 2013
+
+- Fix `yard diff` of gem files with RubyGems 2.x
+
+# 0.8.5 - February 24, 2013
+
+- Basic support for Ruby 2.0 (fix compat issues in RDoc 4.0, RubyGems 2.0)
+- Add CSS styling for tables in default HTML template
+
+# 0.8.4.1 - February 5, 2013
+
+- Fix regression that broke loading of existing yardoc dbs (#648)
+
+# 0.8.4 - February 4, 2013
+
+- Add `-B/--bind` switch to yard server (#593, #608)
+- Add CodeObjects::Base#title for plugins to customize how object
+ links display (#646)
+- Disable linking objects filtered out by verifiers (#645)
+- Allow macro expansion on class methods (#632)
+- Expand newly attached macro on first DSL method call (#631)
+- Disable RubyGems plugin in Ruby 2.0 (#627)
+- Fix line range for class/module node bodies (#626)
+- Search extended modules for attached DSL macros (#553)
+
+# 0.8.3 - October 14, 2012
+
+- Add `--non-transitive-tag` to disable tag transitivity (#571)
+- Support --db inside .yardopts for graph/server commands (#583, #586)
+- Fix handling for =begin/=end docstrings (#577, #578)
+- Parser only sorts file lists when a glob is provided (#572)
+- Fix formatting in `{include:Object#method}` syntax (#569)
+- Fix @option tag inside of module functions (#563)
+- Fix to `--api` and `--no-api` support (#559)
+- Fix class nesting issues when path starts with "::" (#552)
+
+# 0.8.2.1 - June 9, 2012
+
+- Fix a set of regressions in yard server search and dynamic generation
+
+# 0.8.2 - June 7, 2012
+
+- Added progress style output in tty terminals
+- Embedded mixins should ignore methods defined on module (#539)
+- Fixed permalinks for embedded mixins in `yard server` (#540)
+- Improve parsing in CRuby code (#543)
+- Ensure Registry.resolve picks module when parsing mixins (#545)
+- Fixed regression that caused various commands to not show output (#548)
+- Respect current visibility when parsing class conditions (#551)
+
+# 0.8.1 - May 2, 2012
+
+- Added `--[no-]api` switch to generate docs for API sets (see {file:docs/WhatsNew.md} for details) (#532)
+- The `yard list` command now uses cache by default (#533)
+- Fix `yardoc` generating incorrectly named method list file (#528)
+- Fix HTML output occasionally showing trailing mdash on options list (#522)
+
+# 0.8.0 - April 30, 2012
+
+- See {file:docs/WhatsNew.md} for a list of added features
+- Over 20 bug fixes:
+ - Properly filter hidden setter/getter attributes (#394)
+ - Fix test failures in Linux environments (#397, #472, #473, #512, #513)
+ - Fix attribute inheritance and @private (#432)
+ - Fix attribute parsing (#435)
+ - Allow aliases for attributes (#436)
+ - Fix namespace fetching in `handle_alias()` (#437)
+ - Fix overwritten attributes marked as inherited (#442)
+ - Fix documenting constants defined from C code with `rb_define_const()` (#443)
+ - Do not escape snippets twice (#445)
+ - Ajax method/class search should not fire when a non-printable character is pressed (#446)
+ - Fix yard server crashing when RDoc is not installed (#456)
+ - Fix tags ignored when `(see #foo)` is used (#457)
+ - Fix three "Returns" for two `@overload` tags (#458)
+ - Do not auto-detect DSL methods as method objects if parameter name is not a valid method name (#464)
+ - Fix attaching of macros to Object (#465)
+ - Fix handling of `%w()` source in `[]/[]=` parsed context. (#461, pull in #468)
+ - Don't add default `@return` if `@overload` has `@return`. (#458, pull in #469)
+ - Don't discard tags by (see ...). (#457, pull in #470)
+ - Fix constants listed as inherited when overwritten (#474)
+ - Fix `yardoc --asset` behaving differently on first and subsequent calls. (#477)
+ - `!!!lang` code blocks should set the lang in `<pre>`'s class. (#478, #479)
+ - Fix "File List" search tab error. (#502)
+ - Fix search bar not redirecting to method page. (#509)
+ - Fix server returning exception message bodies as String (#518)
+
+# 0.7.5 - January 31, 2012
+
+- Various minor bug fixes
+
+# 0.7.4 - December 2, 2011
+
+- Redcarpet is now the default Markdown formatting library. GFM now works out-of-box (#404)
+- Fix server side searching for elements that are marked private (#420)
+- Add 'textile_strict' and 'pre' markup types, reorganize text and none (#416)
+- Improve encoding line detection (#415)
+- Add support for `rb_define_alias` in CRuby code (#413)
+- Fix rendering of some keywords in source view (#410)
+- Add support for RDoc 3.10+ (#406, #407)
+- Fix typewriter text being processed in code blocks (#403)
+- Improve support for has_rdoc in RubyGems 1.8.x (#401)
+- See the {file:docs/WhatsNew.md} document for details on added features
+
+# 0.7.3 - October 15, 2011
+
+- Improve support for parsing under Ruby 1.9.2p290 and 1.9.3 (#365, #370)
+- Add support for SWIG generated CRuby code (#369)
+- Add support for `rb_define_attr` calls in CRuby code (#362)
+- Handle file pointers in CRuby code (#358)
+
+# 0.7.2 - June 14, 2011
+
+- Fix `yard --help` not showing proper output
+- YARD now expands path to `.yardoc` file in daemon mode for server (#328)
+- Fix `@overload` tag linking to wrong method (#330)
+- Fix incorrect return type when using `@macro` (#334)
+- YARD now requires 'thread' to support RubyGems 1.7+ (#338)
+- Fix bug in constant documentation when using `%w()` (#348)
+- Fix YARD style URL links when using autolinking markdown (#353)
+
+# 0.7.1 - May 18, 2011
+
+- Fixes a bug in `yard server` not displaying class list properly.
+
+# 0.7.0 - May 17, 2011
+
+- See the {file:docs/WhatsNew.md} document for details on added features
+- Make sure that Docstring#line_range is filled when possible (#243)
+- Set #verifier in YardocTask (#282)
+- Parse BOM in UTF-8 files (#288)
+- Fix instance attributes not showing up in method list (#302)
+- Fix rendering of %w() literals in constants (#306)
+- Ignore keyboard shortcuts when an input is active (#312)
+- And more...
+
+# 0.6.8 - April 14, 2011
+
+- Fix regression in RDoc 1.x markup loading
+- Fix regression in loading of markup libraries for `yard server`
+
+# 0.6.7 - April 6, 2011
+
+- Fix has_rdoc gem specification issue with new RubyGems plugin API (oops!)
+
+# 0.6.6 - April 6, 2011
+
+- Fix error message when RDoc is not present (#270)
+- Add markup type 'none' to perform basic HTML translation (fallback when RDoc is not present)
+- Add support for RubyGems 1.7.x (#272)
+- Fix rendering of `{url description}` syntax when description contains newline
+
+# 0.6.5 - March 13, 2011
+
+- Support `ripper` gem in Ruby 1.8.7
+- Upgrade jQuery to 1.5.1
+- Fix handling of alias statements with quoted symbols (#262)
+- Add CSS styles (#260)
+- Unhandled exception in YARD::Handlers::Ruby::MixinHandler indexing documentation for eventmachine (#248)
+- Splice any alias references on method re-definitions into separate methods (#247)
+- Fix "yard graph" (#245)
+- Don't process ++ typewriter text inside of HTML attributes (#244)
+- Prioritize loading of Kramdown before Maruku (#241)
+- Skip shebang encoding in docstrings (#238)
+- Fix truncation of references in @deprecated (#232)
+- Show @api private note when no other tags are present (#231)
+- Detect docstrings starting with "##" as `Docstring#hash_flag` (#230)
+- Remove trailing whitespace from freeform tags (#229)
+- Fix line through for deprecated methods (#225)
+- Mistake in Tags.md (#223)
+- Improve database storage by being more efficient with filesystem usage (#222)
+- Make Registry thread local (#221)
+- Support `private_constant` class method for 1.9.3 (#219)
+- Do not assume RDoc is installed (#214)
+
+# 0.6.4 - December 21, 2010
+
+- Fix yri tool crashing with new Config class (gh-217)
+- Fix support for ::TopLevelConstants (gh-216)
+- YARD's test suite is now RSpec2 compatible (gh-215)
+- Improved documentation for YARD::Server features (gh-207)
+- Fix displaying of collaped method summary lists (gh-204)
+- Fix automatic loading of markup providers (gh-206)
+- Fix keyboard shortcuts for Chrome (gh-203)
+- Disallow `extend self` inside of a class (gh-202)
+- Constants now recognized in C extensions (gh-201)
+
+# 0.6.3 - November 21, 2010
+
+- Fixed regression that caused `yardoc --markup` to silently exit
+
+# 0.6.2 - November 15, 2010
+
+- **Plugins no longer automatically load, use `--plugin` to load a plugin**
+- Added YARD::Config and ~/.yard/config YAML configuration file
+- Added `yard config` command to view/edit YARD configuration file
+- Fixes for YARD in 1.8.6 (gh-178)
+- Various HTML template adjustments and fixes (gh-198,199,200)
+- Improved `yard server -m` multi-project stability (gh-193)
+- Fixed handling of `yardoc --no-private` with missing class definitions (gh-197)
+- Added support for constants defined in C extensions (gh-177)
+- Added support for Structs defined as "Klass = Struct.new(...)" (gh-187)
+- Improved parsing support for third-party gems (gh-174,180)
+- Improved support for JRuby 1.6.4+. YARD now passes all specs in JRuby (gh-185)
+- Improved YARD documentation (gh-172,191,196)
+
+# 0.6.1 - September 06, 2010
+
+- Fixed TOC showing on top of class/method list in no-frames view
+- A message now displays when running `yard server` with Rack/Mongrel installed
+- Improved performance of JS inline search for large class/method lists
+- Improved link titles for relative object links
+- Removed `String#camelcase` and `String#underscore` for better Rails compat.
+- Fixed support for loading .yardoc files under Windows
+- Fixed inheritance tree arrows not displaying in certain environments
+
+# 0.6.0 - August 29, 2010
+
+- Added dynamic local documentation server
+- Added @group/@endgroup declarations to organize methods into groups
+- Added `yard` executable to serve as main CLI tool with pluggable commands
+- Added `--asset` switch to `yardoc` to copy files/dirs to output dir
+- Added ability to register/manipulate tags via CLI (`--tag`, etc.)
+- Added `yard diff` command
+- Added statistics to `yardoc` output (and `yard stats` command)
+- Added Javascript generated Table of Contents to file pages
+- Updated various APIs
+- Removed `yard-graph` executable
+- See more changes in the {file:docs/WhatsNew.md what's new document}
+
+# 0.5.8 - June 22, 2010
+
+- Merge fix from 0.6 branch for --no-private visibility checking
+
+# 0.5.7 - June 21, 2010
+
+- Fixed visibility flag parsing in `yardoc`
+- Updated Parser Architecture documentation with new SourceParser API
+- Improved Registry documentation for new load commands
+- Fix loading of .yardoc file as cache (and preserving aliases)
+- Fix "lib" directory missing when running YARD on installed gems
+
+# 0.5.6 - June 12, 2010
+
+- Bug fixes for RubyGems plugin, `has_rdoc=false` should now work
+- New API for registering custom parsers. See {file:docs/WhatsNew.md}
+
+# 0.5.5 - May 22, 2010
+
+- Various bug fixes
+
+# 0.5.4 - March 22, 2010
+
+- See {file:docs/WhatsNew.md what's new document} for changes
+
+# 0.5.3 - January 11, 2010
+
+- See {file:docs/WhatsNew.md what's new document} for changes
+
+# 0.5.2 - December 16, 2009
+
+- See {file:docs/WhatsNew.md what's new document} for changes
+
+# 0.5.1 - December 15, 2009
+
+- See {file:docs/WhatsNew.md what's new document} for changes
+
+# 0.5.0 - December 13, 2009
+
+- See {file:docs/WhatsNew.md what's new document} for changes
+
+# 0.4.0 - November 15, 2009
+
+- Added new templating engine based on [tadpole](http://github.com/lsegal/tadpole)
+- Added YARD queries (`--query` CLI argument to yardoc)
+- Greatly expanded YARD documentation
+- Added plugin support
+- New `@abstract` and `@private` tags
+- Changed default rake task to `rake yard`
+- Read about changes in {file:docs/WhatsNew.md}
+
+# 0.2.3.5 - August 13, 2009
+
+- Minor bug fixes.
+
+# 0.2.3.4 - August 07, 2009
+
+- Minor bug fixes.
+
+# 0.2.3.3 - July 26, 2009
+
+- Minor bug fixes.
+
+# 0.2.3.2 - July 06, 2009
+
+- Fix Textile hard-break issues
+- Add description for @see tag to use as link title in HTML docs.
+- Add --title CLI option to specify a title for HTML doc files.
+- Add custom.css file that can be overridden with various custom
+ styelsheet declarations. To use this, simply add `default/fulldoc/html/custom.css`
+ inside your code directory and use the `-t` template directory yardoc CLI
+ option to point to that template directory (the dir holding 'default').
+- Add support in `yardoc` CLI to specify extra files (formerly --files)
+ by appending "- extra files here" after regular source files. Example:
+
+ yardoc --private lib/**/*.rb - FAQ LICENSE
+
+# 0.2.3.1 - June 13, 2009
+
+- Add a RubyGems 1.3.2+ plugin to generate YARD documentation instead of
+ RDoc. To take advantage of this plugin, set `has_rdoc = 'yard'` in your
+ .gemspec file.
+
+# 0.2.3 - June 07, 2009
+
+- See the {file:docs/WhatsNew.md} file for a list of important new features.
+
+# 0.2.2 - Jun 16, 2008
+
+- This is the largest changset since yard's conception and involves a complete
+ overhaul of the parser and API to make it more robust and far easier to
+ extend and use for the developer.
+
+# 0.2.1 - February 20, 2008
+
+- See the {file:docs/WhatsNew.md} file for a list of important new features.
+
+# 0.1a - February 24, 2007
+
+- Released 0.1a experimental version for testing. The goal here is
+ to get people testing YARD on their code because there are too many possible
+ code styles to fit into a sane amount of test cases. It also demonstrates the
+ power of YARD and what to expect from the syntax (Yardoc style meta tags).
diff --git a/README.md b/README.md
index 1900068..7890877 100644
--- a/README.md
+++ b/README.md
@@ -1,14 +1,13 @@
# YARD: Yay! A Ruby Documentation Tool
-**Homepage**: http://yardoc.org
-**IRC**: [irc.freenode.net / #yard](irc://irc.freenode.net/yard)
-**Git**: http://github.com/lsegal/yard
-**Author**: Loren Segal
-**Contributors**: http://github.com/lsegal/yard/contributors
-**Copyright**: 2007-2013
-**License**: MIT License
-**Latest Version**: 0.8.7.3
-**Release Date**: November 1st 2013
+[![Homepage](http://img.shields.io/badge/home-yardoc.org-blue.svg)](http://yardoc.org)
+[![GitHub](http://img.shields.io/badge/github-lsegal/yard-blue.svg)](http://github.com/lsegal/yard)
+[![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://rubydoc.org/gems/yard/frames)
+[![Gitter Chat](http://img.shields.io/badge/chat-gitter.im-orange.svg)](https://gitter.im/lsegal/yard)
+
+[![Gem Version](https://badge.fury.io/rb/yard.svg)](http://github.com/lsegal/yard/releases)
+[![Build Status](https://travis-ci.org/lsegal/yard.svg?branch=master)](https://travis-ci.org/lsegal/yard)
+[![License](http://img.shields.io/badge/license-MIT-yellowgreen.svg)](#license)
## Synopsis
@@ -209,11 +208,13 @@ adding the following to your `Rakefile`:
YARD::Rake::YardocTask.new do |t|
t.files = ['lib/**/*.rb', OTHER_PATHS] # optional
t.options = ['--any', '--extra', '--opts'] # optional
+ t.stats_options = ['--list-undoc'] # optional
end
-both the `files` and `options` settings are optional. `files` will default to
-`lib/**/*.rb` and `options` will represents any options you might want
-to add. Again, a full list of options is available by typing `yardoc --help`
+All the settings: `files`, `options` and `stats_options` are optional. `files` will default to
+`lib/**/*.rb`, `options` will represents any options you might want
+to add and `stats_options` will pass extra options to the stats command.
+Again, a full list of options is available by typing `yardoc --help`
in a shell. You can also override the options at the Rake command-line with the
OPTS environment variable:
@@ -283,338 +284,11 @@ More options can be seen by typing `yard graph --help`, but here is an example:
## Changelog
-- **November.1.13**: 0.8.7.3 release
- - Handle Unicode method/class/file names in server URL encoding (lsegal/rubydoc.info#69).
- - Style keyword style hashes with same symbol color in code highlighting (#707).
- - Fix broken JS when visiting docs in file:// scheme (#706).
- - Add support for new AsciiDoc file extensions (#704).
- - Fix issues where non-Ruby code blocks would not display in Ruby 2 (#702).
- - Add support for extra Ruby 2 symbol types in Ripper (#701).
- - Ensure config directory exists before saving config file (#700).
-
-- **September.18.13**: 0.8.7.2 release
- - Disallow absolute URLs when using frame anchor support.
- - Support casted functions in CRuby method declarations (#697)
-
-- **September.11.13**: 0.8.7.1 release
- - Fix potential XSS issue with frame anchor support.
- - Add support for gettext 3.x gem.
-
-- **July.26.13**: 0.8.7 release
- - Added `--hide-api API` option to hide objects with a given `@api` tag (#685).
- - Added "Returns ...." prefix to summary when a lone @return tag is used.
- - Fixed issue that caused ref tags to be added to a docstring twice (#678).
- - Fixed formatting issue in docstring summaries (#686)
-
-- **June.27.13**: 0.8.6.2 release
- - Fixed issue where `yard graph` was not displaying methods
-
-- **April.14.13**: 0.8.6.1 release
- - Fixed broken links in File menu on default HTML template
- - Added --layout switch to `yard display` to wrap output in layout template.
- - See {file:docs/WhatsNew.md} for more information on added features.
-
-- **April.13.13**: 0.8.6 release
- - Various fixes and improved Ruby 2.x compatibility support
- - Added support for `asciidoc` markup type
- - Added `yard markups` command to list available markup types
- - Added `yard display` command to display and format an individual object
- - See {file:docs/WhatsNew.md} for more information on added features.
-
-- **February.26.13**: 0.8.5.2 release
- - Support new keyword argument syntax in method signatures (Ruby 2.x)
-
-- **February.25.13**: 0.8.5.1 release
- - Fix `yard diff` of gem files with RubyGems 2.x
-
-- **February.24.13**: 0.8.5 release
- - Basic support for Ruby 2.0 (fix compat issues in RDoc 4.0, RubyGems 2.0)
- - Add CSS styling for tables in default HTML template
-
-- **February.5.13**: 0.8.4.1 release
- - Fix regression that broke loading of existing yardoc dbs (#648)
-
-- **February.4.13**: 0.8.4 release
- - Add `-B/--bind` switch to yard server (#593, #608)
- - Add CodeObjects::Base#title for plugins to customize how object
- links display (#646)
- - Disable linking objects filtered out by verifiers (#645)
- - Allow macro expansion on class methods (#632)
- - Expand newly attached macro on first DSL method call (#631)
- - Disable RubyGems plugin in Ruby 2.0 (#627)
- - Fix line range for class/module node bodies (#626)
- - Search extended modules for attached DSL macros (#553)
-
-- **October.14.12**: 0.8.3 release
- - Add `--non-transitive-tag` to disable tag transitivity (#571)
- - Support --db inside .yardopts for graph/server commands (#583, #586)
- - Fix handling for =begin/=end docstrings (#577, #578)
- - Parser only sorts file lists when a glob is provided (#572)
- - Fix formatting in `{include:Object#method}` syntax (#569)
- - Fix @option tag inside of module functions (#563)
- - Fix to `--api` and `--no-api` support (#559)
- - Fix class nesting issues when path starts with "::" (#552)
-
-- **June.9.12**: 0.8.2.1 release
- - Fix a set of regressions in yard server search and dynamic generation
-
-- **June.7.12**: 0.8.2 release
- - Added progress style output in tty terminals
- - Embedded mixins should ignore methods defined on module (#539)
- - Fixed permalinks for embedded mixins in `yard server` (#540)
- - Improve parsing in CRuby code (#543)
- - Ensure Registry.resolve picks module when parsing mixins (#545)
- - Fixed regression that caused various commands to not show output (#548)
- - Respect current visibility when parsing class conditions (#551)
-
-- **May.2.12**: 0.8.1 release
- - Added `--[no-]api` switch to generate docs for API sets (see {file:docs/WhatsNew.md} for details) (#532)
- - The `yard list` command now uses cache by default (#533)
- - Fix `yardoc` generating incorrectly named method list file (#528)
- - Fix HTML output occasionally showing trailing mdash on options list (#522)
-
-- **April.30.12**: 0.8.0 release
- - See {file:docs/WhatsNew.md} for a list of added features
- - Over 20 bug fixes:
- - Properly filter hidden setter/getter attributes (#394)
- - Fix test failures in Linux environments (#397, #472, #473, #512, #513)
- - Fix attribute inheritance and @private (#432)
- - Fix attribute parsing (#435)
- - Allow aliases for attributes (#436)
- - Fix namespace fetching in `handle_alias()` (#437)
- - Fix overwritten attributes marked as inherited (#442)
- - Fix documenting constants defined from C code with `rb_define_const()` (#443)
- - Do not escape snippets twice (#445)
- - Ajax method/class search should not fire when a non-printable character is pressed (#446)
- - Fix yard server crashing when RDoc is not installed (#456)
- - Fix tags ignored when `(see #foo)` is used (#457)
- - Fix three "Returns" for two `@overload` tags (#458)
- - Do not auto-detect DSL methods as method objects if parameter name is not a valid method name (#464)
- - Fix attaching of macros to Object (#465)
- - Fix handling of `%w()` source in `[]/[]=` parsed context. (#461, pull in #468)
- - Don't add default `@return` if `@overload` has `@return`. (#458, pull in #469)
- - Don't discard tags by (see ...). (#457, pull in #470)
- - Fix constants listed as inherited when overwritten (#474)
- - Fix `yardoc --asset` behaving differently on first and subsequent calls. (#477)
- - `!!!lang` code blocks should set the lang in `<pre>`'s class. (#478, #479)
- - Fix "File List" search tab error. (#502)
- - Fix search bar not redirecting to method page. (#509)
- - Fix server returning exception message bodies as String (#518)
-
-- **January.31.12**: 0.7.5 release
- - Various minor bug fixes
-
-- **December.2.11**: 0.7.4 release
- - Redcarpet is now the default Markdown formatting library. GFM now works out-of-box (#404)
- - Fix server side searching for elements that are marked private (#420)
- - Add 'textile_strict' and 'pre' markup types, reorganize text and none (#416)
- - Improve encoding line detection (#415)
- - Add support for `rb_define_alias` in CRuby code (#413)
- - Fix rendering of some keywords in source view (#410)
- - Add support for RDoc 3.10+ (#406, #407)
- - Fix typewriter text being processed in code blocks (#403)
- - Improve support for has_rdoc in RubyGems 1.8.x (#401)
- - See the {file:docs/WhatsNew.md} document for details on added features
-
-- **October.15.11**: 0.7.3 release
- - Improve support for parsing under Ruby 1.9.2p290 and 1.9.3 (#365, #370)
- - Add support for SWIG generated CRuby code (#369)
- - Add support for `rb_define_attr` calls in CRuby code (#362)
- - Handle file pointers in CRuby code (#358)
-
-- **June.14.11**: 0.7.2 release
- - Fix `yard --help` not showing proper output
- - YARD now expands path to `.yardoc` file in daemon mode for server (#328)
- - Fix `@overload` tag linking to wrong method (#330)
- - Fix incorrect return type when using `@macro` (#334)
- - YARD now requires 'thread' to support RubyGems 1.7+ (#338)
- - Fix bug in constant documentation when using `%w()` (#348)
- - Fix YARD style URL links when using autolinking markdown (#353)
-
-- **May.18.11**: 0.7.1 release
- - Fixes a bug in `yard server` not displaying class list properly.
-
-- **May.17.11**: 0.7.0 release
- - See the {file:docs/WhatsNew.md} document for details on added features
- - Make sure that Docstring#line_range is filled when possible (#243)
- - Set #verifier in YardocTask (#282)
- - Parse BOM in UTF-8 files (#288)
- - Fix instance attributes not showing up in method list (#302)
- - Fix rendering of %w() literals in constants (#306)
- - Ignore keyboard shortcuts when an input is active (#312)
- - And more...
-
-- **April.14.11**: 0.6.8 release
- - Fix regression in RDoc 1.x markup loading
- - Fix regression in loading of markup libraries for `yard server`
-
-- **April.6.11**: 0.6.7 release
- - Fix has_rdoc gem specification issue with new RubyGems plugin API (oops!)
-
-- **April.6.11**: 0.6.6 release
- - Fix error message when RDoc is not present (#270)
- - Add markup type 'none' to perform basic HTML translation (fallback when RDoc is not present)
- - Add support for RubyGems 1.7.x (#272)
- - Fix rendering of `{url description}` syntax when description contains newline
-
-- **March.13.11**: 0.6.5 release
- - Support `ripper` gem in Ruby 1.8.7
- - Upgrade jQuery to 1.5.1
- - Fix handling of alias statements with quoted symbols (#262)
- - Add CSS styles (#260)
- - Unhandled exception in YARD::Handlers::Ruby::MixinHandler indexing documentation for eventmachine (#248)
- - Splice any alias references on method re-definitions into separate methods (#247)
- - Fix "yard graph" (#245)
- - Don't process ++ typewriter text inside of HTML attributes (#244)
- - Prioritize loading of Kramdown before Maruku (#241)
- - Skip shebang encoding in docstrings (#238)
- - Fix truncation of references in @deprecated (#232)
- - Show @api private note when no other tags are present (#231)
- - Detect docstrings starting with "##" as `Docstring#hash_flag` (#230)
- - Remove trailing whitespace from freeform tags (#229)
- - Fix line through for deprecated methods (#225)
- - Mistake in Tags.md (#223)
- - Improve database storage by being more efficient with filesystem usage (#222)
- - Make Registry thread local (#221)
- - Support `private_constant` class method for 1.9.3 (#219)
- - Do not assume RDoc is installed (#214)
-
-- **December.21.10**: 0.6.4 release
- - Fix yri tool crashing with new Config class (gh-217)
- - Fix support for ::TopLevelConstants (gh-216)
- - YARD's test suite is now RSpec2 compatible (gh-215)
- - Improved documentation for YARD::Server features (gh-207)
- - Fix displaying of collaped method summary lists (gh-204)
- - Fix automatic loading of markup providers (gh-206)
- - Fix keyboard shortcuts for Chrome (gh-203)
- - Disallow `extend self` inside of a class (gh-202)
- - Constants now recognized in C extensions (gh-201)
-
-- **November.21.10**: 0.6.3 release
- - Fixed regression that caused `yardoc --markup` to silently exit
-
-- **November.15.10**: 0.6.2 release
- - **Plugins no longer automatically load, use `--plugin` to load a plugin**
- - Added YARD::Config and ~/.yard/config YAML configuration file
- - Added `yard config` command to view/edit YARD configuration file
- - Fixes for YARD in 1.8.6 (gh-178)
- - Various HTML template adjustments and fixes (gh-198,199,200)
- - Improved `yard server -m` multi-project stability (gh-193)
- - Fixed handling of `yardoc --no-private` with missing class definitions (gh-197)
- - Added support for constants defined in C extensions (gh-177)
- - Added support for Structs defined as "Klass = Struct.new(...)" (gh-187)
- - Improved parsing support for third-party gems (gh-174,180)
- - Improved support for JRuby 1.6.4+. YARD now passes all specs in JRuby (gh-185)
- - Improved YARD documentation (gh-172,191,196)
-
-- **September.06.10**: 0.6.1 release
- - Fixed TOC showing on top of class/method list in no-frames view
- - A message now displays when running `yard server` with Rack/Mongrel installed
- - Improved performance of JS inline search for large class/method lists
- - Improved link titles for relative object links
- - Removed `String#camelcase` and `String#underscore` for better Rails compat.
- - Fixed support for loading .yardoc files under Windows
- - Fixed inheritance tree arrows not displaying in certain environments
-
-- **August.29.10**: 0.6.0 release
- - Added dynamic local documentation server
- - Added @group/@endgroup declarations to organize methods into groups
- - Added `yard` executable to serve as main CLI tool with pluggable commands
- - Added `--asset` switch to `yardoc` to copy files/dirs to output dir
- - Added ability to register/manipulate tags via CLI (`--tag`, etc.)
- - Added `yard diff` command
- - Added statistics to `yardoc` output (and `yard stats` command)
- - Added Javascript generated Table of Contents to file pages
- - Updated various APIs
- - Removed `yard-graph` executable
- - See more changes in the {file:docs/WhatsNew.md what's new document}
-
-- **June.22.10**: 0.5.8 release
- - Merge fix from 0.6 branch for --no-private visibility checking
-
-- **June.21.10**: 0.5.7 release
- - Fixed visibility flag parsing in `yardoc`
- - Updated Parser Architecture documentation with new SourceParser API
- - Improved Registry documentation for new load commands
- - Fix loading of .yardoc file as cache (and preserving aliases)
- - Fix "lib" directory missing when running YARD on installed gems
-
-- **June.12.10**: 0.5.6 release
- - Bug fixes for RubyGems plugin, `has_rdoc=false` should now work
- - New API for registering custom parsers. See {file:docs/WhatsNew.md}
-
-- **May.22.10**: 0.5.5 release
- - Various bug fixes
-
-- **March.22.10**: 0.5.4 release
- - See {file:docs/WhatsNew.md what's new document} for changes
-
-- **January.11.10**: 0.5.3 release
- - See {file:docs/WhatsNew.md what's new document} for changes
-
-- **December.16.09**: 0.5.2 release
- - See {file:docs/WhatsNew.md what's new document} for changes
-
-- **December.15.09**: 0.5.1 release
- - See {file:docs/WhatsNew.md what's new document} for changes
-
-- **December.13.09**: 0.5.0 release
- - See {file:docs/WhatsNew.md what's new document} for changes
-
-- **November.15.09**: 0.4.0 release
- - Added new templating engine based on [tadpole](http://github.com/lsegal/tadpole)
- - Added YARD queries (`--query` CLI argument to yardoc)
- - Greatly expanded YARD documentation
- - Added plugin support
- - New `@abstract` and `@private` tags
- - Changed default rake task to `rake yard`
- - Read about changes in {file:docs/WhatsNew.md}
-
-- **August.13.09**: 0.2.3.5 release
- - Minor bug fixes.
-
-- **August.07.09**: 0.2.3.4 release
- - Minor bug fixes.
-
-- **July.26.09**: 0.2.3.3 release
- - Minor bug fixes.
-
-- **July.06.09**: 0.2.3.2 release
- - Fix Textile hard-break issues
- - Add description for @see tag to use as link title in HTML docs.
- - Add --title CLI option to specify a title for HTML doc files.
- - Add custom.css file that can be overridden with various custom
- styelsheet declarations. To use this, simply add `default/fulldoc/html/custom.css`
- inside your code directory and use the `-t` template directory yardoc CLI
- option to point to that template directory (the dir holding 'default').
- - Add support in `yardoc` CLI to specify extra files (formerly --files)
- by appending "- extra files here" after regular source files. Example:
-
- yardoc --private lib/**/*.rb - FAQ LICENSE
-
-- **Jun.13.09**: 0.2.3.1 release.
- - Add a RubyGems 1.3.2+ plugin to generate YARD documentation instead of
- RDoc. To take advantage of this plugin, set `has_rdoc = 'yard'` in your
- .gemspec file.
-
-- **Jun.07.09**: 0.2.3 release. See the {file:docs/WhatsNew.md} file for a
- list of important new features.
-
-- **Jun.16.08**: 0.2.2 release. This is the largest changset since yard's
- conception and involves a complete overhaul of the parser and API to make it
- more robust and far easier to extend and use for the developer.
-
-- **Feb.20.08**: 0.2.1 release.
-
-- **Feb.24.07**: Released 0.1a experimental version for testing. The goal here is
- to get people testing YARD on their code because there are too many possible
- code styles to fit into a sane amount of test cases. It also demonstrates the
- power of YARD and what to expect from the syntax (Yardoc style meta tags).
-
-
-## Copyright
-
-YARD © 2007-2013 by [Loren Segal](mailto:lsegal at soen.ca). YARD is
+See {file:CHANGELOG.md} for a list of changes.
+
+## License
+
+YARD © 2007-2014 by [Loren Segal](mailto:lsegal at soen.ca). YARD is
licensed under the MIT license except for some files which come from the
RDoc/Ruby distributions. Please see the {file:LICENSE} and {file:LEGAL}
documents for more information.
diff --git a/checksums.yaml.gz b/checksums.yaml.gz
deleted file mode 100644
index f2729d3..0000000
Binary files a/checksums.yaml.gz and /dev/null differ
diff --git a/docs/WhatsNew.md b/docs/WhatsNew.md
index 92c3903..4e00c82 100644
--- a/docs/WhatsNew.md
+++ b/docs/WhatsNew.md
@@ -22,6 +22,7 @@
18. **Added `yard markups` command to list available markup types** (0.8.6)
19. **Added `yard display` command to display formatted objects** (0.8.6)
20. **Added `--layout` to `yard display` command** (0.8.6.1)
+21. **Added `stats_options` for the rake task** (0.8.7.6)
## Directives (new behavioural tag syntax) (0.8.0)
diff --git a/lib/yard/cli/gems.rb b/lib/yard/cli/gems.rb
index 8950a63..65003af 100644
--- a/lib/yard/cli/gems.rb
+++ b/lib/yard/cli/gems.rb
@@ -23,7 +23,6 @@ module YARD
private
# Builds .yardoc files for all non-existing gems
- # @param [Array] gems
def build_gems
require 'rubygems'
@gems.each do |spec|
diff --git a/lib/yard/cli/stats.rb b/lib/yard/cli/stats.rb
index 61d9438..50ad9a8 100644
--- a/lib/yard/cli/stats.rb
+++ b/lib/yard/cli/stats.rb
@@ -76,19 +76,19 @@ module YARD
log.puts
log.puts "Undocumented Objects:"
- objects = @undoc_list.sort_by {|o| o.file }
+ objects = @undoc_list.sort_by {|o| o.file.to_s }
max = objects.sort_by {|o| o.path.length }.last.path.length
if @compact
objects.each do |object|
log.puts("%-#{max}s (%s)" % [object.path,
- [object.file, object.line].compact.join(":")])
+ [object.file || "-unknown-", object.line].compact.join(":")])
end
else
last_file = nil
objects.each do |object|
if object.file != last_file
log.puts
- log.puts "(in file: #{object.file})"
+ log.puts "(in file: #{object.file || "-unknown-"})"
end
log.puts object.path
last_file = object.file
diff --git a/lib/yard/cli/yardoc.rb b/lib/yard/cli/yardoc.rb
index 4e4abb5..6cd106c 100644
--- a/lib/yard/cli/yardoc.rb
+++ b/lib/yard/cli/yardoc.rb
@@ -44,7 +44,11 @@ module YARD
# @return [CodeObjects::ExtraFileObject] the file object being rendered.
# The +object+ key is not used so that a file may be rendered in the context
# of an object's namespace (for generating links).
- attr_accessor :file
+ attr_reader :file
+ def file=(v) @file = v end
+
+ # @return [String] the current locale
+ attr_accessor :locale
end
# Yardoc is the default YARD CLI command (+yard doc+ and historic +yardoc+
@@ -274,7 +278,7 @@ module YARD
# Last minute modifications
self.files = ['{lib,app}/**/*.rb', 'ext/**/*.c'] if self.files.empty?
self.files.delete_if {|x| x =~ /\A\s*\Z/ } # remove empty ones
- readme = Dir.glob('README*').first
+ readme = Dir.glob('README{,*[^~]}').first
readme ||= Dir.glob(files.first).first if options.onefile
options.readme ||= CodeObjects::ExtraFileObject.new(readme) if readme
options.files.unshift(options.readme).uniq! if options.readme
diff --git a/lib/yard/docstring_parser.rb b/lib/yard/docstring_parser.rb
index 4dcb894..3054a53 100644
--- a/lib/yard/docstring_parser.rb
+++ b/lib/yard/docstring_parser.rb
@@ -296,9 +296,6 @@ module YARD
after_parse do |parser|
next unless parser.object
next unless parser.object.is_a?(CodeObjects::MethodObject)
- next if parser.object.parameters.empty? # method has no params or
- # YARD couldn't detect any.
- # but don't warn user (?)
names = parser.object.parameters.map {|l| l.first.gsub(/\W/, '') }
seen_names = []
infile_info = "\n in file `#{parser.object.file}' " +
diff --git a/lib/yard/handlers/c/symbol_handler.rb b/lib/yard/handlers/c/symbol_handler.rb
index 80f66ce..1281361 100644
--- a/lib/yard/handlers/c/symbol_handler.rb
+++ b/lib/yard/handlers/c/symbol_handler.rb
@@ -1,6 +1,6 @@
# Keeps track of function bodies for symbol lookup during Ruby method declarations
class YARD::Handlers::C::SymbolHandler < YARD::Handlers::C::Base
- MATCH = %r{\A\s*(?:(?:static|SWIGINTERN)\s+)?(?:intern\s+)?VALUE\s+(\w+)\s*\(}
+ MATCH = %r{\A\s*(?:(?:\w+)\s+)?(?:intern\s+)?VALUE\s+(\w+)\s*\(}
handles MATCH
statement_class ToplevelStatement
process { symbols[statement.source[MATCH, 1]] = statement }
diff --git a/lib/yard/handlers/ruby/method_handler.rb b/lib/yard/handlers/ruby/method_handler.rb
index 8a0d2aa..f1002f2 100644
--- a/lib/yard/handlers/ruby/method_handler.rb
+++ b/lib/yard/handlers/ruby/method_handler.rb
@@ -71,13 +71,41 @@ class YARD::Handlers::Ruby::MethodHandler < YARD::Handlers::Ruby::Base
def format_args
args = statement.parameters
+
params = []
- params += args.required_params.map {|a| [a.source, nil] } if args.required_params
- params += args.optional_params.map {|a| [a[0].source, a[1].source] } if args.optional_params
- params << ["*" + args.splat_param.source, nil] if args.splat_param
- params << ["**" + args.keyword_param.source, nil] if args.keyword_param
- params += args.required_end_params.map {|a| [a.source, nil] } if args.required_end_params
- params << ["&" + args.block_param.source, nil] if args.block_param
+
+ if args.unnamed_required_params
+ params += args.unnamed_required_params.map { |a| [a.source, nil] }
+ end
+
+ if args.unnamed_optional_params
+ params += args.unnamed_optional_params.map do |a|
+ [a[0].source, a[1].source]
+ end
+ end
+
+ if args.splat_param
+ params << ['*' + args.splat_param.source, nil]
+ end
+
+ if args.unnamed_end_params
+ params += args.unnamed_end_params.map { |a| [a.source, nil] }
+ end
+
+ if args.named_params
+ params += args.named_params.map do |a|
+ [a[0].source, a[1] ? a[1].source : nil]
+ end
+ end
+
+ if args.double_splat_param
+ params << ['**' + args.double_splat_param.source, nil]
+ end
+
+ if args.block_param
+ params << ['&' + args.block_param.source, nil]
+ end
+
params
end
diff --git a/lib/yard/handlers/ruby/private_class_method_handler.rb b/lib/yard/handlers/ruby/private_class_method_handler.rb
index e0b0e51..1841bb0 100644
--- a/lib/yard/handlers/ruby/private_class_method_handler.rb
+++ b/lib/yard/handlers/ruby/private_class_method_handler.rb
@@ -24,8 +24,19 @@ class YARD::Handlers::Ruby::PrivateClassMethodHandler < YARD::Handlers::Ruby::Ba
def privatize_class_method(node)
if node.literal?
method = Proxy.new(namespace, node[0][0][0], :method)
- ensure_loaded!(method)
- method.visibility = :private
+
+ # Proxy will not have a #visibility method when handling inherited class methods
+ # like :new, yet "private_class_method :new" is valid Ruby syntax. Therefore
+ # if Proxy doesn't respond to #visibility, the object should be skipped.
+ #
+ # However, it is important to note that classes can be reopened, and
+ # private_class_method can be called inside these reopened classes.
+ # Therefore when encountering private_class_method, all of the files need
+ # to be parsed before checking if Proxy responds to #visibility. If this
+ # is not done, it is possible that class methods may be incorrectly marked
+ # public/private.
+ parser.parse_remaining_files
+ method.visibility = :private if method.respond_to? :visibility
else
raise UndocumentableError, "invalid argument to private_class_method: #{node.source}"
end
diff --git a/lib/yard/i18n/pot_generator.rb b/lib/yard/i18n/pot_generator.rb
index df04614..852353c 100644
--- a/lib/yard/i18n/pot_generator.rb
+++ b/lib/yard/i18n/pot_generator.rb
@@ -235,6 +235,8 @@ EOH
def extract_tag_documents(tag)
extract_tag_name(tag)
extract_tag_text(tag)
+
+ extract_documents(tag) if Tags::OverloadTag === tag
end
def extract_tag_name(tag)
diff --git a/lib/yard/logging.rb b/lib/yard/logging.rb
index eb671e2..5329ea8 100644
--- a/lib/yard/logging.rb
+++ b/lib/yard/logging.rb
@@ -26,7 +26,7 @@ module YARD
return false if YARD.ruby18? # threading is too ineffective for progress support
return false if YARD.windows? # windows has poor ANSI support
return false unless io.tty? # no TTY support on IO
- return false if level > WARN # no progress in verbose/debug modes
+ return false unless level > INFO # no progress in verbose/debug modes
@show_progress
end
attr_writer :show_progress
diff --git a/lib/yard/parser/ruby/ast_node.rb b/lib/yard/parser/ruby/ast_node.rb
index db8989a..93a02be 100644
--- a/lib/yard/parser/ruby/ast_node.rb
+++ b/lib/yard/parser/ruby/ast_node.rb
@@ -376,18 +376,46 @@ module YARD
end
class ParameterNode < AstNode
- def required_params; self[0] end
- def required_end_params; self[3] end
- def splat_param; self[2] ? self[2][0] : nil end
- def block_param; self[-1] ? self[-1][0] : nil end
- def optional_params
- optional = self[1] || []
- if self[-3] && self[-3][0] && self[-3][0].type == :default_arg
- optional += self[-3]
+ def unnamed_required_params
+ self[0]
+ end
+
+ def unnamed_optional_params
+ return @unnamed_optional_params if defined?(@unnamed_optional_params)
+
+ params = self[1] || []
+ if self[-3] && self[-3][0] && self[-3][0].type == :unnamed_optional_arg
+ params += self[-3]
+ end
+
+ @unnamed_optional_params = params.empty? ? nil : params
+ end
+
+ def named_params
+ return @named_params if defined?(@named_params)
+
+ if YARD.ruby2? && self[-3] && self[-3][0] && self[-3][0].type == :named_arg
+ @named_params = self[-3]
+ else
+ @named_params = nil
end
- optional.empty? ? nil : optional
end
- def keyword_param; YARD.ruby2? ? self[-2] : nil end
+
+ def splat_param
+ self[2] ? self[2][0] : nil
+ end
+
+ def unnamed_end_params
+ self[3]
+ end
+
+ def double_splat_param
+ YARD.ruby2? ? self[-2] : nil
+ end
+
+ def block_param
+ self[-1] ? self[-1][0] : nil
+ end
end
class MethodCallNode < AstNode
@@ -396,7 +424,13 @@ module YARD
def method_name(name_only = false)
name = self[index_adjust]
- name_only ? name.jump(:ident).first.to_sym : name
+ if name == :call
+ nil
+ elsif name_only && Array === name
+ name.jump(:ident).first.to_sym
+ else
+ name
+ end
end
def parameters(include_block_param = true)
diff --git a/lib/yard/parser/ruby/ruby_parser.rb b/lib/yard/parser/ruby/ruby_parser.rb
index 7d96670..a790391 100644
--- a/lib/yard/parser/ruby/ruby_parser.rb
+++ b/lib/yard/parser/ruby/ruby_parser.rb
@@ -452,21 +452,23 @@ module YARD
def on_params(*args)
args.map! do |arg|
- if arg.class == Array
- if arg.first.class == Array
- arg.map! do |sub_arg|
- if sub_arg.class == Array
- AstNode.new(:default_arg, sub_arg, :listline => lineno..lineno, :listchar => charno..charno)
- else
- sub_arg
- end
+ next arg unless arg.class == Array
+
+ if arg.first.class == Array
+ arg.map! do |sub_arg|
+ next sub_arg unless sub_arg.class == Array
+ if sub_arg[0].type == :label
+ type = :named_arg
+ else
+ type = :unnamed_optional_arg
end
+ AstNode.new(type, sub_arg, :listline => lineno..lineno, :listchar => charno..charno)
end
- AstNode.new(:list, arg, :listline => lineno..lineno, :listchar => charno..charno)
- else
- arg
end
+
+ AstNode.new(:list, arg, :listline => lineno..lineno, :listchar => charno..charno)
end
+
ParameterNode.new(:params, args, :listline => lineno..lineno, :listchar => charno..charno)
end
@@ -503,7 +505,8 @@ module YARD
hash_flag = $1 == '##' ? true : false
- if append_comment && @comments_last_column && @comments_last_column == column
+ if append_comment && @comments_last_column &&
+ @comments_last_column == column && comment_starts_line?(ch)
@comments.delete(lineno - 1)
@comments_flags[lineno] = @comments_flags[lineno - 1]
@comments_flags.delete(lineno - 1)
@@ -542,6 +545,15 @@ module YARD
raise ParserSyntaxError, "syntax error in `#{file}`:(#{lineno},#{column}): #{msg}"
end
+ def comment_starts_line?(charno)
+ (charno-1).downto(0) do |i|
+ ch = @source[i]
+ break if ch == "\n"
+ return false if ch != " " && ch != "\t"
+ end
+ true
+ end
+
def insert_comments
root.traverse do |node|
next if node.type == :comment || node.type == :list || node.parent.type != :list
diff --git a/lib/yard/rake/yardoc_task.rb b/lib/yard/rake/yardoc_task.rb
index 0dcb5ae..a468368 100644
--- a/lib/yard/rake/yardoc_task.rb
+++ b/lib/yard/rake/yardoc_task.rb
@@ -14,6 +14,10 @@ module YARD
# @return [Array<String>] the options passed to the commandline utility
attr_accessor :options
+ # Options to pass to {CLI::Stats}
+ # @return [Array<String>] the options passed to the stats utility
+ attr_accessor :stats_options
+
# The Ruby source files (and any extra documentation files separated by '-')
# to process.
# @example Task files assignment
@@ -46,11 +50,13 @@ module YARD
def initialize(name = :yard)
@name = name
@options = []
+ @stats_options = []
@files = []
yield self if block_given?
self.options += ENV['OPTS'].split(/[ ,]/) if ENV['OPTS']
self.files += ENV['FILES'].split(/[ ,]/) if ENV['FILES']
+ self.options << '--no-stats' unless self.stats_options.empty?
define
end
@@ -66,9 +72,10 @@ module YARD
yardoc = YARD::CLI::Yardoc.new
yardoc.options[:verifier] = verifier if verifier
yardoc.run *(options + files)
+ YARD::CLI::Stats.run(*(stats_options + ['--use-cache'])) unless stats_options.empty?
after.call if after.is_a?(Proc)
end
end
end
end
-end
\ No newline at end of file
+end
diff --git a/lib/yard/server/commands/library_command.rb b/lib/yard/server/commands/library_command.rb
index d337215..a59e75a 100644
--- a/lib/yard/server/commands/library_command.rb
+++ b/lib/yard/server/commands/library_command.rb
@@ -118,9 +118,12 @@ module YARD
end
def not_prepared
- self.caching = false
options.update(:template => :doc_server, :type => :processing)
- [202, {'Content-Type' => 'text/html'}, [render]]
+ self.caching = false
+ self.status = 202
+ self.body = render
+ self.headers = {'Content-Type' => 'text/html'}
+ [status, headers, [body]]
end
# Hack to load a custom fulldoc template object that does
diff --git a/lib/yard/server/templates/default/layout/html/breadcrumb.erb b/lib/yard/server/templates/default/layout/html/breadcrumb.erb
index e86cd98..2beb81a 100644
--- a/lib/yard/server/templates/default/layout/html/breadcrumb.erb
+++ b/lib/yard/server/templates/default/layout/html/breadcrumb.erb
@@ -1,5 +1,5 @@
<form class="search" method="get" action="/<%= base_path(router.search_prefix) %>">
- Search: <input name="q" type="search" placeholder="Search" id="search_box" size="30" value="<%= @query %>" />
+ Search: <input name="q" type="search" placeholder="Search" id="search_box" size="30" value="<%= h @query %>" />
</form>
<script type="text/javascript" charset="utf-8">
$(function() {
diff --git a/lib/yard/server/templates/doc_server/processing/html/processing.erb b/lib/yard/server/templates/doc_server/processing/html/processing.erb
index b388cc9..c452a2c 100644
--- a/lib/yard/server/templates/doc_server/processing/html/processing.erb
+++ b/lib/yard/server/templates/doc_server/processing/html/processing.erb
@@ -8,7 +8,8 @@
<script type="text/javascript" charset="utf-8" src="/js/jquery.js"></script>
<script type="text/javascript" charset="utf-8">
function checkPage(process) {
- $.ajax({cache: false, url: "<%= router.request.path %>" + (process ? "?process=true" : ""), statusCode: { 200: function() { window.location = "<%= @path %>"; } } });
+ $.ajax({cache: false, url: "<%= router.request.path %>" + (process ? "?process=true" : ""),
+ statusCode: { 200: function() { window.location.reload(true); } } });
setTimeout('checkPage()', 2000);
}
function setFade() {
diff --git a/lib/yard/tags/library.rb b/lib/yard/tags/library.rb
index 06e6bdf..0ed5c86 100644
--- a/lib/yard/tags/library.rb
+++ b/lib/yard/tags/library.rb
@@ -78,8 +78,6 @@ module YARD
# @example
# YARD::Tags::Library.default_factory = MyFactory
#
- # @param [Class, Object] factory the factory that parses all tags
- #
# @see DefaultFactory
def default_factory
@default_factory ||= DefaultFactory.new
diff --git a/lib/yard/templates/helpers/html_helper.rb b/lib/yard/templates/helpers/html_helper.rb
index 167213d..ca09df3 100644
--- a/lib/yard/templates/helpers/html_helper.rb
+++ b/lib/yard/templates/helpers/html_helper.rb
@@ -61,7 +61,8 @@ module YARD
provider.new(text, :autolink).to_html
elsif provider.to_s == 'RedcarpetCompat'
provider.new(text, :no_intraemphasis, :gh_blockcode,
- :fenced_code, :autolink).to_html
+ :fenced_code, :autolink, :tables,
+ :lax_spacing).to_html
else
provider.new(text).to_html
end
@@ -267,7 +268,7 @@ module YARD
title = h(object.relative_path(obj))
end
else
- title = h(obj.to_s)
+ title = h(obj.title)
end
return title unless serializer
return title if obj.is_a?(CodeObjects::Proxy)
@@ -327,6 +328,7 @@ module YARD
objpath = serializer.serialized_path(obj)
return link unless objpath
+ relative = false if object == Registry.root
if relative
fromobj = object
if object.is_a?(CodeObjects::Base) &&
diff --git a/lib/yard/templates/template.rb b/lib/yard/templates/template.rb
index c3ebf9f..7886b27 100644
--- a/lib/yard/templates/template.rb
+++ b/lib/yard/templates/template.rb
@@ -314,11 +314,11 @@ module YARD
# Calls the ERB file from the last inherited template with {#section}.erb
#
- # @param [Symbol, String] section if provided, uses a specific section name
+ # @param [Symbol, String] sect if provided, uses a specific section name
# @return [String] the rendered ERB file in any of the inherited template
# paths.
- def superb(section = section, &block)
- filename = self.class.find_nth_file(erb_file_for(section), 2)
+ def superb(sect = section, &block)
+ filename = self.class.find_nth_file(erb_file_for(sect), 2)
return "" unless filename
method_name = ErbCache.method_for(filename) { erb_with(IO.read(filename), filename) }
send(method_name, &block)
diff --git a/lib/yard/version.rb b/lib/yard/version.rb
index c41cb44..4959000 100644
--- a/lib/yard/version.rb
+++ b/lib/yard/version.rb
@@ -1,3 +1,3 @@
module YARD
- VERSION = '0.8.7.4'
+ VERSION = '0.8.7.6'
end
diff --git a/metadata.yml b/metadata.yml
index 29ca80a..b56a928 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: yard
version: !ruby/object:Gem::Version
- version: 0.8.7.4
+ version: 0.8.7.6
platform: ruby
authors:
- Loren Segal
autorequire:
bindir: bin
cert_chain: []
-date: 2014-03-22 00:00:00.000000000 Z
+date: 2014-10-26 00:00:00.000000000 Z
dependencies: []
description: |2
YARD is a documentation generation tool for the Ruby programming language.
@@ -23,18 +23,46 @@ executables:
extensions: []
extra_rdoc_files: []
files:
+- ".yardopts"
+- CHANGELOG.md
+- LEGAL
+- LICENSE
+- README.md
+- Rakefile
+- benchmarks/builtins_vs_eval.rb
+- benchmarks/concat_vs_join.rb
+- benchmarks/erb_vs_erubis.rb
+- benchmarks/format_args.rb
+- benchmarks/generation.rb
+- benchmarks/marshal_vs_dbm.rb
+- benchmarks/parsing.rb
+- benchmarks/pathname_vs_string.rb
+- benchmarks/rdoc_vs_yardoc.rb
+- benchmarks/registry_store_types.rb
+- benchmarks/ri_vs_yri.rb
+- benchmarks/ripper_parser.rb
+- benchmarks/splat_vs_flatten.rb
+- benchmarks/template_erb.rb
+- benchmarks/template_format.rb
+- benchmarks/template_profile.rb
+- benchmarks/yri_cache.rb
+- bin/yard
+- bin/yardoc
+- bin/yri
- docs/CodeObjects.md
- docs/GettingStarted.md
- docs/Handlers.md
+- docs/Overview.md
+- docs/Parser.md
+- docs/Tags.md
+- docs/TagsArch.md
+- docs/Templates.md
+- docs/WhatsNew.md
- docs/images/code-objects-class-diagram.png
- docs/images/handlers-class-diagram.png
- docs/images/overview-class-diagram.png
- docs/images/parser-class-diagram.png
- docs/images/tags-class-diagram.png
-- docs/Overview.md
-- docs/Parser.md
-- docs/Tags.md
-- docs/TagsArch.md
- docs/templates/default/fulldoc/html/full_list_tag.erb
- docs/templates/default/fulldoc/html/setup.rb
- docs/templates/default/layout/html/setup.rb
@@ -42,12 +70,8 @@ files:
- docs/templates/default/yard_tags/html/list.erb
- docs/templates/default/yard_tags/html/setup.rb
- docs/templates/plugin.rb
-- docs/Templates.md
-- docs/WhatsNew.md
-- bin/yard
-- bin/yardoc
-- bin/yri
- lib/rubygems_plugin.rb
+- lib/yard.rb
- lib/yard/autoload.rb
- lib/yard/cli/command.rb
- lib/yard/cli/command_parser.rb
@@ -168,11 +192,11 @@ files:
- lib/yard/rake/yardoc_task.rb
- lib/yard/registry.rb
- lib/yard/registry_store.rb
-- lib/yard/rubygems/backports/gem.rb
+- lib/yard/rubygems/backports.rb
- lib/yard/rubygems/backports/LICENSE.txt
- lib/yard/rubygems/backports/MIT.txt
+- lib/yard/rubygems/backports/gem.rb
- lib/yard/rubygems/backports/source_index.rb
-- lib/yard/rubygems/backports.rb
- lib/yard/rubygems/doc_manager.rb
- lib/yard/rubygems/specification.rb
- lib/yard/serializers/base.rb
@@ -180,6 +204,7 @@ files:
- lib/yard/serializers/process_serializer.rb
- lib/yard/serializers/stdout_serializer.rb
- lib/yard/serializers/yardoc_serializer.rb
+- lib/yard/server.rb
- lib/yard/server/adapter.rb
- lib/yard/server/commands/base.rb
- lib/yard/server/commands/display_file_command.rb
@@ -214,7 +239,6 @@ files:
- lib/yard/server/templates/doc_server/search/html/search.erb
- lib/yard/server/templates/doc_server/search/html/setup.rb
- lib/yard/server/webrick_adapter.rb
-- lib/yard/server.rb
- lib/yard/tags/default_factory.rb
- lib/yard/tags/default_tag.rb
- lib/yard/tags/directives.rb
@@ -243,7 +267,6 @@ files:
- lib/yard/templates/template_options.rb
- lib/yard/verifier.rb
- lib/yard/version.rb
-- lib/yard.rb
- spec/cli/command_parser_spec.rb
- spec/cli/command_spec.rb
- spec/cli/config_spec.rb
@@ -314,6 +337,8 @@ files:
- spec/handlers/examples/mixin_handler_001.rb.txt
- spec/handlers/examples/module_handler_001.rb.txt
- spec/handlers/examples/private_class_method_handler_001.rb.txt
+- spec/handlers/examples/private_class_method_handler_002.rb.txt
+- spec/handlers/examples/private_class_method_handler_003.rb.txt
- spec/handlers/examples/private_constant_handler_001.rb.txt
- spec/handlers/examples/process_handler_001.rb.txt
- spec/handlers/examples/visibility_handler_001.rb.txt
@@ -362,9 +387,9 @@ files:
- spec/registry_store_spec.rb
- spec/rubygems/doc_manager_spec.rb
- spec/serializers/data/serialized_yardoc/checksums
+- spec/serializers/data/serialized_yardoc/objects/Foo.dat
- spec/serializers/data/serialized_yardoc/objects/Foo/bar_i.dat
- spec/serializers/data/serialized_yardoc/objects/Foo/baz_i.dat
-- spec/serializers/data/serialized_yardoc/objects/Foo.dat
- spec/serializers/data/serialized_yardoc/objects/root.dat
- spec/serializers/data/serialized_yardoc/proxy_types
- spec/serializers/file_system_serializer_spec.rb
@@ -558,28 +583,6 @@ files:
- templates/guide/onefile/html/setup.rb
- templates/guide/onefile/html/toc.erb
- templates/guide/tags/html/setup.rb
-- benchmarks/builtins_vs_eval.rb
-- benchmarks/concat_vs_join.rb
-- benchmarks/erb_vs_erubis.rb
-- benchmarks/format_args.rb
-- benchmarks/generation.rb
-- benchmarks/marshal_vs_dbm.rb
-- benchmarks/parsing.rb
-- benchmarks/pathname_vs_string.rb
-- benchmarks/rdoc_vs_yardoc.rb
-- benchmarks/registry_store_types.rb
-- benchmarks/ri_vs_yri.rb
-- benchmarks/ripper_parser.rb
-- benchmarks/splat_vs_flatten.rb
-- benchmarks/template_erb.rb
-- benchmarks/template_format.rb
-- benchmarks/template_profile.rb
-- benchmarks/yri_cache.rb
-- LICENSE
-- LEGAL
-- README.md
-- Rakefile
-- .yardopts
- yard.gemspec
homepage: http://yardoc.org
licenses:
@@ -591,19 +594,18 @@ require_paths:
- lib
required_ruby_version: !ruby/object:Gem::Requirement
requirements:
- - - '>='
+ - - ">="
- !ruby/object:Gem::Version
version: '0'
required_rubygems_version: !ruby/object:Gem::Requirement
requirements:
- - - '>='
+ - - ">="
- !ruby/object:Gem::Version
version: '0'
requirements: []
rubyforge_project: yard
-rubygems_version: 2.0.3
+rubygems_version: 2.4.1
signing_key:
specification_version: 4
summary: Documentation tool for consistent and usable documentation in Ruby.
test_files: []
-has_rdoc: yard
diff --git a/spec/cli/yardoc_spec.rb b/spec/cli/yardoc_spec.rb
index 17ef143..30ccb16 100644
--- a/spec/cli/yardoc_spec.rb
+++ b/spec/cli/yardoc_spec.rb
@@ -320,7 +320,7 @@ describe YARD::CLI::Yardoc do
CodeObjects::ExtraFileObject.stub!(:new).with('extra_file1').and_return(extra_file_object1)
CodeObjects::ExtraFileObject.stub!(:new).with('extra_file2').and_return(extra_file_object2)
- Dir.stub!(:glob).with('README*').and_return([])
+ Dir.stub!(:glob).with('README{,*[^~]}').and_return([])
File.stub!(:file?).with('extra_file1').and_return(true)
File.stub!(:file?).with('extra_file2').and_return(true)
@yardoc.run('--locale=fr', '-', 'extra_file1', 'extra_file2')
@@ -562,7 +562,7 @@ describe YARD::CLI::Yardoc do
describe 'Extra file arguments' do
it "should accept extra files if specified after '-' with source files" do
- Dir.should_receive(:glob).with('README*').and_return([])
+ Dir.should_receive(:glob).with('README{,*[^~]}').and_return([])
File.should_receive(:file?).with('extra_file1').and_return(true)
File.should_receive(:file?).with('extra_file2').and_return(true)
File.should_receive(:read).with('extra_file1').and_return('')
@@ -575,14 +575,14 @@ describe YARD::CLI::Yardoc do
end
it "should accept files section only containing extra files" do
- Dir.should_receive(:glob).with('README*').and_return([])
+ Dir.should_receive(:glob).with('README{,*[^~]}').and_return([])
@yardoc.parse_arguments *%w( - LICENSE )
@yardoc.files.should == %w( {lib,app}/**/*.rb ext/**/*.c )
@yardoc.options.files.should == [CodeObjects::ExtraFileObject.new('LICENSE', '')]
end
it "should accept globs as extra files" do
- Dir.should_receive(:glob).with('README*').and_return []
+ Dir.should_receive(:glob).with('README{,*[^~]}').and_return []
Dir.should_receive(:glob).with('*.txt').and_return ['a.txt', 'b.txt']
File.should_receive(:read).with('a.txt').and_return('')
File.should_receive(:read).with('b.txt').and_return('')
@@ -606,7 +606,7 @@ describe YARD::CLI::Yardoc do
end
it "should use first file as readme if no readme is specified when using --one-file" do
- Dir.should_receive(:glob).with('README*').and_return []
+ Dir.should_receive(:glob).with('README{,*[^~]}').and_return []
Dir.should_receive(:glob).with('lib/*.rb').and_return(['lib/foo.rb'])
File.should_receive(:read).with('lib/foo.rb').and_return('')
@yardoc.parse_arguments *%w( --one-file lib/*.rb )
@@ -614,7 +614,7 @@ describe YARD::CLI::Yardoc do
end
it "should use readme it exists when using --one-file" do
- Dir.should_receive(:glob).with('README*').and_return ['README']
+ Dir.should_receive(:glob).with('README{,*[^~]}').and_return ['README']
File.should_receive(:read).with('README').and_return('')
@yardoc.parse_arguments *%w( --one-file lib/*.rb )
@yardoc.options.readme.should == CodeObjects::ExtraFileObject.new('README', '')
diff --git a/spec/handlers/examples/private_class_method_handler_001.rb.txt b/spec/handlers/examples/private_class_method_handler_001.rb.txt
index 868056c..b2e31d3 100644
--- a/spec/handlers/examples/private_class_method_handler_001.rb.txt
+++ b/spec/handlers/examples/private_class_method_handler_001.rb.txt
@@ -2,6 +2,8 @@ class A
def self.b; end
def self.c; end
def self.d; end
+ def self.e; end
private_class_method(:c, :d)
+ private_class_method("e")
end
diff --git a/spec/handlers/examples/private_class_method_handler_002.rb.txt b/spec/handlers/examples/private_class_method_handler_002.rb.txt
new file mode 100644
index 0000000..6efcaaa
--- /dev/null
+++ b/spec/handlers/examples/private_class_method_handler_002.rb.txt
@@ -0,0 +1,18 @@
+class SingletonClass
+
+ # Public
+ def self.foo
+ 'foo'
+ end
+
+ # Private
+ def self.bar
+ end
+
+ # Private from reopening class.
+ def self.baz
+ end
+
+ private_class_method :new, :bar
+
+end
diff --git a/spec/handlers/examples/private_class_method_handler_003.rb.txt b/spec/handlers/examples/private_class_method_handler_003.rb.txt
new file mode 100644
index 0000000..118a0da
--- /dev/null
+++ b/spec/handlers/examples/private_class_method_handler_003.rb.txt
@@ -0,0 +1,11 @@
+class SingletonClass
+ # Reopening singleton class from
+ # private_class_method_handler_002.rb.txt
+
+ private_class_method :baz
+
+ # Public from reopened class.
+ def self.bat
+ end
+
+end
diff --git a/spec/handlers/private_class_method_handler_spec.rb b/spec/handlers/private_class_method_handler_spec.rb
index 8729ebd..49cbff7 100644
--- a/spec/handlers/private_class_method_handler_spec.rb
+++ b/spec/handlers/private_class_method_handler_spec.rb
@@ -4,16 +4,51 @@ describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}PrivateClassMe
before(:all) { parse_file :private_class_method_handler_001, __FILE__ }
it "should handle private_class_method statement" do
- Registry.at('A.c').visibility.should == :private
- Registry.at('A.d').visibility.should == :private
+ Registry.at('A.c').visibility.should eq :private
+ Registry.at('A.d').visibility.should eq :private
+ Registry.at('A.e').visibility.should eq :private
end
it "should fail if parameter is not String or Symbol" do
- undoc_error 'class Foo; private_class_method "x"; end'
undoc_error 'class Foo; X = 1; private_class_method X.new("hi"); end'
+ undoc_error 'class Foo; X = 1; private_class_method 123; end'
end unless LEGACY_PARSER
- it "should fail if method can't be recognized" do
- undoc_error 'class Foo2; private_class_method :x; end'
- end
+ # Issue #760
+ # https://github.com/lsegal/yard/issues/760
+ it "should handle singleton classes" do
+ # Note: It's important to def a method within the singleton class or
+ # the bug may not trigger.
+ code = 'class SingletonClass; private_class_method :new; def self.foo; "foo"end; end'
+ StubbedSourceParser.parse_string(code) # Should be successful.
+ end unless LEGACY_PARSER
+
+
+ describe "should handle reopened class" do
+
+ # Modified #parse_file from '/spec/spec_helper.rb' because the second example
+ # file was overwriting the data from the first example when trying to reopen
+ # the class.
+ def parse_files(files, thisfile = __FILE__, log_level = log.level, ext = '.rb.txt')
+ Registry.clear
+ paths = files.map { |file| File.join(File.dirname(thisfile), 'examples', file.to_s + ext) }
+ YARD::Parser::SourceParser.parse(paths, [], log_level)
+ end
+
+ before {
+ parse_files [
+ :private_class_method_handler_002,
+ :private_class_method_handler_003
+ ], __FILE__
+ }
+
+ specify do
+ Registry.at('SingletonClass.foo').visibility.should eq :public
+ Registry.at('SingletonClass.bar').visibility.should eq :private
+ Registry.at('SingletonClass.baz').visibility.should eq :private
+ Registry.at('SingletonClass.bat').visibility.should eq :public
+ end
+
+ end unless LEGACY_PARSER # reopened class
+
end
diff --git a/spec/i18n/pot_generator_spec.rb b/spec/i18n/pot_generator_spec.rb
index 4271337..a7cc3c2 100644
--- a/spec/i18n/pot_generator_spec.rb
+++ b/spec/i18n/pot_generator_spec.rb
@@ -205,6 +205,36 @@ eod
}
})
end
+
+ it "should extract overload tag recursively" do
+ object = YARD::CodeObjects::MethodObject.new(@yard, :parse, :module) do |o|
+ o.docstring = <<-eod
+ at overload foo(i)
+ docstring foo(i)
+ @param [Integer] i integer parameter
+eod
+ end
+
+ @generator.parse_objects([object])
+ @generator.messages.should == create_messages({
+ "tag|overload|foo" => {
+ :locations => [],
+ :comments => ["@overload"]
+ },
+ "docstring foo(i)" => {
+ :locations => [],
+ :comments => ["YARD.parse"]
+ },
+ "tag|param|i" => {
+ :locations => [],
+ :comments => ["@param [Integer]"]
+ },
+ "integer parameter" => {
+ :locations => [],
+ :comments => ["@param [Integer] i"]
+ },
+ })
+ end
end
describe "File" do
diff --git a/spec/parser/c_parser_spec.rb b/spec/parser/c_parser_spec.rb
index 0847f3c..8555ab2 100644
--- a/spec/parser/c_parser_spec.rb
+++ b/spec/parser/c_parser_spec.rb
@@ -126,6 +126,24 @@ describe YARD::Parser::C::CParser do
end
end
end
+
+ describe 'C macros in declaration' do
+ it "should handle C macros in method declaration" do
+ Registry.clear
+ parse <<-eof
+ // docstring
+ FOOBAR VALUE func() { }
+
+ void
+ Init_mod(void)
+ {
+ rb_define_method(rb_cFoo, "func", func, 0); \
+ }
+ eof
+
+ Registry.at('Foo#func').docstring.should == "docstring"
+ end
+ end
end
describe 'Override comments' do
diff --git a/spec/parser/ruby/ruby_parser_spec.rb b/spec/parser/ruby/ruby_parser_spec.rb
index ef7c567..6eec437 100644
--- a/spec/parser/ruby/ruby_parser_spec.rb
+++ b/spec/parser/ruby/ruby_parser_spec.rb
@@ -178,11 +178,40 @@ eof
ast.jump(:class).line_range.should == (2..4)
end
+ it 'should handle defs with unnamed argument with default values' do
+ ast = stmt('def hello(one, two = 2, three = 3) end').jump(:params)
+ ast.source.should == 'one, two = 2, three = 3'
+ end
+
+ it 'should handle defs with splats' do
+ ast = stmt('def hello(one, *two) end').jump(:params)
+ ast.source.should == 'one, *two'
+ end
+
+ if YARD.ruby2?
+ it 'should handle defs with named arguments with default values' do
+ ast = stmt('def hello(one, two: 2, three: 3) end').jump(:params)
+ ast.source.should == 'one, two: 2, three: 3'
+ end
+ end
+
+ if NAMED_OPTIONAL_ARGUMENTS
+ it 'should handle defs with named arguments without default values' do
+ ast = stmt('def hello(one, two:, three:) end').jump(:params)
+ ast.source.should == 'one, two:, three:'
+ end
+
+ it 'should handle defs with double splats' do
+ ast = stmt('def hello(one, **two) end').jump(:params)
+ ast.source.should == 'one, **two'
+ end
+ end
+
it "should end source properly on array reference" do
ast = stmt("AS[0, 1 ] ")
ast.source.should == 'AS[0, 1 ]'
- ast = stmt("def x(a = S[1]) end").jump(:default_arg)
+ ast = stmt('def x(a = S[1]) end').jump(:params)
ast.source.should == 'a = S[1]'
end
@@ -330,5 +359,17 @@ eof
ast.first.last.last.type.should == :comment
ast.first.last.last.docstring.should == "end comment"
end
+
+ it "should not group comments if they don't begin the line" do
+ Registry.clear
+ ast = YARD.parse_string(<<-eof).enumerator
+ class Foo
+ CONST1 = 1 # Comment here
+ CONST2 = 2 # Another comment here
+ end
+ eof
+ Registry.at("Foo::CONST1").docstring.should == "Comment here"
+ Registry.at("Foo::CONST2").docstring.should == "Another comment here"
+ end
end
end if HAVE_RIPPER
diff --git a/spec/parser/source_parser_spec.rb b/spec/parser/source_parser_spec.rb
index 162ac57..7b1f80c 100644
--- a/spec/parser/source_parser_spec.rb
+++ b/spec/parser/source_parser_spec.rb
@@ -708,10 +708,20 @@ describe YARD::Parser::SourceParser do
Registry.at('A::B#d').should_not be_nil
end
- it 'supports keyword arguments' do
- YARD.parse_string 'def foo(a: 1, b: 2, **kwargs) end'
- args = [['a:', '1'], ['b:', '2'], ['**kwargs', nil]]
- Registry.at('#foo').parameters.should eq(args)
- end if YARD.ruby2?
+ if YARD.ruby2?
+ it 'supports named arguments with default values' do
+ YARD.parse_string 'def foo(a, b = 1, *c, d, e: 3, **f, &g) end'
+ args = [['a', nil], ['b', '1'], ['*c', nil], ['d', nil], ['e:', '3'], ['**f', nil], ['&g', nil]]
+ Registry.at('#foo').parameters.should eq(args)
+ end
+ end
+
+ if NAMED_OPTIONAL_ARGUMENTS && !LEGACY_PARSER
+ it 'supports named arguments without default values' do
+ YARD.parse_string 'def foo(a, b = 1, *c, d, e: 3, f:, **g, &h) end'
+ args = [['a', nil], ['b', '1'], ['*c', nil], ['d', nil], ['e:', '3'], ['f:', nil], ['**g', nil], ['&h', nil]]
+ Registry.at('#foo').parameters.should eq(args)
+ end
+ end
end
end
diff --git a/spec/rake/yardoc_task_spec.rb b/spec/rake/yardoc_task_spec.rb
index 5ab2657..ddfaf2b 100644
--- a/spec/rake/yardoc_task_spec.rb
+++ b/spec/rake/yardoc_task_spec.rb
@@ -56,6 +56,33 @@ describe YARD::Rake::YardocTask do
end
end
+ describe '#stats_options' do
+ before do
+ @yard_stats = Object.new
+ @yard_stats.stub!(:run)
+ YARD::CLI::Stats.stub!(:new).and_return(@yard_stats)
+ end
+
+ it "should not invoke stats" do
+ @yard_stats.should_not_receive(:run)
+ @yardoc.statistics = true
+ YARD::Rake::YardocTask.new do |t|
+ end
+ run
+ @yardoc.statistics.should == true
+ end
+
+ it "should invoke stats" do
+ @yard_stats.should_receive(:run).with('--list-undoc', '--use-cache')
+ @yardoc.statistics = true
+ YARD::Rake::YardocTask.new do |t|
+ t.stats_options = %w(--list-undoc)
+ end
+ run
+ @yardoc.statistics.should == false
+ end
+ end
+
describe '#before' do
it "should allow before callback" do
proc = lambda { }
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 398c13a..814a35b 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -36,6 +36,8 @@ unless defined?(HAVE_RIPPER)
end if ENV['LEGACY']
end
+NAMED_OPTIONAL_ARGUMENTS = RUBY_VERSION >= '2.1.0'
+
def parse_file(file, thisfile = __FILE__, log_level = log.level, ext = '.rb.txt')
Registry.clear
path = File.join(File.dirname(thisfile), 'examples', file.to_s + ext)
diff --git a/spec/templates/helpers/html_helper_spec.rb b/spec/templates/helpers/html_helper_spec.rb
index d461e00..0f17269 100644
--- a/spec/templates/helpers/html_helper_spec.rb
+++ b/spec/templates/helpers/html_helper_spec.rb
@@ -166,6 +166,38 @@ describe YARD::Templates::Helpers::HtmlHelper do
htmlify('{http://example.com}', :markdown).chomp.should =~
%r{<p><a href="http://example.com".*>http://example.com</a></p>}
end
+
+ it "should create tables (markdown specific)" do
+ log.enter_level(Logger::FATAL) do
+ unless markup_class(:markdown).to_s == "RedcarpetCompat"
+ pending 'This test depends on a markdown engine that supports tables'
+ end
+ end
+
+ markdown = <<-EOF.strip
+ City | State | Country
+ --------|-------|--------
+ Raleigh | NC | US
+ Seattle | WA | US
+ EOF
+
+ html = htmlify(markdown, :markdown)
+ html.should =~ %r{<table>}
+ html.should =~ %r{<th>City</th>}
+ html.should =~ %r{<td>NC</td>}
+ end
+
+ it 'should handle fenced code blocks (Redcarpet specific)' do
+ log.enter_level(Logger::FATAL) do
+ unless markup_class(:markdown).to_s == 'RedcarpetCompat'
+ pending 'This test is Redcarpet specific'
+ end
+ end
+
+ markdown = "Introduction:\n```ruby\nputs\n\nputs\n```"
+ html = htmlify(markdown, :markdown)
+ html.should =~ %r{^<p>Introduction:</p>.*<code class="ruby">}m
+ end
end
describe "#link_object" do
diff --git a/templates/default/fulldoc/html/full_list.erb b/templates/default/fulldoc/html/full_list.erb
index b42a1c5..4284115 100644
--- a/templates/default/fulldoc/html/full_list.erb
+++ b/templates/default/fulldoc/html/full_list.erb
@@ -16,7 +16,11 @@
</head>
<body>
<script type="text/javascript" charset="utf-8">
- if (window.top.frames.main) {
+ var hasFrames = false;
+ try {
+ hasFrames = window.top.frames.main ? true : false;
+ } catch (e) { }
+ if (hasFrames) {
document.getElementById('base_target').target = 'main';
document.body.className = 'frames';
}
diff --git a/templates/default/fulldoc/html/js/full_list.js b/templates/default/fulldoc/html/js/full_list.js
index bc9f04f..4b10377 100644
--- a/templates/default/fulldoc/html/js/full_list.js
+++ b/templates/default/fulldoc/html/js/full_list.js
@@ -123,7 +123,10 @@ function linkList() {
}
}
if (clicked) clicked.removeClass('clicked');
- var win = window.top.frames.main ? window.top.frames.main : window.parent;
+ var win;
+ try {
+ win = window.top.frames.main ? window.top.frames.main : window.parent;
+ } catch (e) { win = window.parent; }
if (this.tagName.toLowerCase() == "a") {
clicked = $(this).parents('li').addClass('clicked');
win.location = this.href;
diff --git a/templates/default/tags/html/option.erb b/templates/default/tags/html/option.erb
index b9914b5..1811b15 100644
--- a/templates/default/tags/html/option.erb
+++ b/templates/default/tags/html/option.erb
@@ -1,6 +1,6 @@
<% if object.has_tag?(:option) %>
<% object.parameters.each do |param, default| %>
- <% tags = object.tags(:option).select {|x| x.name.to_s == param.to_s } %>
+ <% tags = object.tags(:option).select {|x| x.name.to_s == param.to_s.sub(/^\*+/, '') } %>
<% next if tags.empty? %>
<p class="tag_title">Options Hash (<tt><%= param %></tt>):</p>
<ul class="option">
diff --git a/yard.gemspec b/yard.gemspec
index adcf7aa..d88ee9c 100644
--- a/yard.gemspec
+++ b/yard.gemspec
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
s.homepage = "http://yardoc.org"
s.platform = Gem::Platform::RUBY
s.files = Dir.glob("{docs,bin,lib,spec,templates,benchmarks}/**/*") +
- ['LICENSE', 'LEGAL', 'README.md', 'Rakefile', '.yardopts', __FILE__]
+ ['CHANGELOG.md', 'LICENSE', 'LEGAL', 'README.md', 'Rakefile', '.yardopts', __FILE__]
s.require_paths = ['lib']
s.executables = ['yard', 'yardoc', 'yri']
s.has_rdoc = 'yard'
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/yard.git
More information about the Pkg-ruby-extras-commits
mailing list