yard-tomdoc 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/.index CHANGED
@@ -10,13 +10,17 @@ authors:
10
10
  organizations: []
11
11
  requirements:
12
12
  - name: yard
13
- - version: 0.3.0+
13
+ - version: 0.4.0+
14
14
  name: tomparse
15
- - name: rc
16
15
  - groups:
17
16
  - build
18
17
  development: true
19
18
  name: detroit
19
+ - groups:
20
+ - build
21
+ - test
22
+ development: true
23
+ name: dotopts
20
24
  - groups:
21
25
  - test
22
26
  development: true
@@ -53,10 +57,10 @@ customs: []
53
57
  paths:
54
58
  lib:
55
59
  - lib
56
- version: 0.6.0
60
+ version: 0.7.0
57
61
  name: yard-tomdoc
58
62
  title: YARD TomDoc
59
63
  summary: TomDoc for YARD
60
64
  description: Use TomDoc documentation format with YARD.
61
65
  webcvs: https://github.com/rubyworks/yard-tomdoc/tree/master
62
- date: '2013-01-22'
66
+ date: '2013-02-11'
data/HISTORY.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # RELEASE HISTORY
2
2
 
3
+ ## 0.7.0 / 2013-02-12
4
+
5
+ New major release uses the new major release of TomParse.
6
+ So there you go. Oh, it improves class parsing for `Return`
7
+ sections too. That's all.
8
+
9
+ Changes:
10
+
11
+ * Upgrade TomParse requirement to 0.4.0+.
12
+ * Imporove class parsing for return tags.
13
+
14
+
3
15
  ## 0.6.0 / 2013-01-22
4
16
 
5
17
  This new major release adds support for most YARD tags thanks to TomParse's
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # YARD::TomDoc
1
+ # YARD TomDoc
2
2
 
