yard 0.8.6 → 0.8.6.1
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.
- checksums.yaml +4 -4
- data/README.md +7 -2
- data/docs/WhatsNew.md +23 -2
- data/lib/yard/cli/display.rb +28 -3
- data/lib/yard/docstring.rb +2 -2
- data/lib/yard/templates/helpers/base_helper.rb +9 -9
- data/lib/yard/templates/helpers/html_helper.rb +4 -4
- data/lib/yard/version.rb +1 -1
- data/spec/cli/display_spec.rb +22 -5
- data/templates/default/fulldoc/html/full_list_file.erb +1 -1
- data/templates/default/fulldoc/html/setup.rb +0 -3
- data/templates/default/onefile/html/setup.rb +18 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 423812ba8b57f788358b8e8a063406734ffcd8aa
|
4
|
+
data.tar.gz: 3847cd78486e1964b9a6c71bc3a791e82331a763
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f9ac29d7ed76bc7100931b4403c655d78fc2078102fb0c3d44fc972a4f2bcf31302ebd1676927b7322b980621a5274a8a1682ba7235f4ee7cf2d24c561250bc
|
7
|
+
data.tar.gz: b450ef97c370faaa21934a7b9c2af03b32a4f692db7a2246efb39204fd039f89a07bcda58a533bcdcfe301b5904a2c598fcd315f5b0f1cfdb6aa57e04e2f2fb0
|
data/README.md
CHANGED
@@ -7,8 +7,8 @@
|
|
7
7
|
**Contributors**: See Contributors section below
|
8
8
|
**Copyright**: 2007-2013
|
9
9
|
**License**: MIT License
|
10
|
-
**Latest Version**: 0.8.6
|
11
|
-
**Release Date**: April
|
10
|
+
**Latest Version**: 0.8.6.1
|
11
|
+
**Release Date**: April 14th 2013
|
12
12
|
|
13
13
|
## Synopsis
|
14
14
|
|
@@ -283,6 +283,11 @@ More options can be seen by typing `yard graph --help`, but here is an example:
|
|
283
283
|
|
284
284
|
## Changelog
|
285
285
|
|
286
|
+
- **April.14.13**: 0.8.6.1 release
|
287
|
+
- Fixed broken links in File menu on default HTML template
|
288
|
+
- Added --layout switch to `yard display` to wrap output in layout template.
|
289
|
+
- See {file:docs/WhatsNew.md} for more information on added features.
|
290
|
+
|
286
291
|
- **April.13.13**: 0.8.6 release
|
287
292
|
- Various fixes and improved Ruby 2.x compatibility support
|
288
293
|
- Added support for `asciidoc` markup type
|
data/docs/WhatsNew.md
CHANGED
@@ -20,7 +20,8 @@
|
|
20
20
|
16. **Added `-B/--bind` to bind to a port in yard server** (0.8.4)
|
21
21
|
17. **Added `asciidoc` markup type support** (0.8.6)
|
22
22
|
18. **Added `yard markups` command to list available markup types** (0.8.6)
|
23
|
-
|
23
|
+
19. **Added `yard display` command to display formatted objects** (0.8.6)
|
24
|
+
20. **Added `--layout` to `yard display` command** (0.8.6.1)
|
24
25
|
|
25
26
|
## Directives (new behavioural tag syntax) (0.8.0)
|
26
27
|
|
@@ -319,7 +320,8 @@ provider library, pass the `-M PROVIDER_NAME` option.
|
|
319
320
|
## Added `yard display` command to display formatted objects (0.8.6)
|
320
321
|
|
321
322
|
<p class="note">This feature requires the .yardoc registry to have already been
|
322
|
-
generated. To generate the registry, run <code>yard doc -n</code
|
323
|
+
generated. To generate the registry, run <code>yard doc -n</code>.
|
324
|
+
</p>
|
323
325
|
|
324
326
|
You can now display a single object (or a list of objects) in the YARD registry
|
325
327
|
using the `yard display OBJECT ...` command. For example, to display the
|
@@ -336,6 +338,25 @@ web browser:
|
|
336
338
|
Custom templating options from `yard doc` can also be used, see
|
337
339
|
`yard display --help` for more options.
|
338
340
|
|
341
|
+
## Added `--layout` to `yard display` command (0.8.6.1)
|
342
|
+
|
343
|
+
The `yard display` command now accepts `--layout` to wrap content in a layout
|
344
|
+
template. Currently the `layout` and `onefile` layout templates are supported,
|
345
|
+
though any template can be used. If no parameter is specified, the layout will
|
346
|
+
default to the `layout` template. Example usage:
|
347
|
+
|
348
|
+
$ yard display --layout onefile -f html YARD::CodeObjects > codeobjects.html
|
349
|
+
|
350
|
+
The above generates a `codeobjects.html` file that is self-contained with
|
351
|
+
CSS stylesheets and JavaScript code. This is similar to calling
|
352
|
+
`yard doc --one-file` with only the YARD::CodeObjects object in the registry.
|
353
|
+
|
354
|
+
Note that even though this uses the onefile template, the README file will not
|
355
|
+
be auto-included the way it is with the `yard doc` command. To include the
|
356
|
+
README text at the top of the onefile template, pass the --readme switch:
|
357
|
+
|
358
|
+
$ yard display --layout onefile -f html --readme README.md OBJECT > out.html
|
359
|
+
|
339
360
|
# What's New in 0.7.x?
|
340
361
|
|
341
362
|
1. **Macro support and detection of DSL methods** (0.7.0)
|
data/lib/yard/cli/display.rb
CHANGED
@@ -8,6 +8,8 @@ module YARD
|
|
8
8
|
def initialize(*args)
|
9
9
|
super
|
10
10
|
options.format = :text # default for this command
|
11
|
+
@layout = nil
|
12
|
+
@objects = []
|
11
13
|
end
|
12
14
|
|
13
15
|
# Runs the commandline utility, parsing arguments and displaying an object
|
@@ -17,9 +19,25 @@ module YARD
|
|
17
19
|
# @return [void]
|
18
20
|
def run(*args)
|
19
21
|
return unless parse_arguments(*args)
|
20
|
-
|
21
|
-
|
22
|
-
|
22
|
+
log.puts wrap_layout(format_objects)
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [String] the output data for all formatted objects
|
26
|
+
def format_objects
|
27
|
+
@objects.inject([]) do |arr, obj|
|
28
|
+
arr.push obj.format(options)
|
29
|
+
end.join("\n")
|
30
|
+
end
|
31
|
+
|
32
|
+
def wrap_layout(contents)
|
33
|
+
return contents unless @layout
|
34
|
+
opts = options.merge(
|
35
|
+
:contents => contents,
|
36
|
+
:object => @objects.first,
|
37
|
+
:objects => @objects
|
38
|
+
)
|
39
|
+
args = [options.template, @layout, options.format]
|
40
|
+
Templates::Engine.template(*args).run(opts)
|
23
41
|
end
|
24
42
|
|
25
43
|
# Parses commandline options.
|
@@ -38,6 +56,13 @@ module YARD
|
|
38
56
|
return false if @objects.any? {|o| o.nil? }
|
39
57
|
verify_markup_options
|
40
58
|
end
|
59
|
+
|
60
|
+
def output_options(opts)
|
61
|
+
super(opts)
|
62
|
+
opts.on('-l', '--layout [LAYOUT]', 'Wraps output in layout template (good for HTML)') do |layout|
|
63
|
+
@layout = layout || 'layout'
|
64
|
+
end
|
65
|
+
end
|
41
66
|
end
|
42
67
|
end
|
43
68
|
end
|
data/lib/yard/docstring.rb
CHANGED
@@ -71,8 +71,8 @@ module YARD
|
|
71
71
|
# docstring. May be nil.
|
72
72
|
# @param [String] raw_data the complete docstring, including all
|
73
73
|
# original formatting and any unparsed tags/directives.
|
74
|
-
# @param [CodeObjects::Base, nil]
|
75
|
-
# of documentation / tag information.
|
74
|
+
# @param [CodeObjects::Base, nil] ref_object a reference object used for
|
75
|
+
# the base set of documentation / tag information.
|
76
76
|
def self.new!(text, tags = [], object = nil, raw_data = nil, ref_object = nil)
|
77
77
|
docstring = allocate
|
78
78
|
docstring.replace(text, false)
|
@@ -97,10 +97,10 @@ module YARD::Templates::Helpers
|
|
97
97
|
|
98
98
|
# Includes an object's docstring into output.
|
99
99
|
# @since 0.6.0
|
100
|
-
# @param [CodeObjects::Base]
|
100
|
+
# @param [CodeObjects::Base] obj the object to include
|
101
101
|
# @return [String] the object's docstring (no tags)
|
102
|
-
def link_include_object(
|
103
|
-
|
102
|
+
def link_include_object(obj)
|
103
|
+
obj.docstring
|
104
104
|
end
|
105
105
|
|
106
106
|
# Include a file as a docstring in output
|
@@ -113,19 +113,19 @@ module YARD::Templates::Helpers
|
|
113
113
|
|
114
114
|
# Links to an object with an optional title
|
115
115
|
#
|
116
|
-
# @param [CodeObjects::Base]
|
116
|
+
# @param [CodeObjects::Base] obj the object to link to
|
117
117
|
# @param [String] title the title to use for the link
|
118
118
|
# @return [String] the linked object
|
119
|
-
def link_object(
|
119
|
+
def link_object(obj, title = nil)
|
120
120
|
return title if title
|
121
121
|
|
122
|
-
case
|
122
|
+
case obj
|
123
123
|
when YARD::CodeObjects::Base, YARD::CodeObjects::Proxy
|
124
|
-
|
124
|
+
obj.title
|
125
125
|
when String, Symbol
|
126
|
-
P(
|
126
|
+
P(obj).title
|
127
127
|
else
|
128
|
-
|
128
|
+
obj
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
@@ -250,11 +250,11 @@ module YARD
|
|
250
250
|
end
|
251
251
|
|
252
252
|
# (see BaseHelper#link_object)
|
253
|
-
def link_object(obj,
|
254
|
-
return
|
253
|
+
def link_object(obj, title = nil, anchor = nil, relative = true)
|
254
|
+
return title if obj.nil?
|
255
255
|
obj = Registry.resolve(object, obj, true, true) if obj.is_a?(String)
|
256
|
-
if
|
257
|
-
title =
|
256
|
+
if title
|
257
|
+
title = title.to_s
|
258
258
|
elsif object.is_a?(CodeObjects::Base)
|
259
259
|
# Check if we're linking to a class method in the current
|
260
260
|
# object. If we are, create a title in the format of
|
data/lib/yard/version.rb
CHANGED
data/spec/cli/display_spec.rb
CHANGED
@@ -1,13 +1,30 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
2
|
|
3
3
|
describe YARD::CLI::Display do
|
4
|
-
|
4
|
+
before do
|
5
5
|
Registry.stub(:load)
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
@object = CodeObjects::ClassObject.new(:root, :Foo)
|
7
|
+
@object.docstring = 'Foo bar'
|
8
|
+
end
|
9
9
|
|
10
|
+
it "displays an object" do
|
10
11
|
YARD::CLI::Display.run('-f', 'text', 'Foo')
|
11
|
-
log.io.string.strip.should eq(
|
12
|
+
log.io.string.strip.should eq(@object.format.strip)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "wraps output with -l (defaulting to layout)" do
|
16
|
+
YARD::CLI::Display.run('-l', '-f', 'html', 'Foo')
|
17
|
+
formatted_output = @object.format(:format => :html).strip
|
18
|
+
actual_output = log.io.string.strip
|
19
|
+
actual_output.should_not eq(formatted_output)
|
20
|
+
actual_output.should include(formatted_output)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "wraps output with --layout onefile" do
|
24
|
+
YARD::CLI::Display.run('--layout', 'onefile', '-f', 'html', 'Foo')
|
25
|
+
formatted_output = @object.format(:format => :html).strip
|
26
|
+
actual_output = log.io.string.strip
|
27
|
+
actual_output.should_not eq(formatted_output)
|
28
|
+
actual_output.should include(formatted_output)
|
12
29
|
end
|
13
30
|
end
|
@@ -39,9 +39,6 @@ end
|
|
39
39
|
# contents of all the javascript and css and output the entire contents without
|
40
40
|
# depending on any additional files
|
41
41
|
def serialize_onefile
|
42
|
-
layout = Object.new.extend(T('layout'))
|
43
|
-
options.css_data = layout.stylesheets.map {|sheet| file(sheet,true) }.join("\n")
|
44
|
-
options.js_data = layout.javascripts.map {|script| file(script,true) }.join("")
|
45
42
|
Templates::Engine.with_serializer('index.html', options.serializer) do
|
46
43
|
T('onefile').run(options)
|
47
44
|
end
|
@@ -14,9 +14,27 @@ def all_objects
|
|
14
14
|
@objects.map {|obj| obj.format(options) }.join("\n")
|
15
15
|
end
|
16
16
|
|
17
|
+
def layout
|
18
|
+
fulldoc = Object.new.extend(T('fulldoc'))
|
19
|
+
layout = Object.new.extend(T('layout'))
|
20
|
+
@css_data = layout.stylesheets.map {|sheet| read_asset(sheet) }.join("\n")
|
21
|
+
@js_data = layout.javascripts.map {|script| read_asset(script) }.join("")
|
22
|
+
|
23
|
+
erb(:layout)
|
24
|
+
end
|
25
|
+
|
26
|
+
def read_asset(file)
|
27
|
+
return unless file = T('fulldoc').find_file(file)
|
28
|
+
data = File.read(file)
|
29
|
+
superfile = self.class.find_nth_file('fulldoc', 2)
|
30
|
+
data.gsub!('{{{__super__}}}', superfile ? IO.read(superfile) : "")
|
31
|
+
data
|
32
|
+
end
|
33
|
+
|
17
34
|
private
|
18
35
|
|
19
36
|
def parse_top_comments_from_file
|
37
|
+
return unless @readme
|
20
38
|
return @readme.contents unless @readme.filename =~ /\.rb$/
|
21
39
|
data = ""
|
22
40
|
tokens = TokenList.new(@readme.contents)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.6
|
4
|
+
version: 0.8.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Loren Segal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
YARD is a documentation generation tool for the Ruby programming language.
|