yard-rails 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 1.8.7
5
+
6
+ script: rake
data/ChangeLog.md CHANGED
@@ -1,3 +1,14 @@
1
+ ### 0.3.0 / 2012-08-01
2
+
3
+ * Fix broken support for `attr_accessible`
4
+ * Add support for `attr_protected`
5
+
6
+
7
+ ### 0.2.0 / 2011-11-10
8
+
9
+ * Add `attr_accessible`
10
+
11
+
1
12
  ### 0.1.0 / 2011-10-02
2
13
 
3
14
  * Initial release:
data/Gemfile.lock CHANGED
@@ -2,23 +2,27 @@ GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
4
  diff-lcs (1.1.3)
5
- gemcutter (0.7.0)
5
+ gemcutter (0.7.1)
6
6
  git (1.2.5)
7
- jeweler (1.6.4)
7
+ jeweler (1.8.4)
8
8
  bundler (~> 1.0)
9
9
  git (>= 1.2.5)
10
10
  rake
11
- rake (0.9.2)
11
+ rdoc
12
+ json (1.7.4)
13
+ rake (0.9.2.2)
12
14
  rdiscount (1.6.8)
13
- rspec (2.6.0)
14
- rspec-core (~> 2.6.0)
15
- rspec-expectations (~> 2.6.0)
16
- rspec-mocks (~> 2.6.0)
17
- rspec-core (2.6.4)
18
- rspec-expectations (2.6.0)
19
- diff-lcs (~> 1.1.2)
20
- rspec-mocks (2.6.0)
21
- yard (0.7.2)
15
+ rdoc (3.12)
16
+ json (~> 1.4)
17
+ rspec (2.11.0)
18
+ rspec-core (~> 2.11.0)
19
+ rspec-expectations (~> 2.11.0)
20
+ rspec-mocks (~> 2.11.0)
21
+ rspec-core (2.11.1)
22
+ rspec-expectations (2.11.2)
23
+ diff-lcs (~> 1.1.3)
24
+ rspec-mocks (2.11.1)
25
+ yard (0.8.2.1)
22
26
 
23
27
  PLATFORMS
24
28
  ruby
data/README.md CHANGED
@@ -19,6 +19,10 @@ For older versions of YARD, all plugins are loaded automatically.
19
19
 
20
20
  Parses the following statements:
21
21
 
22
+ attr_accessible :attr
23
+
24
+ attr_protected :attr
25
+
22
26
  cattr_reader :attr
23
27
 
24
28
  cattr_writer :attr
@@ -31,6 +35,9 @@ Parses the following statements:
31
35
 
32
36
  mattr_accessor :attr
33
37
 
38
+ If you know of more Rails-specific DSL that should be included in this plugin,
39
+ feel free to create an issue here on GitHub, and I'll be happy to include it.
40
+
34
41
  ## Requirements
35
42
 