3
3
  [Website](http://rubyworks.github.com/yard-tomdoc) /
4
4
  [Development](http://github.com/rubyworks/yard-tomdoc) /
@@ -23,13 +23,12 @@ Since `yard-tomdoc` is a standard YARD plugin, utilize it with yard's
23
23
 
24
24
  ## Documentation
25
25
 
26
- ### API
27
-
28
- * Shomen -
29
- [Rebecca](http://rubyworks.github.com/rebecca?doc=http://rubyworks.github.com/yard-tomdoc/docs/current.json) /
30
- [Hypervisor](http://rubyworks.github.com/hypervisor?doc=http://rubyworks.github.com/yard-tomdoc/docs/current.json) /
31
- [Rubyfaux](http://rubyworks.github.com/rubyfaux?doc=http://rubyworks.github.com/yard-tomdoc/docs/current.json)
32
- * YARD - [RubyDoc.info](http://rubydoc.info/gems/yard-tomdoc/frames)
26
+ * API
27
+ * YARD - [RubyDoc.info](http://rubydoc.info/gems/yard-tomdoc/frames)
28
+ * Shomen - (out of date)
29
+ [Rebecca](http://rubyworks.github.com/rebecca?doc=http://rubyworks.github.com/yard-tomdoc/docs/current.json) /
30
+ [Hypervisor](http://rubyworks.github.com/hypervisor?doc=http://rubyworks.github.com/yard-tomdoc/docs/current.json) /
31
+ [Rubyfaux](http://rubyworks.github.com/rubyfaux?doc=http://rubyworks.github.com/yard-tomdoc/docs/current.json)
33
32
 
34
33
 
35
34
  ## Limitations
@@ -37,19 +36,27 @@ Since `yard-tomdoc` is a standard YARD plugin, utilize it with yard's
37
36
  Before you use yard-tomdoc you should read about the differences between YARD
38
37
  and TomDoc syntax [here](http://gnuu.org/2010/05/12/whats-missing-from-tomdoc/).
39
38
 
39
+ Note that the YARD TomDoc plugin now supports a superset of TomDoc's syntax which
40
+ provides additional YARD functionality via *cap-tags*. For example using
41
+ `Author: James Deam` in the documentation is equivalent to using `@author James Dean`
42
+ in regular YARD syntax. Support is limited but it opens up much more of the YARD
43
+ goodness to TomDoc users then the old blog post geiven above suggests.
44
+
40
45
 
41
46
  ## Acknowledgements
42
47
 
43
- Huge thanks to Loren Segal, the creator of YARD and the original author of this plugin.
44
- Without his patient assistance and coding genius, this library would not have been possible.
48
+ Huge thanks to Loren Segal, the creator of YARD and the original author of this
49
+ plugin. Without his patient assistance and coding genius, this library would not
50
+ have been possible.
45
51
 
46
52
 
47
53
  ## Licensing
48
54
 
49
- Yard::TomDoc is copyrighted open-source software.
55
+ YARD TomDoc is copyrighted open-source software.
50
56
 
51
57
  Copyright (c) 2010 Rubyworks. All rights reserved.
52
58
 
53
- YARD::TomDoc can be modified and redistributed in accordance with the ters of the **MIT** licsnse.
59
+ YARD TomDoc can be modified and redistributed in accordance with the terms
60
+ of the **MIT** licsnse.
54
61
 
55
62
  See the `LICENSE.txt` file for details.
data/lib/yard-tomdoc.rb CHANGED
@@ -11,10 +11,12 @@ module YARD
11
11
 
12
12
  # Parse comments with TomDoc and then provide YARD with results.
13
13
  #
14
- # yard - [Docstring,DocstringParser] instance of yard object
15
- # comment - [String] comment string
14
+ # Arguments
16
15
  #
17
- # Returns [TomDoc] instance of TomDoc
16
+ # yard - [Docstring,DocstringParser] instance of yard object
17
+ # comment - [String] comment string
18
+ #
19
+ # Returns instance of [TomDoc].
18
20
  def self.yard_parse(yard, comment)
19
21
  tomdoc = TomParse.parse(comment)
20
22
 
@@ -33,8 +35,15 @@ module YARD
33
35
  tomdoc.raises.each {|r| yard.create_tag(:raise, r.sub(/\ARaises\s+/, '')) }
34
36
 
35
37
  tomdoc.returns.each do |r|
36
- # TODO: improve how we figure out class of argument
37
- if md = /\AReturns\s+([A-Z].*?)\s+/.match(r)
38
+ if md = /\[(.*?)\]\Z/.match(r)
39
+ klass = md[1]
40
+ desc = md.pre_match
41
+ yard.create_tag(:return, "[#{klass}] #{desc}")
42
+ elsif md = /\[(.*?)\]/.match(r)
43
+ klass = md[1]
44
+ desc = r.sub("[#{md[1]}]", md[1])
45
+ yard.create_tag(:return, "[#{klass}] #{desc}")
46
+ elsif md = /\AReturns\s+([A-Z].*?)\s+/.match(r)
38
47
  klass = md[1]
39
48
  desc = md.post_match
40
49
  yard.create_tag(:return, "[#{klass}] #{desc}")
@@ -51,9 +60,10 @@ module YARD
51
60
  yard.create_tag(:api, 'public') if tomdoc.public?
52
61
  yard.create_tag(:api, 'private') if tomdoc.internal?
53
62
 
54
- tomdoc.tags.each do |label, desc|
55
- if TAGS.include?(label.to_s)
56
- yard.create_tag(label.to_sym, desc.to_s)
63
+ tomdoc.tags.each do |(label, desc)|
64
+ tag = label.to_s.downcase
65
+ if TAGS.include?(tag)
66
+ yard.create_tag(tag.to_sym, desc.to_s)
57
67
  end
58
68
  end
59
69
 
@@ -65,27 +75,22 @@ module YARD
65
75
  metadata[name.to_s.downcase] || super(name)
66
76
  end
67
77
 
68
- # TODO: The #to_s on the gemspec return value is a bit too simplistic. But how to fix?
69
- # The goal is reduce the value to a basic type (String, Hash, Array, Numeric).
70
-
71
78
  # When a constant is missing, see if it is a metadata entry.
72
79
  # Metadata comes from the RubyGem, and fallsback to project index file.
73
80
  #
74
- # name - [Symbol] constant name
81
+ # Arguments
82
+ #
83
+ # name - [Symbol] constant name
75
84
  #
76
85
  # Returns metadata value.
77
86
  def self.const_missing(const_name)
78
87
  name = const_name.to_s.downcase
79
- #begin
80
- # Gem.loaded_specs[NAME].send(name).to_s
81
- #rescue StandardError
82
- index[name] || super(const_name)
83
- #end
88
+ index[name] || super(const_name)
84
89
  end
85
90
 
86
91
  # Metadata from the `yard-tomdoc.yml` or `.index` file.
87
- #
88
- # Returns [Hash] of metadata.
92
+ #
93
+ # Returns metadata. [Hash]
89
94
  def self.index
90
95
  @index ||= (
91
96
  require 'yaml'
data/lib/yard-tomdoc.yml CHANGED
@@ -10,13 +10,17 @@ authors:
10
10
  organizations: []
11
11
  requirements:
12
12
  - name: yard
13
- - version: 0.3.0+
13
+ - version: 0.4.0+
14
14
  name: tomparse
15
- - name: rc
16
15
  - groups:
17
16
  - build
18
17
  development: true
19
18
  name: detroit
19
+ - groups:
20
+ - build
21
+ - test
22
+ development: true
23
+ name: dotopts
20
24
  - groups:
21
25
  - test
22
26
  development: true
@@ -53,10 +57,10 @@ customs: []
53
57
  paths:
54
58
  lib:
55
59
  - lib
56
- version: 0.6.0
60
+ version: 0.7.0
57
61
  name: yard-tomdoc
58
62
  title: YARD TomDoc
59
63
  summary: TomDoc for YARD
60
64
  description: Use TomDoc documentation format with YARD.
61
65
  webcvs: https://github.com/rubyworks/yard-tomdoc/tree/master
62
- date: '2013-01-22'
66
+ date: '2013-02-11'
data/test/helper.rb CHANGED
@@ -1,2 +1,12 @@
1
+ require 'spectroscope'
2
+ require 'ae'
1
3
  require 'fileutils'
2
4
 
5
+ if ENV['simplecov']
6
+ require 'simplecov'
7
+ SimpleCov.command_name 'Ruby Tests'
8
+ SimpleCov.start do
9
+ coverage_dir('log/coverage')
10
+ end
11
+ end
12
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard-tomdoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-01-22 00:00:00.000000000 Z
13
+ date: 2013-02-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: yard
@@ -35,7 +35,7 @@ dependencies:
35
35
  requirements:
36
36
  - - ! '>='
37
37
  - !ruby/object:Gem::Version
38
- version: 0.3.0
38
+ version: 0.4.0
39
39
  type: :runtime
40
40
  prerelease: false
41
41
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,16 +43,16 @@ dependencies:
43
43
  requirements:
44
44
  - - ! '>='
45
45
  - !ruby/object:Gem::Version
46
- version: 0.3.0
46
+ version: 0.4.0
47
47
  - !ruby/object:Gem::Dependency
48
- name: rc
48
+ name: detroit
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- type: :runtime
55
+ type: :development
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  none: false
@@ -61,7 +61,7 @@ dependencies:
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  - !ruby/object:Gem::Dependency
64
- name: detroit
64
+ name: dotopts
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  none: false
67
67
  requirements: