yard 0.6.3 → 0.6.4
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/ChangeLog +119 -0
- data/README.md +16 -2
- data/Rakefile +29 -10
- data/docs/GettingStarted.md +186 -35
- data/lib/yard.rb +1 -1
- data/lib/yard/autoload.rb +10 -0
- data/lib/yard/cli/yri.rb +2 -2
- data/lib/yard/code_objects/base.rb +1 -1
- data/lib/yard/code_objects/method_object.rb +2 -1
- data/lib/yard/code_objects/root_object.rb +2 -2
- data/lib/yard/parser/ruby/ast_node.rb +0 -4
- data/lib/yard/parser/ruby/ruby_parser.rb +30 -1
- data/lib/yard/server/adapter.rb +50 -1
- data/lib/yard/server/commands/base.rb +117 -23
- data/lib/yard/server/commands/display_file_command.rb +3 -0
- data/lib/yard/server/commands/display_object_command.rb +1 -0
- data/lib/yard/server/commands/frames_command.rb +1 -0
- data/lib/yard/server/commands/library_command.rb +8 -1
- data/lib/yard/server/commands/list_command.rb +4 -0
- data/lib/yard/server/doc_server_helper.rb +15 -0
- data/lib/yard/server/doc_server_serializer.rb +2 -0
- data/lib/yard/server/library_version.rb +141 -0
- data/lib/yard/server/rack_adapter.rb +35 -2
- data/lib/yard/server/router.rb +71 -1
- data/lib/yard/server/static_caching.rb +29 -0
- data/lib/yard/server/webrick_adapter.rb +4 -0
- data/lib/yard/templates/engine.rb +1 -1
- data/lib/yard/templates/helpers/markup_helper.rb +22 -7
- data/spec/cli/diff_spec.rb +2 -2
- data/spec/cli/stats_spec.rb +1 -1
- data/spec/cli/yardoc_spec.rb +1 -1
- data/spec/cli/yri_spec.rb +21 -0
- data/spec/handlers/class_handler_spec.rb +1 -0
- data/spec/handlers/examples/class_handler_001.rb.txt +1 -0
- data/spec/parser/ruby/legacy/statement_list_spec.rb +6 -0
- data/spec/parser/ruby/ruby_parser_spec.rb +29 -0
- data/spec/server/rack_adapter_spec.rb +18 -0
- data/spec/spec_helper.rb +6 -2
- data/spec/templates/engine_spec.rb +4 -1
- data/spec/templates/helpers/html_helper_spec.rb +11 -0
- data/spec/templates/helpers/markup_helper_spec.rb +9 -5
- data/spec/templates/module_spec.rb +1 -1
- data/spec/templates/spec_helper.rb +3 -3
- data/templates/default/fulldoc/html/css/style.css +1 -1
- data/templates/default/fulldoc/html/js/app.js +3 -2
- metadata +7 -15
data/ChangeLog
CHANGED
@@ -1,3 +1,109 @@
|
|
1
|
+
2010-12-21 Loren Segal <lsegal@soen.ca>
|
2
|
+
|
3
|
+
* ChangeLog, README.md, lib/yard.rb, yard.gemspec: Bump to version 0.6.4
|
4
|
+
|
5
|
+
* spec/server/rack_adapter_spec.rb: Fix RackMiddleware tests for 1.8.x
|
6
|
+
|
7
|
+
* lib/yard/server/commands/base.rb,
|
8
|
+
lib/yard/server/commands/library_command.rb: Move #render back to
|
9
|
+
Commands::Base, since another class depends on it
|
10
|
+
|
11
|
+
* lib/yard/autoload.rb, lib/yard/server/adapter.rb,
|
12
|
+
lib/yard/server/commands/base.rb,
|
13
|
+
lib/yard/server/commands/display_file_command.rb,
|
14
|
+
lib/yard/server/commands/display_object_command.rb,
|
15
|
+
lib/yard/server/commands/frames_command.rb,
|
16
|
+
lib/yard/server/commands/library_command.rb,
|
17
|
+
lib/yard/server/commands/list_command.rb,
|
18
|
+
lib/yard/server/doc_server_helper.rb,
|
19
|
+
lib/yard/server/doc_server_serializer.rb, lib/yard/server/library_version.rb,
|
20
|
+
lib/yard/server/rack_adapter.rb, lib/yard/server/router.rb,
|
21
|
+
lib/yard/server/static_caching.rb, lib/yard/server/webrick_adapter.rb: Beef
|
22
|
+
up YARD::Server* documentation
|
23
|
+
|
24
|
+
2010-12-20 Loren Segal <lsegal@soen.ca>
|
25
|
+
|
26
|
+
* docs/GettingStarted.md: Extra information about type specifications, fix
|
27
|
+
tools section
|
28
|
+
|
29
|
+
* docs/GettingStarted.md: Improve getting started documentation, add more
|
30
|
+
syntax documentation
|
31
|
+
|
32
|
+
* lib/yard/code_objects/base.rb, lib/yard/code_objects/method_object.rb,
|
33
|
+
lib/yard/code_objects/root_object.rb: Cache CodeObjects::Base#path to
|
34
|
+
significantly improve performance
|
35
|
+
|
36
|
+
* lib/yard/templates/engine.rb: Fix broken documentation reference
|
37
|
+
|
38
|
+
2010-12-19 Loren Segal <lsegal@soen.ca>
|
39
|
+
|
40
|
+
* lib/yard/parser/ruby/ruby_parser.rb,
|
41
|
+
spec/parser/ruby/legacy/statement_list_spec.rb,
|
42
|
+
spec/parser/ruby/ruby_parser_spec.rb: Fix ordering of heredoc tokens Closes
|
43
|
+
gh-209
|
44
|
+
|
45
|
+
* lib/yard/parser/ruby/ruby_parser.rb, spec/parser/ruby/ruby_parser_spec.rb:
|
46
|
+
Fix listing of heredoc source in 1.9.x
|
47
|
+
|
48
|
+
* lib/yard/parser/ruby/ast_node.rb, lib/yard/parser/ruby/ruby_parser.rb,
|
49
|
+
spec/handlers/class_handler_spec.rb,
|
50
|
+
spec/handlers/examples/class_handler_001.rb.txt,
|
51
|
+
spec/parser/ruby/ruby_parser_spec.rb: Fix Derived < ::Base inheriting wrong
|
52
|
+
Base (not top level) Closes gh-216
|
53
|
+
|
54
|
+
2010-12-17 Loren Segal <lsegal@soen.ca>
|
55
|
+
|
56
|
+
* Rakefile, spec/spec_helper.rb, spec/templates/helpers/html_helper_spec.rb,
|
57
|
+
spec/templates/module_spec.rb: Make rakefile backwards compatible for rspec
|
58
|
+
1.x users
|
59
|
+
|
60
|
+
* Rakefile, spec/cli/diff_spec.rb, spec/cli/stats_spec.rb,
|
61
|
+
spec/cli/yardoc_spec.rb, spec/templates/engine_spec.rb: Add compatibility
|
62
|
+
with rspec2
|
63
|
+
|
64
|
+
2010-12-15 Loren Segal <lsegal@soen.ca>
|
65
|
+
|
66
|
+
* spec/templates/spec_helper.rb: Can't use example() with rspec2
|
67
|
+
|
68
|
+
2010-12-12 Gioele Barabucci <gioele@svario.it>
|
69
|
+
|
70
|
+
* Rakefile, spec/spec_helper.rb: Minimal update to RSpec 2
|
71
|
+
|
72
|
+
2010-12-15 Loren Segal <lsegal@soen.ca>
|
73
|
+
|
74
|
+
* spec/cli/yri_spec.rb: Add sanity check tests to YRI specs
|
75
|
+
|
76
|
+
2010-12-15 Lee Jarvis <lee@jarvis.co>
|
77
|
+
|
78
|
+
* lib/yard/cli/yri.rb: prepend :: to adhere to rubys class lookup rules for
|
79
|
+
Config::CONFIG
|
80
|
+
|
81
|
+
2010-11-24 Loren Segal <lsegal@soen.ca>
|
82
|
+
|
83
|
+
* lib/yard/templates/helpers/markup_helper.rb,
|
84
|
+
spec/templates/helpers/markup_helper_spec.rb: Fix automatic loading of markup
|
85
|
+
providers by properly caching provider information. Closes gh-206
|
86
|
+
|
87
|
+
* lib/yard/templates/helpers/markup_helper.rb,
|
88
|
+
spec/templates/helpers/markup_helper_spec.rb: Initial fix for automatic
|
89
|
+
markup provider searching
|
90
|
+
|
91
|
+
2010-11-21 Loren Segal <lsegal@soen.ca>
|
92
|
+
|
93
|
+
* lib/yard/server/rack_adapter.rb, spec/server/rack_adapter_spec.rb:
|
94
|
+
RackMiddleware should now pass 404 responses up to the next middleware in the
|
95
|
+
stack
|
96
|
+
|
97
|
+
2010-11-21 srawlins <sam.rawlins@gmail.com>
|
98
|
+
|
99
|
+
* templates/default/fulldoc/html/css/style.css: Typos. Tested. Now this patch
|
100
|
+
looks goooood.
|
101
|
+
|
102
|
+
* spec/parser/c_parser_spec.rb: Fixed newline
|
103
|
+
|
104
|
+
* templates/default/fulldoc/html/css/style.css: Fixed wrapping in Firefox,
|
105
|
+
clipping in Chrome
|
106
|
+
|
1
107
|
2010-11-21 Loren Segal <lsegal@soen.ca>
|
2
108
|
|
3
109
|
* ChangeLog, README.md, lib/yard.rb, yard.gemspec: Bump to version 0.6.3
|
@@ -6,6 +112,13 @@
|
|
6
112
|
spec/templates/helpers/markup_helper_spec.rb: Fix regression where markup
|
7
113
|
loading fails when generating HTML
|
8
114
|
|
115
|
+
2010-11-17 Franklin Webber <franklin.webber@gmail.com>
|
116
|
+
|
117
|
+
* templates/default/fulldoc/html/js/app.js: Minor Javascript Fix - Keyboard
|
118
|
+
Shortcuts List link shortcuts checked to see if the original Target of the
|
119
|
+
event was a INPUT or TEXTARA. However, if the orignal Target was undefined
|
120
|
+
an error was raised. Checking for undefined.
|
121
|
+
|
9
122
|
2010-11-15 Loren Segal <lsegal@soen.ca>
|
10
123
|
|
11
124
|
* ChangeLog, README.md, lib/yard.rb, yard.gemspec: Bump to version 0.6.2
|
@@ -266,6 +379,12 @@
|
|
266
379
|
* lib/yard/cli/gems.rb: Replace #each_slice with 1.8.6 compatible iteration.
|
267
380
|
Closes gh-178
|
268
381
|
|
382
|
+
2010-09-27 srawlins <sam.rawlins@gmail.com>
|
383
|
+
|
384
|
+
* lib/yard/parser/c_parser.rb, spec/parser/c_parser_spec.rb,
|
385
|
+
spec/parser/examples/override.c.txt: Added
|
386
|
+
Parser::CParser#find_override_comment, almost straight from RDoc
|
387
|
+
|
269
388
|
2010-09-25 Loren Segal <lsegal@soen.ca>
|
270
389
|
|
271
390
|
* .../ruby/legacy/class_condition_handler.rb,
|
data/README.md
CHANGED
@@ -8,8 +8,8 @@ YARD: Yay! A Ruby Documentation Tool
|
|
8
8
|
**Contributors**: See Contributors section below
|
9
9
|
**Copyright**: 2007-2010
|
10
10
|
**License**: MIT License
|
11
|
-
**Latest Version**: 0.6.
|
12
|
-
**Release Date**:
|
11
|
+
**Latest Version**: 0.6.4 (codename "Snowy White Picket Fences")
|
12
|
+
**Release Date**: December 21st 2010
|
13
13
|
|
14
14
|
Synopsis
|
15
15
|
--------
|
@@ -289,6 +289,17 @@ More options can be seen by typing `yard-graph --help`, but here is an example:
|
|
289
289
|
Changelog
|
290
290
|
---------
|
291
291
|
|
292
|
+
- **December.21.10**: 0.6.4 release
|
293
|
+
- Fix yri tool crashing with new Config class (gh-217)
|
294
|
+
- Fix support for ::TopLevelConstants (gh-216)
|
295
|
+
- YARD's test suite is now RSpec2 compatible (gh-215)
|
296
|
+
- Improved documentation for YARD::Server features (gh-207)
|
297
|
+
- Fix displaying of collaped method summary lists (gh-204)
|
298
|
+
- Fix automatic loading of markup providers (gh-206)
|
299
|
+
- Fix keyboard shortcuts for Chrome (gh-203)
|
300
|
+
- Disallow `extend self` inside of a class (gh-202)
|
301
|
+
- Constants now recognized in C extensions (gh-201)
|
302
|
+
|
292
303
|
- **November.21.10**: 0.6.3 release
|
293
304
|
- Fixed regression that caused `yardoc --markup` to silently exit
|
294
305
|
|
@@ -428,6 +439,8 @@ Special thanks to the following people for submitting patches:
|
|
428
439
|
* Arthur Schreiber
|
429
440
|
* Robert Wahler
|
430
441
|
* Mark Evans
|
442
|
+
* Lee Jarvis
|
443
|
+
* Franklin Webber
|
431
444
|
* David Turnbull
|
432
445
|
* Anthony Thibault
|
433
446
|
* Sam Rawlins
|
@@ -435,6 +448,7 @@ Special thanks to the following people for submitting patches:
|
|
435
448
|
* Elliottcable
|
436
449
|
* James Rosen
|
437
450
|
* Jake Kerr
|
451
|
+
* Gioele Barabucci
|
438
452
|
* Gabriel Horner
|
439
453
|
* Denis Defreyne
|
440
454
|
* Benjamin Bock
|
data/Rakefile
CHANGED
@@ -19,27 +19,46 @@ task :install => :gem do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
begin
|
22
|
-
|
23
|
-
|
22
|
+
hide = '_spec\.rb$,spec_helper\.rb$,ruby_lex\.rb$,autoload\.rb$'
|
23
|
+
hide += ',legacy\/.+_handler,html_syntax_highlight_helper18\.rb$' if RUBY19
|
24
|
+
hide += ',ruby_parser\.rb$,ast_node\.rb$,handlers\/ruby\/[^\/]+\.rb$,html_syntax_highlight_helper\.rb$' if RUBY18
|
25
|
+
|
26
|
+
require 'rspec'
|
27
|
+
require 'rspec/core/rake_task'
|
24
28
|
|
25
29
|
desc "Run all specs"
|
26
|
-
|
30
|
+
RSpec::Core::RakeTask.new("specs") do |t|
|
27
31
|
$DEBUG = true if ENV['DEBUG']
|
28
|
-
t.
|
29
|
-
t.
|
30
|
-
t.
|
32
|
+
t.rspec_opts = ["--colour", "--format", "documentation"]
|
33
|
+
t.rspec_opts += ["--require", File.join(File.dirname(__FILE__), 'spec', 'spec_helper')]
|
34
|
+
t.pattern = "spec/**/*_spec.rb"
|
31
35
|
|
32
36
|
if ENV['RCOV']
|
33
|
-
hide = '_spec\.rb$,spec_helper\.rb$,ruby_lex\.rb$,autoload\.rb$'
|
34
|
-
hide += ',legacy\/.+_handler,html_syntax_highlight_helper18\.rb$' if RUBY19
|
35
|
-
hide += ',ruby_parser\.rb$,ast_node\.rb$,handlers\/ruby\/[^\/]+\.rb$,html_syntax_highlight_helper\.rb$' if RUBY18
|
36
37
|
t.rcov = true
|
37
38
|
t.rcov_opts = ['-x', hide]
|
38
39
|
end
|
39
40
|
end
|
40
41
|
task :spec => :specs
|
41
42
|
rescue LoadError
|
42
|
-
|
43
|
+
begin # Try for rspec 1.x
|
44
|
+
require 'spec'
|
45
|
+
require 'spec/rake/spectask'
|
46
|
+
|
47
|
+
Spec::Rake::SpecTask.new("specs") do |t|
|
48
|
+
$DEBUG = true if ENV['DEBUG']
|
49
|
+
t.spec_opts = ["--format", "specdoc", "--colour"]
|
50
|
+
t.spec_opts += ["--require", File.join(File.dirname(__FILE__), 'spec', 'spec_helper')]
|
51
|
+
t.pattern = "spec/**/*_spec.rb"
|
52
|
+
|
53
|
+
if ENV['RCOV']
|
54
|
+
t.rcov = true
|
55
|
+
t.rcov_opts = ['-x', hide]
|
56
|
+
end
|
57
|
+
end
|
58
|
+
task :spec => :specs
|
59
|
+
rescue LoadError
|
60
|
+
warn "warn: RSpec tests not available. `gem install rspec` to enable them."
|
61
|
+
end
|
43
62
|
end
|
44
63
|
|
45
64
|
YARD::Rake::YardocTask.new do |t|
|
data/docs/GettingStarted.md
CHANGED
@@ -60,6 +60,17 @@ Using tags we can add semantic metadata to our code without worrying about
|
|
60
60
|
presentation. YARD will handle presentation for us when we decide to generate
|
61
61
|
documentation later.
|
62
62
|
|
63
|
+
Which Markup Format?
|
64
|
+
--------------------
|
65
|
+
|
66
|
+
YARD does not impose a specific markup. The above example uses standard RDoc
|
67
|
+
markup formatting, but YARD also supports textile and markdown via the
|
68
|
+
command-line switch or `.yardopts` file (see below). This means that you are
|
69
|
+
free to use whatever formatting you like. This guide is actually written
|
70
|
+
using markdown. YARD, however, does add a few important syntaxes that are
|
71
|
+
processed no matter which markup formatting you use, such as tag support
|
72
|
+
and inter-document linking. These syntaxes are discussed below.
|
73
|
+
|
63
74
|
Adding Tags to Documentation
|
64
75
|
----------------------------
|
65
76
|
|
@@ -79,6 +90,64 @@ lines following a tag as part of the tag data. For example:
|
|
79
90
|
# The new method accepts the same parameters.
|
80
91
|
def mymethod
|
81
92
|
end
|
93
|
+
|
94
|
+
### List of Tags
|
95
|
+
|
96
|
+
A list of tags can be found in {file:docs/Tags.md#taglist}
|
97
|
+
|
98
|
+
### Reference Tags
|
99
|
+
|
100
|
+
To reduce the amount of duplication in writing documentation for repetitive
|
101
|
+
code, YARD introduces "reference tags", which are not quite tags, but not
|
102
|
+
quite docstrings either. In a sense, they are tag (and docstring) modifiers.
|
103
|
+
Basically, any docstring (or tag) that begins with "(see OTHEROBJECT)" will
|
104
|
+
implicitly link the docstring or tag to the "OTHEROBJECT", copying any data
|
105
|
+
from that docstring/tag into your current object. Consider the example:
|
106
|
+
|
107
|
+
class MyWebServer
|
108
|
+
# Handles a request
|
109
|
+
# @param [Request] request the request object
|
110
|
+
# @return [String] the resulting webpage
|
111
|
+
def get(request) "hello" end
|
112
|
+
|
113
|
+
# (see #get)
|
114
|
+
def post(request) "hello" end
|
115
|
+
end
|
116
|
+
|
117
|
+
The above `#post` method takes the docstring and all tags (`param` and `return`)
|
118
|
+
of the `#get` method. When you generate HTML documentation, you will see this
|
119
|
+
duplication automatically, so you don't have to manually type it out. We can
|
120
|
+
also add our own custom docstring information below the "see" reference, and
|
121
|
+
whatever we write will be appended to the docstring:
|
122
|
+
|
123
|
+
# (see #get)
|
124
|
+
# @note This method may modify our application state!
|
125
|
+
def post(request) self.state += 1; "hello" end
|
126
|
+
|
127
|
+
Here we added another tag, but we could have also added plain text. The
|
128
|
+
text must be appended *after* the `(see ...)` statement, preferably on
|
129
|
+
a separate line.
|
130
|
+
|
131
|
+
Note that we don't have to "refer" the whole docstring. We can also link
|
132
|
+
individual tags instead. Since "get" and "post" actually have different
|
133
|
+
descriptions, a more accurate example would be to only refer our parameter
|
134
|
+
and return tags:
|
135
|
+
|
136
|
+
class MyWebServer
|
137
|
+
# Handles a GET request
|
138
|
+
# @param [Request] request the request object
|
139
|
+
# @return [String] the resulting webpage
|
140
|
+
def get(request) "hello" end
|
141
|
+
|
142
|
+
# Handles a POST request
|
143
|
+
# @note This method may modify our application state!
|
144
|
+
# @param (see #get)
|
145
|
+
# @return (see #get)
|
146
|
+
def post(request) self.state += 1; "hello" end
|
147
|
+
end
|
148
|
+
|
149
|
+
The above copies all of the param and return tags from `#get`. Note that you
|
150
|
+
cannot copy individual tags of a specific type with this syntax.
|
82
151
|
|
83
152
|
Declaring Types
|
84
153
|
---------------
|
@@ -110,57 +179,139 @@ For instance, consider the following Array that holds a set of Strings and
|
|
110
179
|
Symbols:
|
111
180
|
|
112
181
|
# @param [Array<String, Symbol>] list the list of strings and symbols.
|
182
|
+
|
183
|
+
We mentioned that these type fields are "mostly" free-form. In truth, they
|
184
|
+
are defined "by convention". To view samples of common type specifications
|
185
|
+
and recommended conventions for writing type specifications, see
|
186
|
+
{http://yardoc.org/types.html}. Note that these conventions may change every now
|
187
|
+
and then, although we are working on a more "formal" type specification proposal.
|
188
|
+
|
189
|
+
Inter-document Linking
|
190
|
+
----------------------
|
191
|
+
|
192
|
+
YARD supports a special syntax to link to other code objects, URLs, files,
|
193
|
+
or embed docstrings between documents. This syntax has the general form
|
194
|
+
of `{Name OptionalTitle}` (where `OptionalTitle` can have spaces, but `Name`
|
195
|
+
cannot).
|
196
|
+
|
197
|
+
### Linking Objects
|
198
|
+
|
199
|
+
To link another "object" (class, method, module, etc.), use the format:
|
200
|
+
|
201
|
+
{ObjectName#method OPTIONAL_TITLE}
|
202
|
+
{Class::CONSTANT My constant's title}
|
203
|
+
{#method_inside_current_namespace}
|
204
|
+
|
205
|
+
Without an explicit title, YARD will use the relative path to the object as
|
206
|
+
the link name. Note that you can also use relative paths inside the object
|
207
|
+
path to refer to an object inside the same namespace as your current docstring.
|
208
|
+
|
209
|
+
Note that the `@see` tag automatically links its data. You should not use
|
210
|
+
the link syntax in this tag:
|
211
|
+
|
212
|
+
# @see #methodname <- Correct.
|
213
|
+
# @see {#methodname} <- Incorrect.
|
214
|
+
|
215
|
+
### Linking URLs
|
113
216
|
|
114
|
-
|
115
|
-
|
217
|
+
URLs are also linked using this `{...}` syntax:
|
218
|
+
|
219
|
+
{http://example.com Optional Title}
|
220
|
+
{mailto:email@example.com}
|
221
|
+
|
222
|
+
### Linking Files
|
223
|
+
|
224
|
+
Files can also be linked using this same syntax but by adding the `file:`
|
225
|
+
prefix to the object name. Files refer to extra readme files you added
|
226
|
+
via the command-line. Consider the following examples:
|
227
|
+
|
228
|
+
{file:docs/GettingStarted.md Getting Started}
|
229
|
+
{file:mypage.html Name#anchor}
|
116
230
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
---------------------
|
231
|
+
As shown, you can also add an optional `#anchor` if the page is an HTML link.
|
232
|
+
|
233
|
+
### Embedding Docstrings
|
121
234
|
|
122
|
-
|
235
|
+
We saw the `(see ...)` syntax above, which allowed us to link an entire docstring
|
236
|
+
with another. Sometimes, however, we just want to copy docstring text without
|
237
|
+
tags. Using the same `{...}` syntax, but using the `include:` prefix, we can
|
238
|
+
embed a docstring (minus tags) at a specific point in the text.
|
123
239
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
240
|
+
# This class is cool
|
241
|
+
# @abstract
|
242
|
+
class Foo; end
|
243
|
+
|
244
|
+
# This is another class. {include:Foo} too!
|
245
|
+
class Bar; end
|
246
|
+
|
247
|
+
The docstring for Bar becomes:
|
128
248
|
|
129
|
-
|
249
|
+
"This is another class. This class is cool too!"
|
130
250
|
|
131
|
-
|
132
|
-
The syntax is `{ObjectName#method OPTIONAL_TITLE}`. This syntax is acceptable
|
133
|
-
anywhere in documentation with the exception of the @see tag, which
|
134
|
-
automatically links its data.
|
251
|
+
Note that this prefix currently only works for objects.
|
135
252
|
|
136
253
|
<a name="using"></a>
|
137
254
|
Using YARD to Generate Documentation
|
138
255
|
====================================
|
139
256
|
|
140
|
-
|
141
|
-
|
257
|
+
`yard` Executable
|
258
|
+
-----------------
|
259
|
+
|
260
|
+
YARD ships with a single executable aptly named `yard`. In addition to
|
261
|
+
generating standard documentation for your project, you would use this tool
|
262
|
+
if you wanted to:
|
263
|
+
|
264
|
+
* Document all installed gems
|
265
|
+
* Run a local documentation server
|
266
|
+
* Generate UML diagrams using [Graphviz][graphviz]
|
267
|
+
* View `ri`-style documentation
|
268
|
+
* Diff your documentation
|
269
|
+
* Analyze documentation statistics.
|
270
|
+
|
271
|
+
The following commands are available in YARD 0.6.x (see `yard help` for a
|
272
|
+
full list):
|
142
273
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
documentation
|
274
|
+
Usage: yard <command> [options]
|
275
|
+
|
276
|
+
Commands:
|
277
|
+
config Views or edits current global configuration
|
278
|
+
diff Returns the object diff of two gems or .yardoc files
|
279
|
+
doc Generates documentation
|
280
|
+
gems Builds YARD index for gems
|
281
|
+
graph Graphs class diagram using Graphviz
|
282
|
+
help Retrieves help for a command
|
283
|
+
ri A tool to view documentation in the console like `ri`
|
284
|
+
server Runs a local documentation server
|
285
|
+
stats Prints documentation statistics on a set of files
|
286
|
+
|
287
|
+
Note that `yardoc` is an alias for `yard doc`, and `yri` is an alias for
|
288
|
+
`yard ri`. These commands are maintained for backwards compatibility.
|
289
|
+
|
290
|
+
`.yardopts` Options File
|
291
|
+
------------------------
|
149
292
|
|
150
|
-
`.yardopts`
|
151
|
-
-----------
|
152
293
|
Unless your documentation is very small, you'll end up needing to run `yardoc`
|
153
294
|
with many options. The `yardoc` tool will use the options found in this file.
|
154
295
|
It is recommended to check this in to your repository and distribute it with
|
155
|
-
your source.
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
You can
|
162
|
-
|
163
|
-
|
296
|
+
your source. This file is placed at the root of your project (in the directory
|
297
|
+
you run `yardoc` from) and contains all of arguments you would otherwise pass
|
298
|
+
to the command-line tool. For instance, if you often type:
|
299
|
+
|
300
|
+
yardoc --no-private --protected app/**/*.rb - README LEGAL COPYING
|
301
|
+
|
302
|
+
You can place the following into your `.yardopts`:
|
303
|
+
|
304
|
+
--no-private --protected app/**/*.rb - README LEGAL COPYING
|
305
|
+
|
306
|
+
This way, you only need to type:
|
307
|
+
|
308
|
+
yardoc
|
309
|
+
|
310
|
+
Any extra switches passed to the command-line now will be appended to your
|
311
|
+
`.yardopts` options.
|
312
|
+
|
313
|
+
Note that options for `yardoc` are discussed in the {file:README.md README},
|
314
|
+
and a full overview of the `.yardopts` file can be found in {YARD::CLI::Yardoc}.
|
164
315
|
|
165
316
|
<a name="docing"></a>
|
166
317
|
Configuring YARD
|