yard-rails 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
1
+ ### 0.2.0 / 2011-11-10
2
+
3
+ * Add `attr_accessible`
4
+
5
+
1
6
  ### 0.1.0 / 2011-10-02
2
7
 
3
8
  * Initial release:
@@ -8,17 +8,17 @@ GEM
8
8
  bundler (~> 1.0)
9
9
  git (>= 1.2.5)
10
10
  rake
11
- rake (0.9.2)
11
+ rake (0.9.2.2)
12
12
  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)
13
+ rspec (2.7.0)
14
+ rspec-core (~> 2.7.0)
15
+ rspec-expectations (~> 2.7.0)
16
+ rspec-mocks (~> 2.7.0)
17
+ rspec-core (2.7.1)
18
+ rspec-expectations (2.7.0)
19
19
  diff-lcs (~> 1.1.2)
20
- rspec-mocks (2.6.0)
21
- yard (0.7.2)
20
+ rspec-mocks (2.7.0)
21
+ yard (0.7.3)
22
22
 
23
23
  PLATFORMS
24
24
  ruby
data/README.md CHANGED
@@ -19,6 +19,8 @@ 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
+
22
24
  cattr_reader :attr
23
25
 
24
26
  cattr_writer :attr
@@ -31,6 +33,9 @@ Parses the following statements:
31
33
 
32
34
  mattr_accessor :attr
33
35
 
36
+ If you know of more Rails-specific DSL that should be included in this plugin,
37
+ feel free to create an issue here on GitHub, and I'll be happy to include it.
38
+
34
39
  ## Requirements
35
40
 
