yard 0.8.6.2 → 0.8.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79ac2562993c76c250d449d1c1b0e2a62b41790f
4
- data.tar.gz: bb2c0b58aac5e48b9c687e9495dbe5a420433259
3
+ metadata.gz: d5a75a0de55c021ca90c4b39745a2eaadf856a42
4
+ data.tar.gz: 097ff460e4d225578721e043e22ea8fe3591fc2f
5
5
  SHA512:
6
- metadata.gz: a404522e86cef2f801bef43ab15d49af955968afcad5d31784c61e30089ba3a50e904cebf99aa2465109043544fdf4b04010e6ba901eca1c46220e730f2a882c
7
- data.tar.gz: 0be733bd7b4c1599710cbffc77af09ff879a0a823774eab1ec5d94923b0f7b185f68ae0ffef42b5eaa180149516586e29797b1d4d3d0c084532c755ef717a117
6
+ metadata.gz: 625943ad3908f4ba36764219b7c4ea50ae48ea29fa3bc7779a277871f809013d491157d682f1818a9f7b4d255ed0a4ef2146aaca7eaa1af2e168fac3b60160af
7
+ data.tar.gz: ba9d09f74bcdd0042af46807c78b3b702248bd57d507c6e14c3db4c8336328178b2ed383469bb1fef0e8ec3616250ea5319a86219c7a9b67acbdcf73817d83e7
data/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  # YARD: Yay! A Ruby Documentation Tool
2
2
 
3
- **Homepage**: [http://yardoc.org](http://yardoc.org)
3
+ **Homepage**: http://yardoc.org
4
4
  **IRC**: [irc.freenode.net / #yard](irc://irc.freenode.net/yard)
5
- **Git**: [http://github.com/lsegal/yard](http://github.com/lsegal/yard)
5
+ **Git**: http://github.com/lsegal/yard
6
6
  **Author**: Loren Segal
7
- **Contributors**: See Contributors section below
7
+ **Contributors**: http://github.com/lsegal/yard/contributors
8
8
  **Copyright**: 2007-2013
9
9
  **License**: MIT License
10
- **Latest Version**: 0.8.6.2
11
- **Release Date**: June 27th 2013
10
+ **Latest Version**: 0.8.7
11
+ **Release Date**: July 26th 2013
12
12
 
13
13
  ## Synopsis
14
14
 
@@ -283,6 +283,12 @@ More options can be seen by typing `yard graph --help`, but here is an example:
283
283
 
284
284
  ## Changelog
285
285
 
286
+ - **July.26.13**: 0.8.7 release
287
+ - Added `--hide-api API` option to hide objects with a given `@api` tag (#685).
288
+ - Added "Returns ...." prefix to summary when a lone @return tag is used.
289
+ - Fixed issue that caused ref tags to be added to a docstring twice (#678).
290
+ - Fixed formatting issue in docstring summaries (#686)
291
+
286
292
  - **June.27.13**: 0.8.6.2 release
287
293
  - Fixed issue where `yard graph` was not displaying methods
288
294
 
@@ -589,13 +595,6 @@ More options can be seen by typing `yard graph --help`, but here is an example:
589
595
  power of YARD and what to expect from the syntax (Yardoc style meta tags).
590
596
 
591
597
 
592
- ## Contributors
593
-
594
- Special thanks to all contributors for submitting patches. A full list of
595
- contributors including their patches can be found at:
596
-
597
- http://github.com/lsegal/yard/contributors
598
-
599
598
  ## Copyright
600
599
 
601
600
  YARD © 2007-2013 by [Loren Segal](mailto:lsegal@soen.ca). YARD is
@@ -175,6 +175,11 @@ module YARD
175
175
  # @since 0.8.1
176
176
  attr_accessor :apis
177
177
 
178
+ # Keep track of which APIs are to be hidden
179
+ # @return [Array<String>] a list of APIs to be hidden
180
+ # @since 0.8.7
181
+ attr_accessor :hidden_apis
182
+
178
183
  # @return [Array<Symbol>] a list of tags to hide from templates
179
184
  # @since 0.6.0
180
185
  attr_accessor :hidden_tags
@@ -198,6 +203,7 @@ module YARD
198
203
  @options.reset_defaults
199
204
  @visibilities = [:public]
200
205
  @apis = []
206
+ @hidden_apis = []
201
207
  @assets = {}
202
208
  @excluded = []
203
209
  @files = []
@@ -430,11 +436,22 @@ module YARD
430
436
  # @return [void]
431
437
  # @since 0.8.1
432
438
  def add_api_verifier
433
- return if apis.empty?
434
439
  no_api = true if apis.delete('')
435
- expr = "#{apis.uniq.inspect}.include?(@api.text)"
436
- expr += " || !@api" if no_api
437
- options.verifier.add_expressions(expr)
440
+ exprs = []
441
+
442
+ if apis.size > 0
443
+ exprs << "#{apis.uniq.inspect}.include?(@api.text)"
444
+ end
445
+
446
+ if hidden_apis.size > 0
447
+ exprs << "!#{hidden_apis.uniq.inspect}.include?(@api.text)"
448
+ end
449
+
450
+ exprs = exprs.size > 0 ? [exprs.join(' && ')] : []
451
+ exprs << "!@api" if no_api
452
+
453
+ expr = exprs.join(' || ')
454
+ options.verifier.add_expressions(expr) unless expr.empty?
438
455
  end
439
456
 
440
457
  # Applies the specified locale to collected objects
@@ -566,6 +583,10 @@ module YARD
566
583
  apis.push(api)
567
584
  end
568
585
 
586
+ opts.on('--hide-api API', 'Hides given @api tag from documentation') do |api|
587
+ hidden_apis.push(api)
588
+ end
589
+
569
590
  opts.on('--embed-mixins', "Embeds mixin methods into class documentation") do
570
591
  options.embed_mixins << '*'
571
592
  end
@@ -171,7 +171,7 @@ module YARD
171
171
  def summary
172
172
  resolve_reference
173
173
  return @summary if @summary
174
- stripped = self.gsub(/<.+?>/m, '').strip
174
+ stripped = self.gsub(/<.+?>/m, '').gsub(/[\r\n](?![\r\n])/, ' ').strip
175
175
  open_parens = ['{', '(', '[']
176
176
  close_parens = ['}', ')', ']']
177
177
  num_parens = 0
@@ -328,9 +328,7 @@ module YARD
328
328
  return if CodeObjects::Proxy === @unresolved_reference
329
329
 
330
330
  reference, @unresolved_reference = @unresolved_reference, nil
331
- resolved_tags = reference.docstring.tags
332
331
  self.all = [reference.docstring.all, @all].join("\n")
333
- add_tag(*resolved_tags)
334
332
  end
335
333
  end
336
334
 
@@ -388,7 +388,9 @@ module YARD
388
388
  handler = parser.handler
389
389
  object = parser.object
390
390
  self.parser = parser.class.new(parser.library)
391
+ parser.state.inside_directive = true
391
392
  parser.parse(tag.text, object, handler)
393
+ parser.state.inside_directive = false
392
394
  end
393
395
 
394
396
  def create_object
@@ -585,6 +587,8 @@ module YARD
585
587
  if %w(public protected private).include?(tag.text)
586
588
  if object.is_a?(CodeObjects::Base)
587
589
  object.visibility = tag.text.to_sym
590
+ elsif handler && !parser.state.inside_directive
591
+ handler.visibility = tag.text.to_sym
588
592
  else
589
593
  parser.state.visibility = tag.text.to_sym
590
594
  end
@@ -16,6 +16,7 @@ module YARD
16
16
  def object=(value)
17
17
  super(value)
18
18
  docstring.object = value
19
+ docstring.tags.each {|tag| tag.object = value }
19
20
  end
20
21
 
21
22
  def name(prefix = false)
data/lib/yard/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module YARD
2
- VERSION = "0.8.6.2"
2
+ VERSION = "0.8.7"
3
3
  end
@@ -400,6 +400,33 @@ describe YARD::CLI::Yardoc do
400
400
  end
401
401
  end
402
402
 
403
+ describe '--hide-api option' do
404
+ it "should allow --hide-api to hide objects with api tags" do
405
+ YARD.parse_string <<-eof
406
+ # @api private
407
+ class Foo; end
408
+ class Bar; end
409
+ class Baz; end
410
+ eof
411
+ @yardoc.run('--hide-api', 'private')
412
+ @yardoc.options.verifier.run(Registry.all).
413
+ sort_by {|o| o.path }.should == [P('Bar'), P('Baz')]
414
+ end
415
+
416
+ it "should allow --hide-api to work with --api" do
417
+ YARD.parse_string <<-eof
418
+ # @api private
419
+ class Foo; end
420
+ # @api public
421
+ class Bar; end
422
+ class Baz; end
423
+ eof
424
+ @yardoc.run('--api', 'public', '--hide-api', 'private')
425
+ @yardoc.options.verifier.run(Registry.all).
426
+ sort_by {|o| o.path }.should == [P('Bar')]
427
+ end
428
+ end
429
+
403
430
  describe '--no-private option' do
404
431
  it "should accept --no-private" do
405
432
  obj = mock(:object)
@@ -57,6 +57,11 @@ describe YARD::Docstring do
57
57
  doc.summary.should == 'Hello world.'
58
58
  end
59
59
 
60
+ it "should strip newlines in first paragraph before summarizing" do
61
+ doc = Docstring.new("Foo\n<code>==</code> bar.")
62
+ doc.summary.should == 'Foo == bar.'
63
+ end
64
+
60
65
  it "should return the first sentence" do
61
66
  o = Docstring.new("DOCSTRING. Another sentence")
62
67
  o.summary.should == "DOCSTRING."
@@ -313,12 +318,17 @@ describe YARD::Docstring do
313
318
  YARD.parse_string <<-eof
314
319
  class A
315
320
  # Docstring
321
+ # @return [Boolean]
316
322
  def a; end
317
323
  # (see #a)
318
324
  def b; end
319
325
  end
320
326
  eof
321
- YARD::Registry.at('A#b').docstring.should == 'Docstring'
327
+
328
+ object = YARD::Registry.at('A#b')
329
+ object.docstring.should == 'Docstring'
330
+ object.tags.map {|x| x.tag_name }.should == ['return']
331
+
322
332
  YARD::Registry.clear
323
333
  end
324
334
  end
@@ -432,5 +432,22 @@ describe YARD::Tags::VisibilityDirective do
432
432
  @parser.state.visibility.should be_nil
433
433
  end
434
434
  end
435
+
436
+ it "updates visibility on future methods" do
437
+ Registry.clear
438
+ YARD.parse_string <<-eof
439
+ class Foo
440
+ # @!visibility private
441
+
442
+
443
+ def foo; end
444
+ def bar; end
445
+ def baz; end
446
+ end
447
+ eof
448
+ %w(foo bar baz).each do |name|
449
+ Registry.at("Foo##{name}").visibility.should == :private
450
+ end
451
+ end if YARD::Parser::SourceParser.parser_type == :ruby
435
452
  end
436
453
  end
@@ -35,6 +35,7 @@
35
35
  </div>
36
36
  <div class="tags">
37
37
 
38
+
38
39
  </div><h2>Defined Under Namespace</h2>
39
40
  <p class="children">
40
41
 
@@ -62,9 +63,10 @@ and newlines.
62
63
  </div>
63
64
  <div class="tags">
64
65
 
66
+
65
67
  </div>
66
68
  </dt>
67
- <dd><pre class="code">'value'</pre></dd>
69
+ <dd><pre class="code">&#39;value&#39;</pre></dd>
68
70
 
69
71
  <dt id="cvar-classvariable" class="deprecated">@@cvar =
70
72
  <div class="docstring">
@@ -76,9 +78,10 @@ and newlines.
76
78
  </div>
77
79
  <div class="tags">
78
80
 
81
+
79
82
  </div>
80
83
  </dt>
81
- <dd><pre class="code">'value'</pre></dd>
84
+ <dd><pre class="code">&#39;value&#39;</pre></dd>
82
85
 
83
86
  </dl>
84
87
 
@@ -86,12 +89,6 @@ and newlines.
86
89
 
87
90
 
88
91
 
89
-
90
-
91
-
92
-
93
-
94
-
95
92
  <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
96
93
  <ul class="summary">
97
94
 
@@ -114,6 +111,7 @@ and newlines.
114
111
 
115
112
 
116
113
 
114
+
117
115
  <span class="summary_desc"><div class='inline'>Returns the value of attribute attr1.</div></span>
118
116
 
119
117
  </li>
@@ -129,7 +127,10 @@ and newlines.
129
127
  </span>
130
128
 
131
129
 
132
- <span class="note title readonly">readonly</span>
130
+
131
+
132
+ <span class="note title readonly">readonly</span>
133
+
133
134
 
134
135
 
135
136
 
@@ -162,6 +163,7 @@ and newlines.
162
163
 
163
164
 
164
165
 
166
+
165
167
  <span class="summary_desc"><div class='inline'></div></span>
166
168
 
167
169
  </li>
@@ -178,26 +180,23 @@ and newlines.
178
180
 
179
181
 
180
182
 
181
- <span class="note title writeonly">writeonly</span>
182
183
 
183
184
 
185
+ <span class="note title writeonly">writeonly</span>
184
186
 
185
187
 
186
188
 
187
189
 
188
190
 
189
- <span class="summary_desc"><div class='inline'>Sets the attribute attr4.</div></span>
190
-
191
- </li>
192
-
193
-
194
- </ul>
195
191
 
196
192
 
197
193
 
194
+ <span class="summary_desc"><div class='inline'>Sets the attribute attr4.</div></span>
198
195
 
196
+ </li>
199
197
 
200
198
 
199
+ </ul>
201
200
 
202
201
 
203
202
 
@@ -231,6 +230,7 @@ and newlines.
231
230
 
232
231
 
233
232
 
233
+
234
234
  <span class="summary_desc"><div class='inline'></div></span>
235
235
 
236
236
  </li>
@@ -263,6 +263,7 @@ and newlines.
263
263
 
264
264
 
265
265
 
266
+
266
267
  <span class="summary_desc"><div class='inline'></div></span>
267
268
 
268
269
  </li>
@@ -284,6 +285,7 @@ and newlines.
284
285
 
285
286
 
286
287
 
288
+
287
289
  <span class="summary_desc"><div class='inline'></div></span>
288
290
 
289
291
  </li>
@@ -305,6 +307,7 @@ and newlines.
305
307
 
306
308
 
307
309
 
310
+
308
311
  <span class="summary_desc"><div class='inline'>hello2.</div></span>
309
312
 
310
313
  </li>
@@ -326,6 +329,7 @@ and newlines.
326
329
 
327
330
 
328
331
 
332
+
329
333
  <span class="summary_desc"><div class='inline'></div></span>
330
334
 
331
335
  </li>
@@ -342,6 +346,7 @@ and newlines.
342
346
 
343
347
 
344
348
 
349
+
345
350
  <h3 class="inherited">Methods included from B</h3>
346
351
  <p class="inherited">#c, #d</p>
347
352
 
@@ -350,6 +355,7 @@ and newlines.
350
355
 
351
356
 
352
357
 
358
+
353
359
  <div id="instance_attr_details" class="attr_details">
354
360
  <h2>Instance Attribute Details</h2>
355
361
 
@@ -362,6 +368,8 @@ and newlines.
362
368
 
363
369
 
364
370
 
371
+
372
+
365
373
  </h3><div class="docstring">
366
374
  <div class="discussion">
367
375
  Returns the value of attribute attr1
@@ -370,6 +378,7 @@ and newlines.
370
378
  </div>
371
379
  <div class="tags">
372
380
 
381
+
373
382
  </div><table class="source_code">
374
383
  <tr>
375
384
  <td>
@@ -400,6 +409,8 @@ end</pre>
400
409
 
401
410
 
402
411
 
412
+
413
+
403
414
  </h3><div class="docstring">
404
415
  <div class="discussion">
405
416
  Returns the value of attribute attr2
@@ -408,6 +419,7 @@ end</pre>
408
419
  </div>
409
420
  <div class="tags">
410
421
 
422
+
411
423
  </div><table class="source_code">
412
424
  <tr>
413
425
  <td>
@@ -442,6 +454,8 @@ end</pre>
442
454
 
443
455
 
444
456
 
457
+
458
+
445
459
  </h3><div class="docstring">
446
460
  <div class="discussion">
447
461
 
@@ -458,12 +472,13 @@ end</pre>
458
472
  <span class="signature">- (<tt>String</tt>) <strong>attr3</strong> </span>
459
473
  <div class="docstring">
460
474
  <div class="discussion">
461
- A string
475
+ Returns a string
462
476
 
463
477
  </div>
464
478
  </div>
465
479
  <div class="tags">
466
- <p class="tag_title">Returns:</p>
480
+
481
+ <p class="tag_title">Returns:</p>
467
482
  <ul class="return">
468
483
 
469
484
  <li>
@@ -512,11 +527,13 @@ end</pre>
512
527
 
513
528
  </ul>
514
529
 
530
+
515
531
  </div>
516
532
  </li>
517
533
 
518
534
  </ul>
519
535
 
536
+
520
537
  </div><table class="source_code">
521
538
  <tr>
522
539
  <td>
@@ -547,6 +564,8 @@ end</pre>
547
564
 
548
565
 
549
566
 
567
+
568
+
550
569
  </h3><div class="docstring">
551
570
  <div class="discussion">
552
571
  Sets the attribute attr4
@@ -573,6 +592,7 @@ end</pre>
573
592
 
574
593
  </ul>
575
594
 
595
+
576
596
  </div><table class="source_code">
577
597
  <tr>
578
598
  <td>
@@ -608,6 +628,8 @@ end</pre>
608
628
 
609
629
 
610
630
 
631
+
632
+
611
633
  </h3><table class="source_code">
612
634
  <tr>
613
635
  <td>
@@ -642,6 +664,8 @@ def self.a; end</pre>
642
664
  <span class="names"><span id='b-instance_method'>b</span></span>
643
665
  </span>
644
666
 
667
+
668
+
645
669
  </h3><table class="source_code">
646
670
  <tr>
647
671
  <td>
@@ -670,6 +694,8 @@ def a; end</pre>
670
694
 
671
695
 
672
696
 
697
+
698
+
673
699
  </h3><div class="docstring">
674
700
  <div class="discussion">
675
701
 
@@ -678,6 +704,7 @@ def a; end</pre>
678
704
  </div>
679
705
  <div class="tags">
680
706
 
707
+
681
708
  </div><table class="source_code">
682
709
  <tr>
683
710
  <td>
@@ -702,6 +729,8 @@ def test_multi_overload(*args) end</pre>
702
729
 
703
730
 
704
731
 
732
+
733
+
705
734
  </h3><div class="docstring">
706
735
  <div class="discussion">
707
736
 
@@ -736,8 +765,10 @@ def test_multi_overload(*args) end</pre>
736
765
 
737
766
  </ul>
738
767
 
768
+
739
769
  </div>
740
770
 
771
+
741
772
  </div><table class="source_code">
742
773
  <tr>
743
774
  <td>
@@ -762,6 +793,8 @@ def test_overload(*args) end</pre>
762
793
 
763
794
 
764
795
 
796
+
797
+
765
798
  </h3><div class="docstring">
766
799
  <div class="discussion">
767
800
  <p class="note returns_void">This method returns an undefined value.</p>
@@ -770,6 +803,7 @@ def test_overload(*args) end</pre>
770
803
  </div>
771
804
  <div class="tags">
772
805
 
806
+
773
807
  </div><table class="source_code">
774
808
  <tr>
775
809
  <td>
@@ -42,7 +42,9 @@ def docstring_text
42
42
  end
43
43
 
44
44
  if text.strip.empty? && object.tags(:return).size == 1 && object.tag(:return).text
45
- text = object.tag(:return).text.gsub(/\A([a-z])/) {|x| x.upcase }
45
+ text = object.tag(:return).text.gsub(/\A([a-z])/) {|x| x.downcase }
46
+ text = "Returns #{text}" unless text.empty? || text =~ /^\s*return/i
47
+ text = text.gsub(/\A([a-z])/) {|x| x.upcase }
46
48
  end
47
49
 
48
50
  text.strip
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.2
4
+ version: 0.8.7
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-06-27 00:00:00.000000000 Z
11
+ date: 2013-07-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.