yard 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of yard might be problematic. Click here for more details.
- data/.yardopts +1 -0
- data/ChangeLog +181 -0
- data/LEGAL +74 -0
- data/LICENSE +1 -1
- data/README.md +15 -8
- data/lib/yard.rb +3 -3
- data/lib/yard/cli/yard_graph.rb +10 -10
- data/lib/yard/cli/yardoc.rb +29 -9
- data/lib/yard/code_objects/base.rb +1 -1
- data/lib/yard/code_objects/class_object.rb +1 -1
- data/lib/yard/code_objects/module_object.rb +1 -1
- data/lib/yard/code_objects/proxy.rb +1 -1
- data/lib/yard/docstring.rb +2 -2
- data/lib/yard/handlers/ruby/constant_handler.rb +2 -2
- data/lib/yard/handlers/ruby/legacy/class_condition_handler.rb +64 -1
- data/lib/yard/handlers/ruby/legacy/constant_handler.rb +2 -2
- data/lib/yard/handlers/ruby/legacy/method_handler.rb +11 -0
- data/lib/yard/handlers/ruby/method_handler.rb +11 -0
- data/lib/yard/parser/ruby/legacy/statement_list.rb +3 -3
- data/lib/yard/parser/source_parser.rb +2 -2
- data/lib/yard/tags/default_factory.rb +9 -6
- data/lib/yard/templates/helpers/base_helper.rb +14 -4
- data/lib/yard/templates/helpers/html_helper.rb +16 -22
- data/lib/yard/templates/helpers/method_helper.rb +1 -1
- data/lib/yard/templates/helpers/module_helper.rb +1 -2
- data/spec/cli/yardoc_spec.rb +1 -1
- data/spec/code_objects/class_object_spec.rb +1 -0
- data/spec/code_objects/module_object_spec.rb +1 -0
- data/spec/docstring_spec.rb +14 -0
- data/spec/handlers/class_condition_handler_spec.rb +8 -10
- data/spec/handlers/examples/method_handler_001.rb.txt +4 -0
- data/spec/handlers/method_handler_spec.rb +7 -0
- data/spec/parser/ruby/legacy/statement_list_spec.rb +14 -0
- data/spec/parser/source_parser_spec.rb +7 -0
- data/spec/tags/default_factory_spec.rb +1 -0
- data/spec/templates/examples/class001.html +5 -5
- data/spec/templates/examples/method001.html +1 -1
- data/spec/templates/examples/module001.html +4 -4
- data/spec/templates/helpers/base_helper_spec.rb +18 -1
- data/spec/templates/helpers/html_helper_spec.rb +2 -1
- data/spec/templates/module_spec.rb +5 -2
- data/templates/default/docstring/html/abstract.erb +2 -2
- data/templates/default/docstring/html/deprecated.erb +1 -1
- data/templates/default/docstring/html/note.erb +2 -2
- data/templates/default/docstring/html/private.erb +4 -0
- data/templates/default/docstring/html/todo.erb +2 -2
- data/templates/default/docstring/setup.rb +6 -1
- data/templates/default/docstring/text/private.erb +2 -0
- data/templates/default/fulldoc/html/css/style.css +7 -3
- data/templates/default/fulldoc/html/js/app.js +27 -0
- data/templates/default/fulldoc/html/setup.rb +1 -1
- data/templates/default/module/html/attribute_summary.erb +1 -1
- data/templates/default/module/html/box_info.erb +1 -1
- data/templates/default/module/html/header.erb +2 -1
- data/templates/default/module/html/item_summary.erb +1 -0
- data/templates/default/module/html/method_summary.erb +4 -1
- data/templates/default/module/text/extends.erb +2 -2
- data/templates/default/tags/html/see.erb +1 -1
- metadata +5 -2
data/.yardopts
CHANGED
data/ChangeLog
CHANGED
@@ -1,3 +1,158 @@
|
|
1
|
+
2010-05-22 Loren Segal <lsegal@soen.ca>
|
2
|
+
|
3
|
+
* ChangeLog, README.md, lib/yard.rb, yard.gemspec: Bump version to 0.5.5
|
4
|
+
|
5
|
+
2010-05-21 Loren Segal <lsegal@soen.ca>
|
6
|
+
|
7
|
+
* lib/yard/parser/source_parser.rb, spec/parser/source_parser_spec.rb: Clean
|
8
|
+
path names when parsing source files Closes gh-129
|
9
|
+
|
10
|
+
2010-05-10 Michael Edgar <michael.j.edgar@dartmouth.edu>
|
11
|
+
|
12
|
+
* lib/yard/handlers/ruby/legacy/method_handler.rb,
|
13
|
+
lib/yard/handlers/ruby/method_handler.rb,
|
14
|
+
spec/handlers/examples/method_handler_001.rb.txt,
|
15
|
+
spec/handlers/method_handler_spec.rb: Auto-generate parameters referred to by
|
16
|
+
@option tags. Closes gh-16
|
17
|
+
|
18
|
+
* lib/yard/docstring.rb, spec/docstring_spec.rb: Resolve reftags the same way
|
19
|
+
as normal references Closes gh-14
|
20
|
+
|
21
|
+
2010-05-21 Loren Segal <lsegal@soen.ca>
|
22
|
+
|
23
|
+
* lib/yard/code_objects/base.rb, lib/yard/code_objects/proxy.rb: Remove #hash
|
24
|
+
implementation due to weird Registry reloading side effects
|
25
|
+
|
26
|
+
* lib/yard/tags/default_factory.rb, spec/tags/default_factory_spec.rb: Type
|
27
|
+
list in tag text should only be listed at the beginning or after first token.
|
28
|
+
Closes gh-120
|
29
|
+
|
30
|
+
* templates/default/module/html/box_info.erb,
|
31
|
+
templates/default/module/text/extends.erb: Rename "Extends" to "Extended by"
|
32
|
+
for class mixins in templates. Closes gh-110
|
33
|
+
|
34
|
+
* lib/yard/templates/helpers/html_helper.rb: Revert automatic typewriter
|
35
|
+
textifying of links
|
36
|
+
|
37
|
+
* lib/yard/templates/helpers/base_helper.rb,
|
38
|
+
lib/yard/templates/helpers/html_helper.rb,
|
39
|
+
spec/templates/examples/class001.html,
|
40
|
+
spec/templates/helpers/base_helper_spec.rb,
|
41
|
+
spec/templates/helpers/html_helper_spec.rb,
|
42
|
+
templates/default/tags/html/see.erb: Refactor #resolve_links into #linkify to
|
43
|
+
handle 'file:' and URL links more consistently across templates. Closes
|
44
|
+
gh-121
|
45
|
+
|
46
|
+
* lib/yard/code_objects/module_object.rb,
|
47
|
+
spec/code_objects/module_object_spec.rb: Fix mixins listing twice for
|
48
|
+
#inheritance_tree on module objects
|
49
|
+
|
50
|
+
2010-05-21 wycats <wycats@gmail.com>
|
51
|
+
|
52
|
+
* lib/yard/code_objects/base.rb, lib/yard/code_objects/class_object.rb,
|
53
|
+
lib/yard/code_objects/proxy.rb, spec/code_objects/class_object_spec.rb: Fixes
|
54
|
+
an issue where mixins could appear twice in the class hierarchy
|
55
|
+
|
56
|
+
2010-05-15 postmodern <postmodern.mod3@gmail.com>
|
57
|
+
|
58
|
+
* lib/yard.rb: Only glob .rb files from yard/core_ext and do not strip the
|
59
|
+
.rb file extension. * By globbing all files within yard/core_ext, this was
|
60
|
+
triggering a bug on Rubinius 1.0. Rubinius likes to store compiled Ruby files
|
61
|
+
(.rbc) along with the Ruby source files (.rb).
|
62
|
+
http://github.com/evanphx/rubinius/issues/#issue/305
|
63
|
+
|
64
|
+
2010-05-15 Loren Segal <lsegal@soen.ca>
|
65
|
+
|
66
|
+
* .../ruby/legacy/class_condition_handler.rb,
|
67
|
+
spec/handlers/class_condition_handler_spec.rb: Implement
|
68
|
+
ClassConditionHandler for legacy parser. Closes gh-114
|
69
|
+
|
70
|
+
* lib/yard/parser/ruby/legacy/statement_list.rb,
|
71
|
+
spec/parser/ruby/legacy/statement_list_spec.rb: Fill .block for 'else' and
|
72
|
+
'elsif' statements in legacy parser.
|
73
|
+
|
74
|
+
2010-05-04 Denis Defreyne <denis.defreyne@stoneship.org>
|
75
|
+
|
76
|
+
* templates/default/docstring/html/private.erb,
|
77
|
+
templates/default/docstring/setup.rb,
|
78
|
+
templates/default/docstring/text/private.erb,
|
79
|
+
templates/default/fulldoc/html/css/style.css,
|
80
|
+
templates/default/module/html/header.erb,
|
81
|
+
templates/default/module/html/item_summary.erb: Show notification for "@api
|
82
|
+
private" usage in HTML/text templates. Closes gh-123
|
83
|
+
|
84
|
+
2010-04-21 Loren Segal <lsegal@soen.ca>
|
85
|
+
|
86
|
+
* LEGAL: Update LEGAL
|
87
|
+
|
88
|
+
* .yardopts, LEGAL, LICENSE, README.md, yard.gemspec: Add Ruby/RDoc license
|
89
|
+
information to YARD and update copyright years. Closes gh-122
|
90
|
+
|
91
|
+
2010-04-20 Nathan Weizenbaum <nex342@gmail.com>
|
92
|
+
|
93
|
+
* lib/yard/cli/yard_graph.rb, lib/yard/cli/yardoc.rb,
|
94
|
+
lib/yard/templates/helpers/module_helper.rb, spec/templates/module_spec.rb:
|
95
|
+
Replace the :visibilities option with compilation to a query. This allows
|
96
|
+
the visibility flags to be used with --list.
|
97
|
+
|
98
|
+
* lib/yard/cli/yardoc.rb, spec/cli/yardoc_spec.rb: Parse yardopts and manual
|
99
|
+
args at the same time. This means that e.g. --query arguments are merged,
|
100
|
+
rather than clobbered.
|
101
|
+
|
102
|
+
2010-04-19 Nathan Weizenbaum <nex342@gmail.com>
|
103
|
+
|
104
|
+
* lib/yard/cli/yardoc.rb: Add a --list option for listing all objects
|
105
|
+
matching the query.
|
106
|
+
|
107
|
+
2010-04-20 Nathan Weizenbaum <nex342@gmail.com>
|
108
|
+
|
109
|
+
* lib/yard/templates/helpers/method_helper.rb: Don't assume that method
|
110
|
+
parameter names will be strings. In the case of some overloads with default
|
111
|
+
values, at least, they'll be symbols.
|
112
|
+
|
113
|
+
2010-04-19 Nathan Weizenbaum <nex342@gmail.com>
|
114
|
+
|
115
|
+
* lib/yard/handlers/ruby/constant_handler.rb,
|
116
|
+
lib/yard/handlers/ruby/legacy/constant_handler.rb: Register MethodObjects
|
117
|
+
defined for structs. Otherwise, they don't get their file/line number set.
|
118
|
+
|
119
|
+
2010-04-01 Loren Segal <lsegal@soen.ca>
|
120
|
+
|
121
|
+
* spec/templates/examples/class001.html,
|
122
|
+
spec/templates/examples/method001.html,
|
123
|
+
spec/templates/examples/module001.html,
|
124
|
+
templates/default/docstring/html/abstract.erb,
|
125
|
+
templates/default/docstring/html/deprecated.erb,
|
126
|
+
templates/default/docstring/html/note.erb,
|
127
|
+
templates/default/docstring/html/todo.erb,
|
128
|
+
templates/default/fulldoc/html/css/style.css: Fix templates to not wrap
|
129
|
+
htmlify_line inside a <p> tag, since it itself is a <div>
|
130
|
+
|
131
|
+
2010-03-27 Loren Segal <lsegal@soen.ca>
|
132
|
+
|
133
|
+
* spec/templates/examples/class001.html,
|
134
|
+
spec/templates/examples/module001.html: Fix specs for summary toggle button
|
135
|
+
|
136
|
+
* templates/default/fulldoc/html/css/style.css,
|
137
|
+
templates/default/fulldoc/html/js/app.js,
|
138
|
+
.../default/module/html/attribute_summary.erb,
|
139
|
+
templates/default/module/html/method_summary.erb: Add method/attribute
|
140
|
+
summary collapse/expand
|
141
|
+
|
142
|
+
2010-03-24 Loren Segal <lsegal@soen.ca>
|
143
|
+
|
144
|
+
* templates/default/fulldoc/html/js/app.js: Don't enable keyboard shortcuts
|
145
|
+
in frames mode.
|
146
|
+
|
147
|
+
* templates/default/fulldoc/html/css/style.css: Move shadow over so it does
|
148
|
+
not force horizontal scrollbars to appear.
|
149
|
+
|
150
|
+
* templates/default/fulldoc/html/js/app.js: Ignore shortcut keypresses inside
|
151
|
+
form input fields
|
152
|
+
|
153
|
+
* templates/default/fulldoc/html/setup.rb: Make sure there are no nil
|
154
|
+
children
|
155
|
+
|
1
156
|
2010-03-22 Loren Segal <lsegal@soen.ca>
|
2
157
|
|
3
158
|
* ChangeLog, README.md, docs/WhatsNew.md, lib/yard.rb, yard.gemspec: Bump
|
@@ -224,6 +379,32 @@
|
|
224
379
|
* lib/yard/templates/helpers/html_helper.rb: HTML-escape text that isn't
|
225
380
|
syntax highlighted due to --no-highlight.
|
226
381
|
|
382
|
+
2010-01-24 Nathan Weizenbaum <nex342@gmail.com>
|
383
|
+
|
384
|
+
* lib/yard/templates/template.rb: When dealing with many overloaded
|
385
|
+
templates, include them in reverse order. This is necessary due to the way
|
386
|
+
Ruby's module inclusion works with inheritance. Including a module puts it
|
387
|
+
at the base of the inheritance chain. For example, if a class hierarchy
|
388
|
+
looks like A->B->C, and C includes D, then it looks like A->B->D->C. This
|
389
|
+
means that the base template, which is last in the full_paths list, should
|
390
|
+
actually be included first, so that it ends up farthest back in the
|
391
|
+
inheritance chain.
|
392
|
+
|
393
|
+
2010-01-21 Nathan Weizenbaum <nex342@gmail.com>
|
394
|
+
|
395
|
+
* lib/yard/templates/helpers/html_helper.rb: Allow a broader variety of names
|
396
|
+
for syntax highlighting. This is necessary to support some names for
|
397
|
+
Pygments.
|
398
|
+
|
399
|
+
2010-01-17 Nathan Weizenbaum <nex342@gmail.com>
|
400
|
+
|
401
|
+
* lib/yard/templates/helpers/html_helper.rb: HTML-escape text that isn't
|
402
|
+
syntax highlighted due to --no-highlight.
|
403
|
+
|
404
|
+
* lib/yard/autoload.rb, lib/yard/templates/erb_cache.rb,
|
405
|
+
lib/yard/templates/template.rb, spec/templates/template_spec.rb: Cache the
|
406
|
+
compiled ERB methods to speed up rendering time.
|
407
|
+
|
227
408
|
2010-01-11 Loren Segal <lsegal@soen.ca>
|
228
409
|
|
229
410
|
* README.md: Fix links in README
|
data/LEGAL
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
LEGAL NOTICE INFORMATION
|
2
|
+
------------------------
|
3
|
+
|
4
|
+
All the files in this distribution are covered under either the MIT
|
5
|
+
license (see the file LICENSE) except some files mentioned below.
|
6
|
+
|
7
|
+
lib/parser/c_parser.rb:
|
8
|
+
|
9
|
+
This file includes code from the RDoc distribution. It is under the Ruby
|
10
|
+
license but adds the following copyright:
|
11
|
+
|
12
|
+
RDoc is copyrighted free software by Dave Thomas, Eric Hodel, and others.
|
13
|
+
It is licensed under the same terms as Ruby
|
14
|
+
|
15
|
+
lib/parser/ruby/legacy/ruby_lex.rb:
|
16
|
+
|
17
|
+
This file is under the Ruby license. YARD uses a modified version of it.
|
18
|
+
|
19
|
+
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
|
20
|
+
You can redistribute it and/or modify it under either the terms of the GPL
|
21
|
+
version 2 (see the file GPL), or the conditions below:
|
22
|
+
|
23
|
+
1. You may make and give away verbatim copies of the source form of the
|
24
|
+
software without restriction, provided that you duplicate all of the
|
25
|
+
original copyright notices and associated disclaimers.
|
26
|
+
|
27
|
+
2. You may modify your copy of the software in any way, provided that
|
28
|
+
you do at least ONE of the following:
|
29
|
+
|
30
|
+
a) place your modifications in the Public Domain or otherwise
|
31
|
+
make them Freely Available, such as by posting said
|
32
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
33
|
+
the author to include your modifications in the software.
|
34
|
+
|
35
|
+
b) use the modified software only within your corporation or
|
36
|
+
organization.
|
37
|
+
|
38
|
+
c) give non-standard binaries non-standard names, with
|
39
|
+
instructions on where to get the original software distribution.
|
40
|
+
|
41
|
+
d) make other distribution arrangements with the author.
|
42
|
+
|
43
|
+
3. You may distribute the software in object code or binary form,
|
44
|
+
provided that you do at least ONE of the following:
|
45
|
+
|
46
|
+
a) distribute the binaries and library files of the software,
|
47
|
+
together with instructions (in the manual page or equivalent)
|
48
|
+
on where to get the original distribution.
|
49
|
+
|
50
|
+
b) accompany the distribution with the machine-readable source of
|
51
|
+
the software.
|
52
|
+
|
53
|
+
c) give non-standard binaries non-standard names, with
|
54
|
+
instructions on where to get the original software distribution.
|
55
|
+
|
56
|
+
d) make other distribution arrangements with the author.
|
57
|
+
|
58
|
+
4. You may modify and include the part of the software into any other
|
59
|
+
software (possibly commercial). But some files in the distribution
|
60
|
+
are not written by the author, so that they are not under these terms.
|
61
|
+
|
62
|
+
For the list of those files and their copying conditions, see the
|
63
|
+
file LEGAL.
|
64
|
+
|
65
|
+
5. The scripts and library files supplied as input to or produced as
|
66
|
+
output from the software do not automatically fall under the
|
67
|
+
copyright of the software, but belong to whomever generated them,
|
68
|
+
and may be sold commercially, and may be aggregated with this
|
69
|
+
software.
|
70
|
+
|
71
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
72
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
73
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
74
|
+
PURPOSE.
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
YARD Release 0.5.4 "The Longest" (Mar 22nd 2010)
|
2
2
|
================================================
|
3
3
|
|
4
|
-
**Homepage**:
|
5
|
-
**IRC**:
|
6
|
-
**Git**:
|
7
|
-
**Author**:
|
8
|
-
**
|
9
|
-
|
4
|
+
**Homepage**: [http://yardoc.org](http://yardoc.org)
|
5
|
+
**IRC**: **Join us on IRC in #yard on irc.freenode.net!**
|
6
|
+
**Git**: [http://github.com/lsegal/yard](http://github.com/lsegal/yard)
|
7
|
+
**Author**: Loren Segal
|
8
|
+
**Contributors**: Nathan Weizenbaum, Yehuda Katz, Denis Defreyne, Postmodern,
|
9
|
+
Michael Edgar
|
10
|
+
**Copyright**: 2007-2010
|
11
|
+
**License**: MIT License
|
10
12
|
|
11
13
|
|
12
14
|
SYNOPSIS
|
@@ -222,6 +224,9 @@ More options can be seen by typing `yard-graph --help`, but here is an example:
|
|
222
224
|
CHANGELOG
|
223
225
|
---------
|
224
226
|
|
227
|
+
- **May.22.10**: 0.5.5 release
|
228
|
+
- Various bug fixes
|
229
|
+
|
225
230
|
- **March.22.10**: 0.5.4 release
|
226
231
|
- See {file:docs/WhatsNew.md what's new document} for changes
|
227
232
|
|
@@ -291,5 +296,7 @@ CHANGELOG
|
|
291
296
|
COPYRIGHT
|
292
297
|
---------
|
293
298
|
|
294
|
-
YARD © 2007-
|
295
|
-
|
299
|
+
YARD © 2007-2010 by [Loren Segal](mailto:lsegal@soen.ca). YARD is
|
300
|
+
licensed under the MIT license except for some files which come from the
|
301
|
+
RDoc/Ruby distributions. Please see the {file:LICENSE} and {file:LEGAL}
|
302
|
+
documents for more information.
|
data/lib/yard.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module YARD
|
2
|
-
VERSION = "0.5.
|
2
|
+
VERSION = "0.5.5"
|
3
3
|
ROOT = File.expand_path(File.dirname(__FILE__))
|
4
4
|
TEMPLATE_ROOT = File.join(ROOT, '..', 'templates')
|
5
5
|
CONFIG_DIR = File.expand_path('~/.yard')
|
@@ -52,8 +52,8 @@ $LOAD_PATH.push('.') if RUBY_VERSION >= '1.9.2'
|
|
52
52
|
RUBY19, RUBY18 = *(RUBY_VERSION >= "1.9.1" ? [true, false] : [false, true])
|
53
53
|
|
54
54
|
# Load Ruby core extension classes
|
55
|
-
Dir.glob(File.join(YARD::ROOT, 'yard', 'core_ext', '
|
56
|
-
require file
|
55
|
+
Dir.glob(File.join(YARD::ROOT, 'yard', 'core_ext', '*.rb')).each do |file|
|
56
|
+
require file
|
57
57
|
end
|
58
58
|
|
59
59
|
['autoload', 'globals'].each do |file|
|
data/lib/yard/cli/yard_graph.rb
CHANGED
@@ -22,10 +22,7 @@ module YARD
|
|
22
22
|
def initialize
|
23
23
|
super
|
24
24
|
@serializer = YARD::Serializers::StdoutSerializer.new
|
25
|
-
@options = SymbolHash[
|
26
|
-
:format => :dot,
|
27
|
-
:visibilities => [:public]
|
28
|
-
]
|
25
|
+
@options = SymbolHash[:format => :dot]
|
29
26
|
end
|
30
27
|
|
31
28
|
# Runs the command-line utility.
|
@@ -39,8 +36,9 @@ module YARD
|
|
39
36
|
optparse(*args)
|
40
37
|
|
41
38
|
contents = objects.map {|o| o.format(options) }.join("\n")
|
42
|
-
Templates::Engine.render(:format => :dot, :type => :layout,
|
43
|
-
:
|
39
|
+
Templates::Engine.render(:format => :dot, :type => :layout,
|
40
|
+
:verifier => @verifier, :serializer => @serializer,
|
41
|
+
:contents => contents)
|
44
42
|
end
|
45
43
|
|
46
44
|
private
|
@@ -48,6 +46,7 @@ module YARD
|
|
48
46
|
# Parses commandline options.
|
49
47
|
# @param [Array<String>] args each tokenized argument
|
50
48
|
def optparse(*args)
|
49
|
+
visibilities = []
|
51
50
|
opts = OptionParser.new
|
52
51
|
|
53
52
|
opts.separator ""
|
@@ -66,15 +65,15 @@ module YARD
|
|
66
65
|
end
|
67
66
|
|
68
67
|
opts.on('--no-public', "Don't show public methods. (default shows public)") do
|
69
|
-
|
68
|
+
visibilities.delete(:public)
|
70
69
|
end
|
71
70
|
|
72
71
|
opts.on('--protected', "Show or don't show protected methods. (default hides protected)") do
|
73
|
-
|
72
|
+
visibilities.push(:protected)
|
74
73
|
end
|
75
74
|
|
76
75
|
opts.on('--private', "Show or don't show private methods. (default hides private)") do
|
77
|
-
|
76
|
+
visibilities.push(:private)
|
78
77
|
end
|
79
78
|
|
80
79
|
opts.separator ""
|
@@ -92,6 +91,7 @@ module YARD
|
|
92
91
|
common_options(opts)
|
93
92
|
parse_options(opts, args)
|
94
93
|
|
94
|
+
@verifier = Verfier.new("object.type != :method || #{visibilities.uniq.inspect}.include?(object.visibility)")
|
95
95
|
if args.first
|
96
96
|
@objects = args.map {|o| Registry.at(o) }.compact
|
97
97
|
else
|
@@ -100,4 +100,4 @@ module YARD
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
end
|
103
|
-
end
|
103
|
+
end
|
data/lib/yard/cli/yardoc.rb
CHANGED
@@ -28,7 +28,10 @@ module YARD
|
|
28
28
|
|
29
29
|
# @return [Boolean] whether to generate output
|
30
30
|
attr_accessor :generate
|
31
|
-
|
31
|
+
|
32
|
+
# @return [Boolean] whether to print a list of objects
|
33
|
+
attr_accessor :list
|
34
|
+
|
32
35
|
# The options file name (defaults to {DEFAULT_YARDOPTS_FILE})
|
33
36
|
# @return [String] the filename to load extra options from
|
34
37
|
attr_accessor :options_file
|
@@ -50,7 +53,6 @@ module YARD
|
|
50
53
|
:hide_void_return => false,
|
51
54
|
:no_highlight => false,
|
52
55
|
:files => [],
|
53
|
-
:visibilities => [:public],
|
54
56
|
:verifier => nil
|
55
57
|
)
|
56
58
|
@excluded = []
|
@@ -68,8 +70,7 @@ module YARD
|
|
68
70
|
# @return [void]
|
69
71
|
def run(*args)
|
70
72
|
args += support_rdoc_document_file!
|
71
|
-
optparse(*yardopts)
|
72
|
-
optparse(*args)
|
73
|
+
optparse(*(yardopts + args))
|
73
74
|
|
74
75
|
if use_cache
|
75
76
|
Registry.load
|
@@ -85,6 +86,8 @@ module YARD
|
|
85
86
|
Registry.load_all if use_cache
|
86
87
|
Templates::Engine.generate(all_objects, options)
|
87
88
|
end
|
89
|
+
elsif list
|
90
|
+
print_list
|
88
91
|
end
|
89
92
|
|
90
93
|
true
|
@@ -125,6 +128,17 @@ module YARD
|
|
125
128
|
end
|
126
129
|
end
|
127
130
|
|
131
|
+
# Prints a list of all objects
|
132
|
+
# @return [void]
|
133
|
+
def print_list
|
134
|
+
Registry.load_all
|
135
|
+
Registry.all.
|
136
|
+
reject {|item| options[:verifier].call(item).is_a?(FalseClass) }.
|
137
|
+
sort_by {|item| [item.file, item.line]}.each do |item|
|
138
|
+
puts "#{item.file}:#{item.line}: #{item}"
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
128
142
|
# Reads a .document file in the directory to get source file globs
|
129
143
|
# @return [void]
|
130
144
|
def support_rdoc_document_file!
|
@@ -197,6 +211,7 @@ module YARD
|
|
197
211
|
def optparse(*args)
|
198
212
|
excluded = []
|
199
213
|
query_expressions = []
|
214
|
+
visibilities = [:public]
|
200
215
|
do_build_gems, do_rebuild_gems = false, false
|
201
216
|
serialopts = SymbolHash.new
|
202
217
|
|
@@ -264,15 +279,15 @@ module YARD
|
|
264
279
|
opts.separator "Output options:"
|
265
280
|
|
266
281
|
opts.on('--no-public', "Don't show public methods. (default shows public)") do
|
267
|
-
|
282
|
+
visibilities.delete(:public)
|
268
283
|
end
|
269
284
|
|
270
285
|
opts.on('--protected', "Show or don't show protected methods. (default hides protected)") do
|
271
|
-
|
286
|
+
visibilities.push(:protected)
|
272
287
|
end
|
273
288
|
|
274
289
|
opts.on('--private', "Show or don't show private methods. (default hides private)") do
|
275
|
-
|
290
|
+
visibilities.push(:private)
|
276
291
|
end
|
277
292
|
|
278
293
|
opts.on('--no-private', "Hide objects with @private tag") do
|
@@ -294,7 +309,12 @@ module YARD
|
|
294
309
|
opts.on('--query QUERY', "Only show objects that match a specific query") do |query|
|
295
310
|
query_expressions << query.taint
|
296
311
|
end
|
297
|
-
|
312
|
+
|
313
|
+
opts.on('--list', 'List objects to standard out (implies -n)') do |format|
|
314
|
+
self.generate = false
|
315
|
+
self.list = true
|
316
|
+
end
|
317
|
+
|
298
318
|
opts.on('--title TITLE', 'Add a specific title to HTML documents') do |title|
|
299
319
|
options[:title] = title
|
300
320
|
end
|
@@ -354,8 +374,8 @@ module YARD
|
|
354
374
|
build_gems(do_rebuild_gems) if do_build_gems
|
355
375
|
parse_files(*args) unless args.empty?
|
356
376
|
self.files = ['lib/**/*.rb', 'ext/**/*.c'] if self.files.empty?
|
377
|
+
query_expressions << "object.type != :method || #{visibilities.uniq.inspect}.include?(object.visibility)"
|
357
378
|
options[:verifier] = Verifier.new(*query_expressions) unless query_expressions.empty?
|
358
|
-
options[:visibilities].uniq!
|
359
379
|
options[:serializer] ||= Serializers::FileSystemSerializer.new(serialopts)
|
360
380
|
options[:readme] ||= Dir.glob('README*').first
|
361
381
|
end
|