36
41
  * [yard](http://yardoc.org) >= 0.4.0
data/Rakefile CHANGED
@@ -22,12 +22,10 @@ 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
 
data/VERSION CHANGED
@@ -1,2 +1,2 @@
1
- 0.1.0
1
+ 0.2.0
2
2
 
@@ -0,0 +1,16 @@
1
+
2
+ module YARD
3
+ module Rails
4
+ class AttrAccessibleHandler < YARD::Handlers::Ruby::AttributeHandler
5
+ handles method_call(:attr_accessible)
6
+ namespace_only
7
+
8
+ def process
9
+ # HACK: Must set the name to attr_accessor to make the attribute
10
+ # show up as read/write.
11
+ statement[0] = YARD::Parser::Ruby::AstNode.node_class_for(:ident).new(:ident, ["attr_accessor"])
12
+ super
13
+ end
14
+ end
15
+ end
16
+ 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(?:\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
@@ -0,0 +1,38 @@
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 :simple_attr_accessible
13
+ end
14
+
15
+ it "should define reader class 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 class method for the attr_accessible method" do
20
+ yard('SimpleAttrAccessible#test_attribute=').should be_instance_of(CodeObjects::MethodObject)
21
+ end
22
+ end
23
+
24
+ describe "legacy" do
25
+ before(:all) do
26
+ parse_file :simple_attr_accessible, true
27
+ end
28
+
29
+ it "should define reader class method for the attr_accessible method" do
30
+ yard('SimpleAttrAccessible#test_attribute').should be_instance_of(CodeObjects::MethodObject)
31
+ end
32
+
33
+ it "should define writer class method for the attr_accessible method" do
34
+ yard('SimpleAttrAccessible#test_attribute=').should be_instance_of(CodeObjects::MethodObject)
35
+ end
36
+ end
37
+ end
38
+
@@ -0,0 +1,3 @@
1
+ class SimpleAttrAccessible
2
+ attr_accessible :test_attribute
3
+ end
@@ -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.2.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 = "2011-11-10"
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 = [
@@ -29,10 +29,14 @@ Gem::Specification.new do |s|
29
29
  "Rakefile",
30
30
  "VERSION",
31
31
  "lib/yard-rails.rb",
32
+ "lib/yard-rails/attr_accessible_handler.rb",
32
33
  "lib/yard-rails/class_attribute_handler.rb",
34
+ "lib/yard-rails/legacy/attr_accessible_handler.rb",
33
35
  "lib/yard-rails/legacy/class_attribute_handler.rb",
36
+ "spec/attr_accessible_handler_spec.rb",
34
37
  "spec/class_attribute_handler_spec.rb",
35
38
  "spec/helpers/examples.rb",
39
+ "spec/helpers/examples/simple_attr_accessible.rb.txt",
36
40
  "spec/helpers/examples/simple_cattrs.rb.txt",
37
41
  "spec/spec_helper.rb",
38
42
  "tasks/yard.rb",
@@ -52,12 +56,14 @@ Gem::Specification.new do |s|
52
56
  s.add_development_dependency(%q<yard>, [">= 0"])
53
57
  s.add_development_dependency(%q<rake>, [">= 0"])
54
58
  s.add_development_dependency(%q<jeweler>, [">= 0"])
59
+ s.add_development_dependency(%q<gemcutter>, [">= 0"])
55
60
  s.add_development_dependency(%q<rspec>, [">= 0"])
56
61
  else
57
62
  s.add_dependency(%q<yard>, [">= 0"])
58
63
  s.add_dependency(%q<yard>, [">= 0"])
59
64
  s.add_dependency(%q<rake>, [">= 0"])
60
65
  s.add_dependency(%q<jeweler>, [">= 0"])
66
+ s.add_dependency(%q<gemcutter>, [">= 0"])
61
67
  s.add_dependency(%q<rspec>, [">= 0"])
62
68
  end
63
69
  else
@@ -65,6 +71,7 @@ Gem::Specification.new do |s|
65
71
  s.add_dependency(%q<yard>, [">= 0"])
66
72
  s.add_dependency(%q<rake>, [">= 0"])
67
73
  s.add_dependency(%q<jeweler>, [">= 0"])
74
+ s.add_dependency(%q<gemcutter>, [">= 0"])
68
75
  s.add_dependency(%q<rspec>, [">= 0"])
69
76
  end
70
77
  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.2.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: 2011-11-10 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: yard
16
- requirement: &2157121280 !ruby/object:Gem::Requirement
16
+ requirement: &2156843180 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2157121280
24
+ version_requirements: *2156843180
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: yard
27
- requirement: &2157120780 !ruby/object:Gem::Requirement
27
+ requirement: &2156840860 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2157120780
35
+ version_requirements: *2156840860
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &2157120280 !ruby/object:Gem::Requirement
38
+ requirement: &2156839640 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2157120280
46
+ version_requirements: *2156839640
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &2157119740 !ruby/object:Gem::Requirement
49
+ requirement: &2156838160 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,21 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2157119740
57
+ version_requirements: *2156838160
58
+ - !ruby/object:Gem::Dependency
59
+ name: gemcutter
60
+ requirement: &2156836540 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *2156836540
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: rspec
60
- requirement: &2157119220 !ruby/object:Gem::Requirement
71
+ requirement: &2156833120 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
74
  - - ! '>='
@@ -65,7 +76,7 @@ dependencies:
65
76
  version: '0'
66
77
  type: :development
67
78
  prerelease: false
68
- version_requirements: *2157119220
79
+ version_requirements: *2156833120
69
80
  description: Rails includes several bits of custom markup (such as the new "cattr_*"
70
81
  methods). This plugin for YARD adds support for this custom markup, which otherwise
71
82
  is parsed incorrectly.
@@ -88,10 +99,14 @@ files:
88
99
  - Rakefile
89
100
  - VERSION
90
101
  - lib/yard-rails.rb
102
+ - lib/yard-rails/attr_accessible_handler.rb
91
103
  - lib/yard-rails/class_attribute_handler.rb
104
+ - lib/yard-rails/legacy/attr_accessible_handler.rb
92
105
  - lib/yard-rails/legacy/class_attribute_handler.rb
106
+ - spec/attr_accessible_handler_spec.rb
93
107
  - spec/class_attribute_handler_spec.rb
94
108
  - spec/helpers/examples.rb
109
+ - spec/helpers/examples/simple_attr_accessible.rb.txt
95
110
  - spec/helpers/examples/simple_cattrs.rb.txt
96
111
  - spec/spec_helper.rb
97
112
  - tasks/yard.rb
@@ -109,6 +124,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
124
  - - ! '>='
110
125
  - !ruby/object:Gem::Version
111
126
  version: '0'
127
+ segments:
128
+ - 0
129
+ hash: 1741283832477433922
112
130
  required_rubygems_version: !ruby/object:Gem::Requirement
113
131
  none: false
114
132
  requirements: