yard 0.8.5.1 → 0.8.5.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of yard might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +8 -8
- data/lib/yard.rb +3 -0
- data/lib/yard/handlers/ruby/method_handler.rb +1 -0
- data/lib/yard/parser/ruby/ast_node.rb +5 -4
- data/lib/yard/templates/helpers/method_helper.rb +3 -1
- data/lib/yard/version.rb +1 -1
- data/spec/cli/diff_spec.rb +8 -10
- data/spec/code_objects/extra_file_object_spec.rb +6 -3
- data/spec/parser/source_parser_spec.rb +13 -2
- data/spec/templates/helpers/html_helper_spec.rb +6 -2
- data/spec/templates/helpers/method_helper_spec.rb +7 -0
- data/spec/templates/spec_helper.rb +1 -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: 286e9bb0543c0d2d846d703abf038d42c0d08948
|
4
|
+
data.tar.gz: 1935aea9fce12ae0d560f0c2f4b65240aa688fac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 425fa8cdc965cd68b71230050e1d5c5741b9339218aeedfc4027b20ba2d15484ba1771c61b4bc0a6663b5c1b009d941644b6be323d9dd8e5a13314464bcd0a8e
|
7
|
+
data.tar.gz: 811d9eae07e7ded34d64e42858f2d9ddd2fad45847636c832f90f326a157fd0933000ce5168f9a6de97224084936c936e7adfbe8339ecdd6af75d9f09a0f5fdb
|
data/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
YARD: Yay! A Ruby Documentation Tool
|
2
|
-
====================================
|
1
|
+
# YARD: Yay! A Ruby Documentation Tool
|
3
2
|
|
4
3
|
**Homepage**: [http://yardoc.org](http://yardoc.org)
|
5
4
|
**IRC**: [irc.freenode.net / #yard](irc://irc.freenode.net/yard)
|
@@ -8,11 +7,10 @@ YARD: Yay! A Ruby Documentation Tool
|
|
8
7
|
**Contributors**: See Contributors section below
|
9
8
|
**Copyright**: 2007-2013
|
10
9
|
**License**: MIT License
|
11
|
-
**Latest Version**: 0.8.5.
|
12
|
-
**Release Date**: February
|
10
|
+
**Latest Version**: 0.8.5.2
|
11
|
+
**Release Date**: February 26th 2013
|
13
12
|
|
14
|
-
Synopsis
|
15
|
-
--------
|
13
|
+
## Synopsis
|
16
14
|
|
17
15
|
YARD is a documentation generation tool for the Ruby programming language.
|
18
16
|
It enables the user to generate consistent, usable documentation that can be
|
@@ -21,8 +19,7 @@ custom Ruby constructs such as custom class level definitions. Below is a
|
|
21
19
|
summary of some of YARD's notable features.
|
22
20
|
|
23
21
|
|
24
|
-
Feature List
|
25
|
-
------------
|
22
|
+
## Feature List
|
26
23
|
|
27
24
|
**1. RDoc/SimpleMarkup Formatting Compatibility**: YARD is made to be compatible
|
28
25
|
with RDoc formatting. In fact, YARD does no processing on RDoc documentation
|
@@ -286,6 +283,9 @@ More options can be seen by typing `yard graph --help`, but here is an example:
|
|
286
283
|
|
287
284
|
## Changelog
|
288
285
|
|
286
|
+
- **February.26.13**: 0.8.5.2 release
|
287
|
+
- Support new keyword argument syntax in method signatures (Ruby 2.x)
|
288
|
+
|
289
289
|
- **February.25.13**: 0.8.5.1 release
|
290
290
|
- Fix `yard diff` of gem files with RubyGems 2.x
|
291
291
|
|
data/lib/yard.rb
CHANGED
@@ -46,6 +46,9 @@ module YARD
|
|
46
46
|
|
47
47
|
# @return [Boolean] whether YARD is being run in Ruby 1.9 mode
|
48
48
|
def self.ruby19?; @ruby19 ||= (RUBY_VERSION >= "1.9.1") end
|
49
|
+
|
50
|
+
# @return [Boolean] whether YARD is being run in Ruby 2.0
|
51
|
+
def self.ruby2?; @ruby2 ||= (RUBY_VERSION >= '2.0.0') end
|
49
52
|
end
|
50
53
|
|
51
54
|
# Keep track of Ruby version for compatibility code
|
@@ -75,6 +75,7 @@ class YARD::Handlers::Ruby::MethodHandler < YARD::Handlers::Ruby::Base
|
|
75
75
|
params += args.required_params.map {|a| [a.source, nil] } if args.required_params
|
76
76
|
params += args.optional_params.map {|a| [a[0].source, a[1].source] } if args.optional_params
|
77
77
|
params << ["*" + args.splat_param.source, nil] if args.splat_param
|
78
|
+
params << ["**" + args.keyword_param.source, nil] if args.keyword_param
|
78
79
|
params += args.required_end_params.map {|a| [a.source, nil] } if args.required_end_params
|
79
80
|
params << ["&" + args.block_param.source, nil] if args.block_param
|
80
81
|
params
|
@@ -381,12 +381,13 @@ module YARD
|
|
381
381
|
def splat_param; self[2] ? self[2][0] : nil end
|
382
382
|
def block_param; self[-1] ? self[-1][0] : nil end
|
383
383
|
def optional_params
|
384
|
-
optional = self[1]
|
385
|
-
if self[-
|
386
|
-
optional += self[-
|
384
|
+
optional = self[1] || []
|
385
|
+
if self[-3] && self[-3][0] && self[-3][0].type == :default_arg
|
386
|
+
optional += self[-3]
|
387
387
|
end
|
388
|
-
optional
|
388
|
+
optional.empty? ? nil : optional
|
389
389
|
end
|
390
|
+
def keyword_param; YARD.ruby2? ? self[-2] : nil end
|
390
391
|
end
|
391
392
|
|
392
393
|
class MethodCallNode < AstNode
|
data/lib/yard/version.rb
CHANGED
data/spec/cli/diff_spec.rb
CHANGED
@@ -217,7 +217,6 @@ eof
|
|
217
217
|
end
|
218
218
|
|
219
219
|
it "should search for .gem file" do
|
220
|
-
iomock = mock(:io)
|
221
220
|
File.should_receive(:directory?).with('gem1/.yardoc').and_return(false)
|
222
221
|
File.should_receive(:directory?).with('gem2.gem/.yardoc').and_return(false)
|
223
222
|
File.should_receive(:directory?).with('gem1').and_return(false)
|
@@ -226,16 +225,15 @@ eof
|
|
226
225
|
File.should_receive(:exist?).with('gem1.gem').and_return(true)
|
227
226
|
File.should_receive(:exist?).with('gem2.gem').and_return(true)
|
228
227
|
File.should_receive(:exist?).any_number_of_times
|
229
|
-
File.should_receive(:open).with('gem1.gem', 'rb')
|
228
|
+
File.should_receive(:open).with('gem1.gem', 'rb')
|
230
229
|
File.should_receive(:open).with('gem2.gem', 'rb')
|
231
|
-
FileUtils.
|
232
|
-
Gem::Package.
|
233
|
-
FileUtils.
|
230
|
+
FileUtils.stub(:mkdir_p)
|
231
|
+
Gem::Package.stub(:open)
|
232
|
+
FileUtils.stub(:rm_rf)
|
234
233
|
@diff.run('gem1', 'gem2.gem')
|
235
234
|
end
|
236
235
|
|
237
236
|
it "should search for .gem file on rubygems.org" do
|
238
|
-
iomock = mock(:io)
|
239
237
|
File.should_receive(:directory?).with('gem1/.yardoc').and_return(false)
|
240
238
|
File.should_receive(:directory?).with('gem2.gem/.yardoc').and_return(false)
|
241
239
|
File.should_receive(:directory?).with('gem1').and_return(false)
|
@@ -244,11 +242,11 @@ eof
|
|
244
242
|
File.should_receive(:exist?).with('gem1.gem').and_return(false)
|
245
243
|
File.should_receive(:exist?).with('gem2.gem').and_return(false)
|
246
244
|
File.should_receive(:exist?).any_number_of_times
|
247
|
-
@diff.should_receive(:open).with('http://rubygems.org/downloads/gem1.gem')
|
245
|
+
@diff.should_receive(:open).with('http://rubygems.org/downloads/gem1.gem')
|
248
246
|
@diff.should_receive(:open).with('http://rubygems.org/downloads/gem2.gem')
|
249
|
-
FileUtils.
|
250
|
-
Gem::Package.
|
251
|
-
FileUtils.
|
247
|
+
FileUtils.stub(:mkdir_p)
|
248
|
+
Gem::Package.stub(:open)
|
249
|
+
FileUtils.stub(:rm_rf)
|
252
250
|
@diff.run('gem1', 'gem2.gem')
|
253
251
|
end
|
254
252
|
|
@@ -88,10 +88,13 @@ describe YARD::CodeObjects::ExtraFileObject do
|
|
88
88
|
|
89
89
|
it "should attempt to re-parse data as 8bit ascii if parsing fails" do
|
90
90
|
log.should_not_receive(:warn)
|
91
|
-
str = "\xB0"
|
92
|
-
|
91
|
+
str, out = *(["\xB0"] * 2)
|
92
|
+
if str.respond_to?(:force_encoding)
|
93
|
+
str.force_encoding('utf-8')
|
94
|
+
out.force_encoding('binary')
|
95
|
+
end
|
93
96
|
file = ExtraFileObject.new('file.txt', str)
|
94
|
-
file.contents.should ==
|
97
|
+
file.contents.should == out
|
95
98
|
end
|
96
99
|
end
|
97
100
|
|
@@ -547,8 +547,13 @@ describe YARD::Parser::SourceParser do
|
|
547
547
|
File.should_receive(:read_binary).with('tmpfile').and_return(src)
|
548
548
|
result = parser.parse("tmpfile")
|
549
549
|
if HAVE_RIPPER && YARD.ruby19?
|
550
|
-
|
551
|
-
|
550
|
+
if msg == :should_not
|
551
|
+
default_encoding = YARD.ruby2? ? 'UTF-8' : 'US-ASCII'
|
552
|
+
result.enumerator[0].source.encoding.to_s.should eq(default_encoding)
|
553
|
+
else
|
554
|
+
['Shift_JIS', 'Windows-31J', 'UTF-8'].send(msg, include(
|
555
|
+
result.enumerator[0].source.encoding.to_s))
|
556
|
+
end
|
552
557
|
end
|
553
558
|
result.encoding_line.send(msg) == src.split("\n").last
|
554
559
|
end
|
@@ -702,5 +707,11 @@ describe YARD::Parser::SourceParser do
|
|
702
707
|
Registry.at('A#d').should be_nil
|
703
708
|
Registry.at('A::B#d').should_not be_nil
|
704
709
|
end
|
710
|
+
|
711
|
+
it 'supports keyword arguments' do
|
712
|
+
YARD.parse_string 'def foo(a: 1, b: 2, **kwargs) end'
|
713
|
+
args = [['a:', '1'], ['b:', '2'], ['**kwargs', nil]]
|
714
|
+
Registry.at('#foo').parameters.should eq(args)
|
715
|
+
end if YARD.ruby2?
|
705
716
|
end
|
706
717
|
end
|
@@ -115,8 +115,12 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
115
115
|
|
116
116
|
it "should handle various encodings" do
|
117
117
|
stub!(:object).and_return(Registry.root)
|
118
|
-
|
119
|
-
|
118
|
+
text = "\xB0\xB1"
|
119
|
+
if defined?(Encoding)
|
120
|
+
Encoding.default_internal = 'utf-8'
|
121
|
+
text = text.force_encoding('binary')
|
122
|
+
end
|
123
|
+
htmlify(text, :text)
|
120
124
|
# TODO: add more encoding tests
|
121
125
|
end
|
122
126
|
|
@@ -5,6 +5,13 @@ describe YARD::Templates::Helpers::MethodHelper do
|
|
5
5
|
include YARD::Templates::Helpers::MethodHelper
|
6
6
|
|
7
7
|
describe '#format_args' do
|
8
|
+
it "should display keyword arguments" do
|
9
|
+
params = [['a:', '1'], ['b:', '2'], ['**kwargs', nil]]
|
10
|
+
YARD.parse_string 'def foo; end'
|
11
|
+
Registry.at('#foo').stub(:parameters) { params }
|
12
|
+
format_args(Registry.at('#foo')).should == '(a: 1, b: 2, **kwargs)'
|
13
|
+
end
|
14
|
+
|
8
15
|
it "should not show &blockarg if no @param tag and has @yield" do
|
9
16
|
YARD.parse_string <<-'eof'
|
10
17
|
# @yield blah
|
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.5.
|
4
|
+
version: 0.8.5.2
|
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-02-
|
11
|
+
date: 2013-02-26 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.
|