36
43
  * [yard](http://yardoc.org) >= 0.4.0
data/Rakefile CHANGED
@@ -22,16 +22,15 @@ Jeweler::Tasks.new do |gem|
22
22
  gem.authors = ['Charles H. Pence']
23
23
  gem.has_rdoc = 'yard'
24
24
  end
25
+ Jeweler::RubygemsDotOrgTasks.new
25
26
 
26
27
  require 'rspec/core/rake_task'
27
28
  RSpec::Core::RakeTask.new(:rspec) do |spec|
28
- # The automatic bundler detecton causes trouble on my
29
- # development machine.
30
- spec.skip_bundler = true
31
29
  spec.rspec_opts = ['--options', '.specopts']
32
30
  end
33
31
 
34
32
  task :test => :rspec
33
+ task :spec => :rspec
35
34
  task :default => :rspec
36
35
 
37
36
  require 'yard'
data/VERSION CHANGED
@@ -1,2 +1,2 @@
1
- 0.1.0
1
+ 0.3.0
2
2
 
@@ -0,0 +1,17 @@
1
+
2
+ module YARD
3
+ module Rails
4
+ class AttrAccessibleHandler < YARD::Handlers::Ruby::AttributeHandler
5
+ handles method_call(:attr_accessible)
6
+ handles method_call(:attr_protected)
7
+ namespace_only
8
+
9
+ def process
10
+ # HACK: Must set the name to attr_accessor to make the attribute
11
+ # show up as read/write.
12
+ statement[0] = YARD::Parser::Ruby::AstNode.node_class_for(:ident).new(:ident, ["attr_accessor"])
13
+ super
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,18 @@
1
+
2
+ module YARD
3
+ module Rails
4
+ module Legacy
5
+ class AttrAccessibleHandler < YARD::Handlers::Ruby::Legacy::AttributeHandler
6
+ handles /\Aattr_(accessible|protected)(?:\s|\()/
7
+ namespace_only
8
+
9
+ def process
10
+ # HACK: Must set the name to attr_accessor to make the attribute
11
+ # show up as read/write.
12
+ statement.tokens.first.set_text('attr_accessor')
13
+ super
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
data/lib/yard-rails.rb CHANGED
@@ -1,2 +1,5 @@
1
1
  require 'yard-rails/class_attribute_handler'
2
2
  require 'yard-rails/legacy/class_attribute_handler'
3
+
4
+ require 'yard-rails/attr_accessible_handler'
5
+ require 'yard-rails/legacy/attr_accessible_handler'
@@ -0,0 +1,54 @@
1
+ require 'spec_helper'
2
+ require 'helpers/examples'
3
+
4
+ require 'yard-rails/attr_accessible_handler'
5
+ require 'yard-rails/legacy/attr_accessible_handler'
6
+
7
+ describe "AttrAccessibleHandler" do
8
+ include Helpers::Examples
9
+
10
+ describe "valid" do
11
+ before(:all) do
12
+ parse_file :attr_accessible_protected
13
+ end
14
+
15
+ it "should define reader instance method for the attr_accessible method" do
16
+ yard('SimpleAttrAccessible#test_attribute').should be_instance_of(CodeObjects::MethodObject)
17
+ end
18
+
19
+ it "should define writer instance method for the attr_accessible method" do
20
+ yard('SimpleAttrAccessible#test_attribute=').should be_instance_of(CodeObjects::MethodObject)
21
+ end
22
+
23
+ it "should define reader instance method for the attr_protected method" do
24
+ yard('SimpleAttrAccessible#other_attribute').should be_instance_of(CodeObjects::MethodObject)
25
+ end
26
+
27
+ it "should define writer instance method for the attr_protected method" do
28
+ yard('SimpleAttrAccessible#other_attribute=').should be_instance_of(CodeObjects::MethodObject)
29
+ end
30
+ end
31
+
32
+ describe "legacy" do
33
+ before(:all) do
34
+ parse_file :attr_accessible_protected, true
35
+ end
36
+
37
+ it "should define reader instance method for the attr_accessible method" do
38
+ yard('SimpleAttrAccessible#test_attribute').should be_instance_of(CodeObjects::MethodObject)
39
+ end
40
+
41
+ it "should define writer instance method for the attr_accessible method" do
42
+ yard('SimpleAttrAccessible#test_attribute=').should be_instance_of(CodeObjects::MethodObject)
43
+ end
44
+
45
+ it "should define reader instance method for the attr_protected method" do
46
+ yard('SimpleAttrAccessible#other_attribute').should be_instance_of(CodeObjects::MethodObject)
47
+ end
48
+
49
+ it "should define writer instance method for the attr_protected method" do
50
+ yard('SimpleAttrAccessible#other_attribute=').should be_instance_of(CodeObjects::MethodObject)
51
+ end
52
+ end
53
+ end
54
+
@@ -0,0 +1,5 @@
1
+ class SimpleAttrAccessible
2
+ attr_accessible :test_attribute
3
+
4
+ attr_protected :other_attribute
5
+ end
data/yard-rails.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "yard-rails"
8
- s.version = "0.1.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Charles H. Pence"]
12
- s.date = "2011-10-02"
12
+ s.date = "2012-08-01"
13
13
  s.description = "Rails includes several bits of custom markup (such as the new \"cattr_*\" methods). This plugin for YARD adds support for this custom markup, which otherwise is parsed incorrectly."
14
14
  s.email = "charles@charlespence.net"
15
15
  s.extra_rdoc_files = [
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.files = [
21
21
  ".gemtest",
22
22
  ".specopts",
23
+ ".travis.yml",
23
24
  ".yardopts",
24
25
  "ChangeLog.md",
25
26
  "Gemfile",
@@ -29,10 +30,14 @@ Gem::Specification.new do |s|
29
30
  "Rakefile",
30
31
  "VERSION",
31
32
  "lib/yard-rails.rb",
33
+ "lib/yard-rails/attr_accessible_handler.rb",
32
34
  "lib/yard-rails/class_attribute_handler.rb",
35
+ "lib/yard-rails/legacy/attr_accessible_handler.rb",
33
36
  "lib/yard-rails/legacy/class_attribute_handler.rb",
37
+ "spec/attr_accessible_handler_spec.rb",
34
38
  "spec/class_attribute_handler_spec.rb",
35
39
  "spec/helpers/examples.rb",
40
+ "spec/helpers/examples/attr_accessible_protected.rb.txt",
36
41
  "spec/helpers/examples/simple_cattrs.rb.txt",
37
42
  "spec/spec_helper.rb",
38
43
  "tasks/yard.rb",
@@ -41,7 +46,7 @@ Gem::Specification.new do |s|
41
46
  s.homepage = "http://github.com/cpence/yard-rails"
42
47
  s.licenses = ["MIT"]
43
48
  s.require_paths = ["lib"]
44
- s.rubygems_version = "1.8.10"
49
+ s.rubygems_version = "1.8.23"
45
50
  s.summary = "A YARD plugin for parsing custom Rails syntax."
46
51
 
47
52
  if s.respond_to? :specification_version then
@@ -52,12 +57,14 @@ Gem::Specification.new do |s|
52
57
  s.add_development_dependency(%q<yard>, [">= 0"])
53
58
  s.add_development_dependency(%q<rake>, [">= 0"])
54
59
  s.add_development_dependency(%q<jeweler>, [">= 0"])
60
+ s.add_development_dependency(%q<gemcutter>, [">= 0"])
55
61
  s.add_development_dependency(%q<rspec>, [">= 0"])
56
62
  else
57
63
  s.add_dependency(%q<yard>, [">= 0"])
58
64
  s.add_dependency(%q<yard>, [">= 0"])
59
65
  s.add_dependency(%q<rake>, [">= 0"])
60
66
  s.add_dependency(%q<jeweler>, [">= 0"])
67
+ s.add_dependency(%q<gemcutter>, [">= 0"])
61
68
  s.add_dependency(%q<rspec>, [">= 0"])
62
69
  end
63
70
  else
@@ -65,6 +72,7 @@ Gem::Specification.new do |s|
65
72
  s.add_dependency(%q<yard>, [">= 0"])
66
73
  s.add_dependency(%q<rake>, [">= 0"])
67
74
  s.add_dependency(%q<jeweler>, [">= 0"])
75
+ s.add_dependency(%q<gemcutter>, [">= 0"])
68
76
  s.add_dependency(%q<rspec>, [">= 0"])
69
77
  end
70
78
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-02 00:00:00.000000000Z
12
+ date: 2012-08-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: yard
16
- requirement: &2157121280 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2157121280
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: yard
27
- requirement: &2157120780 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *2157120780
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: rake
38
- requirement: &2157120280 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,31 @@ dependencies:
43
53
  version: '0'
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *2157120280
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: jeweler
49
- requirement: &2157119740 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: gemcutter
80
+ requirement: !ruby/object:Gem::Requirement
50
81
  none: false
51
82
  requirements:
52
83
  - - ! '>='
@@ -54,10 +85,15 @@ dependencies:
54
85
  version: '0'
55
86
  type: :development
56
87
  prerelease: false
57
- version_requirements: *2157119740
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
58
94
  - !ruby/object:Gem::Dependency
59
95
  name: rspec
60
- requirement: &2157119220 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
61
97
  none: false
62
98
  requirements:
63
99
  - - ! '>='
@@ -65,7 +101,12 @@ dependencies:
65
101
  version: '0'
66
102
  type: :development
67
103
  prerelease: false
68
- version_requirements: *2157119220
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
69
110
  description: Rails includes several bits of custom markup (such as the new "cattr_*"
70
111
  methods). This plugin for YARD adds support for this custom markup, which otherwise
71
112
  is parsed incorrectly.
@@ -79,6 +120,7 @@ extra_rdoc_files:
79
120
  files:
80
121
  - .gemtest
81
122
  - .specopts
123
+ - .travis.yml
82
124
  - .yardopts
83
125
  - ChangeLog.md
84
126
  - Gemfile
@@ -88,10 +130,14 @@ files:
88
130
  - Rakefile
89
131
  - VERSION
90
132
  - lib/yard-rails.rb
133
+ - lib/yard-rails/attr_accessible_handler.rb
91
134
  - lib/yard-rails/class_attribute_handler.rb
135
+ - lib/yard-rails/legacy/attr_accessible_handler.rb
92
136
  - lib/yard-rails/legacy/class_attribute_handler.rb
137
+ - spec/attr_accessible_handler_spec.rb
93
138
  - spec/class_attribute_handler_spec.rb
94
139
  - spec/helpers/examples.rb
140
+ - spec/helpers/examples/attr_accessible_protected.rb.txt
95
141
  - spec/helpers/examples/simple_cattrs.rb.txt
96
142
  - spec/spec_helper.rb
97
143
  - tasks/yard.rb
@@ -109,6 +155,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
155
  - - ! '>='
110
156
  - !ruby/object:Gem::Version
111
157
  version: '0'
158
+ segments:
159
+ - 0
160
+ hash: 461217869406545283
112
161
  required_rubygems_version: !ruby/object:Gem::Requirement
113
162
  none: false
114
163
  requirements:
@@ -117,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
166
  version: '0'
118
167
  requirements: []
119
168
  rubyforge_project:
120
- rubygems_version: 1.8.10
169
+ rubygems_version: 1.8.23
121
170
  signing_key:
122
171
  specification_version: 3
123
172
  summary: A YARD plugin for parsing custom Rails syntax.