yard-dm 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.rdoc +8 -0
- data/Manifest.txt +23 -0
- data/README.rdoc +51 -0
- data/Rakefile +28 -0
- data/lib/yard-dm.rb +6 -0
- data/lib/yard-dm/belongs_to_handler.rb +43 -0
- data/lib/yard-dm/extensions.rb +23 -0
- data/lib/yard-dm/has_handler.rb +56 -0
- data/lib/yard-dm/legacy/belongs_to_handler.rb +37 -0
- data/lib/yard-dm/legacy/has_handler.rb +37 -0
- data/lib/yard-dm/legacy/property_handler.rb +37 -0
- data/lib/yard-dm/property_handler.rb +43 -0
- data/spec/belongs_to_handler_spec.rb +25 -0
- data/spec/has_handler_spec.rb +99 -0
- data/spec/helpers/examples.rb +18 -0
- data/spec/helpers/examples/has_n.rb.txt +9 -0
- data/spec/helpers/examples/has_one.rb.txt +9 -0
- data/spec/helpers/examples/has_zero.rb.txt +9 -0
- data/spec/helpers/examples/simple_belongs_to.rb.txt +9 -0
- data/spec/helpers/examples/simple_properties.rb.txt +11 -0
- data/spec/property_handler_spec.rb +28 -0
- data/spec/spec_helper.rb +8 -0
- data/tasks/yard.rb +11 -0
- metadata +153 -0
- metadata.gz.sig +3 -0
data.tar.gz.sig
ADDED
Binary file
|
data/History.rdoc
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
=== 0.1.0 / 2010-01-13
|
2
|
+
|
3
|
+
* Initial release:
|
4
|
+
* Parses +property+ statements.
|
5
|
+
* Parses +has+ +n+, +1+, <tt>0..n</tt> and <tt>1..n</tt> statements.
|
6
|
+
* Parses +belongs_to+ statements.
|
7
|
+
* All specs pass on Ruby 1.8.7-p174 and Ruby 1.9.1-p26041 using YARD 0.5.3.
|
8
|
+
|
data/Manifest.txt
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
History.rdoc
|
2
|
+
Manifest.txt
|
3
|
+
README.rdoc
|
4
|
+
Rakefile
|
5
|
+
lib/yard-dm.rb
|
6
|
+
lib/yard-dm/extensions.rb
|
7
|
+
lib/yard-dm/property_handler.rb
|
8
|
+
lib/yard-dm/has_handler.rb
|
9
|
+
lib/yard-dm/belongs_to_handler.rb
|
10
|
+
lib/yard-dm/legacy/property_handler.rb
|
11
|
+
lib/yard-dm/legacy/has_handler.rb
|
12
|
+
lib/yard-dm/legacy/belongs_to_handler.rb
|
13
|
+
tasks/yard.rb
|
14
|
+
spec/spec_helper.rb
|
15
|
+
spec/helpers/examples.rb
|
16
|
+
spec/helpers/examples/simple_properties.rb.txt
|
17
|
+
spec/helpers/examples/simple_belongs_to.rb.txt
|
18
|
+
spec/helpers/examples/has_n.rb.txt
|
19
|
+
spec/helpers/examples/has_zero.rb.txt
|
20
|
+
spec/helpers/examples/has_one.rb.txt
|
21
|
+
spec/property_handler_spec.rb
|
22
|
+
spec/belongs_to_handler_spec.rb
|
23
|
+
spec/has_handler_spec.rb
|
data/README.rdoc
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
= yard-dm
|
2
|
+
|
3
|
+
* http://github.com/postmodern/yard-dm
|
4
|
+
* http://github.com/postmodern/yard-dm/issues
|
5
|
+
* Postmodern (postmodern.mod3 at gmail.com)
|
6
|
+
|
7
|
+
== DESCRIPTION:
|
8
|
+
|
9
|
+
A YARD plugin for parsing DataMapper syntax.
|
10
|
+
|
11
|
+
Once yard-dm is installed, YARD will automatically load the plugin when ever
|
12
|
+
the +yardoc+ utility is ran on a project.
|
13
|
+
|
14
|
+
== FEATURES:
|
15
|
+
|
16
|
+
* Parses +property+ statements.
|
17
|
+
* Parses +has+ +n+, +1+, <tt>0..n</tt> and <tt>1..n</tt> statements.
|
18
|
+
* Parses +belongs_to+ statements.
|
19
|
+
|
20
|
+
== REQUIREMENTS:
|
21
|
+
|
22
|
+
* {yard}[http://yardoc.org/] >= 0.4.0
|
23
|
+
|
24
|
+
== INSTALL:
|
25
|
+
|
26
|
+
$ sudo gem install yard-dm
|
27
|
+
|
28
|
+
== LICENSE:
|
29
|
+
|
30
|
+
(The MIT License)
|
31
|
+
|
32
|
+
Copyright (c) 2010 Hal Brodigan
|
33
|
+
|
34
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
35
|
+
a copy of this software and associated documentation files (the
|
36
|
+
'Software'), to deal in the Software without restriction, including
|
37
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
38
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
39
|
+
permit persons to whom the Software is furnished to do so, subject to
|
40
|
+
the following conditions:
|
41
|
+
|
42
|
+
The above copyright notice and this permission notice shall be
|
43
|
+
included in all copies or substantial portions of the Software.
|
44
|
+
|
45
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
46
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
47
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
48
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
49
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
50
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
51
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
require 'hoe/signing'
|
6
|
+
require './tasks/yard.rb'
|
7
|
+
|
8
|
+
Hoe.spec('yard-dm') do
|
9
|
+
self.version = '0.1.0'
|
10
|
+
self.developer('Postmodern', 'postmodern.mod3@gmail.com')
|
11
|
+
|
12
|
+
self.readme_file = 'README.rdoc'
|
13
|
+
self.history_file = 'History.rdoc'
|
14
|
+
|
15
|
+
self.rspec_options += ['--colour', '--format', 'specdoc']
|
16
|
+
|
17
|
+
self.extra_deps += [
|
18
|
+
['yard', '>=0.4.0']
|
19
|
+
]
|
20
|
+
|
21
|
+
self.extra_dev_deps += [
|
22
|
+
['rspec', '>=1.2.9']
|
23
|
+
]
|
24
|
+
|
25
|
+
self.spec_extras.merge!(:has_rdoc => 'yard')
|
26
|
+
end
|
27
|
+
|
28
|
+
# vim: syntax=ruby
|
data/lib/yard-dm.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'yard-dm/extensions'
|
2
|
+
|
3
|
+
module YARD
|
4
|
+
module DM
|
5
|
+
class BelongsToHandler < YARD::Handlers::Ruby::Base
|
6
|
+
|
7
|
+
include Extensions
|
8
|
+
|
9
|
+
handles method_call(:belongs_to)
|
10
|
+
|
11
|
+
def process
|
12
|
+
nobj = effected_namespace
|
13
|
+
mscope = scope
|
14
|
+
name = statement.parameters[0].last
|
15
|
+
|
16
|
+
if name.type == :symbol
|
17
|
+
name = name.source[1..-1]
|
18
|
+
|
19
|
+
register MethodObject.new(nobj, name, :class) do |o|
|
20
|
+
o.visibility = :public
|
21
|
+
o.source = statement.source
|
22
|
+
o.signature = "def self.#{name}"
|
23
|
+
o.parameters = [['repository', 'nil']]
|
24
|
+
end
|
25
|
+
|
26
|
+
register MethodObject.new(nobj, name, mscope) do |o|
|
27
|
+
o.visibility = :public
|
28
|
+
o.source = statement.source
|
29
|
+
o.signature = "def #{name}"
|
30
|
+
end
|
31
|
+
|
32
|
+
register MethodObject.new(nobj, "#{name}=", mscope) do |o|
|
33
|
+
o.visibility = :public
|
34
|
+
o.source = statement.source
|
35
|
+
o.signature = "def #{name}=(resource)"
|
36
|
+
o.parameters = [['resource', nil]]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module YARD
|
2
|
+
module DM
|
3
|
+
module Extensions
|
4
|
+
|
5
|
+
protected
|
6
|
+
|
7
|
+
def effected_namespace
|
8
|
+
if statement.type == :command_call
|
9
|
+
context = statement.jump(:var_ref)
|
10
|
+
|
11
|
+
unless context.source == 'self'
|
12
|
+
return ensure_loaded!(
|
13
|
+
Registry.resolve(namespace,context.source)
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
return namespace
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'yard-dm/extensions'
|
2
|
+
|
3
|
+
module YARD
|
4
|
+
module DM
|
5
|
+
class HasHandler < YARD::Handlers::Ruby::Base
|
6
|
+
|
7
|
+
include Extensions
|
8
|
+
|
9
|
+
handles method_call(:has)
|
10
|
+
|
11
|
+
def process
|
12
|
+
args = statement.parameters
|
13
|
+
n = args[0]
|
14
|
+
name = args[1].last
|
15
|
+
|
16
|
+
return unless name.type == :symbol
|
17
|
+
|
18
|
+
return unless (
|
19
|
+
(n.type == :int && n.source =~ /^[1-9]\d*$/) ||
|
20
|
+
(n.type == :var_ref && n.source == 'n') ||
|
21
|
+
(n.type == :dot2 && (
|
22
|
+
(n[0].type == :int && n[0].source =~ /^[0-9]\d*$/) || (
|
23
|
+
(n[1].type == :int && n[1].source =~ /^[1-9]\d*$/) ||
|
24
|
+
(n[1].type == :var_ref && n[1].source == 'n')
|
25
|
+
)
|
26
|
+
))
|
27
|
+
)
|
28
|
+
|
29
|
+
nobj = effected_namespace
|
30
|
+
mscope = scope
|
31
|
+
name = name.source[1..-1]
|
32
|
+
|
33
|
+
register MethodObject.new(nobj, name, :class) do |o|
|
34
|
+
o.visibility = :public
|
35
|
+
o.source = statement.source
|
36
|
+
o.signature = "def self.#{name}"
|
37
|
+
o.parameters = [['repository', 'nil']]
|
38
|
+
end
|
39
|
+
|
40
|
+
register MethodObject.new(nobj, name, mscope) do |o|
|
41
|
+
o.visibility = :public
|
42
|
+
o.source = statement.source
|
43
|
+
o.signature = "def #{name}"
|
44
|
+
end
|
45
|
+
|
46
|
+
register MethodObject.new(nobj, "#{name}=", mscope) do |o|
|
47
|
+
o.visibility = :public
|
48
|
+
o.source = statement.source
|
49
|
+
o.signature = "def #{name}="
|
50
|
+
o.parameters = [["new_#{name}", nil]]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module YARD
|
2
|
+
module DM
|
3
|
+
module Legacy
|
4
|
+
class BelongsToHandler < YARD::Handlers::Ruby::Legacy::Base
|
5
|
+
|
6
|
+
handles /\Abelongs_to\s/
|
7
|
+
|
8
|
+
def process
|
9
|
+
nobj = namespace
|
10
|
+
mscope = scope
|
11
|
+
name = statement.tokens[2,1].to_s[1..-1]
|
12
|
+
|
13
|
+
register MethodObject.new(nobj, name, :class) do |o|
|
14
|
+
o.visibility = :public
|
15
|
+
o.source = statement.source
|
16
|
+
o.signature = "def self.#{name}"
|
17
|
+
o.parameters = [['repository', 'nil']]
|
18
|
+
end
|
19
|
+
|
20
|
+
register MethodObject.new(nobj, name, mscope) do |o|
|
21
|
+
o.visibility = :public
|
22
|
+
o.source = statement.source
|
23
|
+
o.signature = "def #{name}"
|
24
|
+
end
|
25
|
+
|
26
|
+
register MethodObject.new(nobj, "#{name}=", mscope) do |o|
|
27
|
+
o.visibility = :public
|
28
|
+
o.source = statement.source
|
29
|
+
o.signature = "def #{name}=(resource)"
|
30
|
+
o.parameters = [['resource', nil]]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module YARD
|
2
|
+
module DM
|
3
|
+
module Legacy
|
4
|
+
class HasHandler < YARD::Handlers::Ruby::Legacy::Base
|
5
|
+
|
6
|
+
handles /\Ahas\s+([1-9]\d*|n|(0|1)\.\.n),\s/
|
7
|
+
|
8
|
+
def process
|
9
|
+
nobj = namespace
|
10
|
+
mscope = scope
|
11
|
+
name = statement.tokens[2..-1].to_s[/:[^,]+/][1..-1]
|
12
|
+
|
13
|
+
register MethodObject.new(nobj, name, :class) do |o|
|
14
|
+
o.visibility = :public
|
15
|
+
o.source = statement.source
|
16
|
+
o.signature = "def self.#{name}"
|
17
|
+
o.parameters = [['repository', 'nil']]
|
18
|
+
end
|
19
|
+
|
20
|
+
register MethodObject.new(nobj, name, mscope) do |o|
|
21
|
+
o.visibility = :public
|
22
|
+
o.source = statement.source
|
23
|
+
o.signature = "def #{name}"
|
24
|
+
end
|
25
|
+
|
26
|
+
register MethodObject.new(nobj, "#{name}=", mscope) do |o|
|
27
|
+
o.visibility = :public
|
28
|
+
o.source = statement.source
|
29
|
+
o.signature = "def #{name}="
|
30
|
+
o.parameters = [["new_#{name}", nil]]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module YARD
|
2
|
+
module DM
|
3
|
+
module Legacy
|
4
|
+
class PropertyHandler < YARD::Handlers::Ruby::Legacy::Base
|
5
|
+
|
6
|
+
handles /\Aproperty\s/
|
7
|
+
|
8
|
+
def process
|
9
|
+
nobj = namespace
|
10
|
+
mscope = scope
|
11
|
+
name = statement.tokens[2,1].to_s[1..-1]
|
12
|
+
|
13
|
+
register MethodObject.new(nobj, name, :class) do |o|
|
14
|
+
o.visibility = :public
|
15
|
+
o.source = statement.source
|
16
|
+
o.signature = "def #{nobj}.#{name}(repository=nil)"
|
17
|
+
o.parameters = [['repository', 'nil']]
|
18
|
+
end
|
19
|
+
|
20
|
+
register MethodObject.new(nobj, name, mscope) do |o|
|
21
|
+
o.visibility = :public
|
22
|
+
o.source = statement.source
|
23
|
+
o.signature = "def #{name}"
|
24
|
+
end
|
25
|
+
|
26
|
+
register MethodObject.new(nobj, "#{name}=", mscope) do |o|
|
27
|
+
o.visibility = :public
|
28
|
+
o.source = statement.source
|
29
|
+
o.signature = "def #{name}=(value)"
|
30
|
+
o.parameters = [['value', nil]]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'yard-dm/extensions'
|
2
|
+
|
3
|
+
module YARD
|
4
|
+
module DM
|
5
|
+
class PropertyHandler < YARD::Handlers::Ruby::Base
|
6
|
+
|
7
|
+
include Extensions
|
8
|
+
|
9
|
+
handles method_call(:property)
|
10
|
+
|
11
|
+
def process
|
12
|
+
nobj = effected_namespace
|
13
|
+
mscope = scope
|
14
|
+
name = statement.parameters[0].last
|
15
|
+
|
16
|
+
if name.type == :symbol
|
17
|
+
name = name.source[1..-1]
|
18
|
+
|
19
|
+
register MethodObject.new(nobj, name, :class) do |o|
|
20
|
+
o.visibility = :public
|
21
|
+
o.source = statement.source
|
22
|
+
o.signature = "def #{nobj}.#{name}(repository=nil)"
|
23
|
+
o.parameters = [['repository', 'nil']]
|
24
|
+
end
|
25
|
+
|
26
|
+
register MethodObject.new(nobj, name, mscope) do |o|
|
27
|
+
o.visibility = :public
|
28
|
+
o.source = statement.source
|
29
|
+
o.signature = "def #{name}"
|
30
|
+
end
|
31
|
+
|
32
|
+
register MethodObject.new(nobj, "#{name}=", mscope) do |o|
|
33
|
+
o.visibility = :public
|
34
|
+
o.source = statement.source
|
35
|
+
o.signature = "def #{name}=(value)"
|
36
|
+
o.parameters = [['value', nil]]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'helpers/examples'
|
3
|
+
|
4
|
+
require 'yard-dm/belongs_to_handler'
|
5
|
+
require 'yard-dm/legacy/belongs_to_handler'
|
6
|
+
|
7
|
+
describe "BelongsToHandler" do
|
8
|
+
include Helpers::Examples
|
9
|
+
|
10
|
+
before(:all) do
|
11
|
+
parse_file :simple_belongs_to
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should define class-methods for the belongs_to relationships" do
|
15
|
+
yard('SimpleBelongsTo.author').should be_instance_of(CodeObjects::MethodObject)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should define reader methods for the belongs_to relationships" do
|
19
|
+
yard('SimpleBelongsTo#author').should be_instance_of(CodeObjects::MethodObject)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should define writer methods for the belongs_to relationships" do
|
23
|
+
yard('SimpleBelongsTo#author=').should be_instance_of(CodeObjects::MethodObject)
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'helpers/examples'
|
3
|
+
|
4
|
+
require 'yard-dm/has_handler'
|
5
|
+
require 'yard-dm/legacy/has_handler'
|
6
|
+
|
7
|
+
describe "HasHandler" do
|
8
|
+
include Helpers::Examples
|
9
|
+
|
10
|
+
describe "has n" do
|
11
|
+
before(:all) do
|
12
|
+
parse_file :has_n
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should define class-methods for the 'has n' relationships" do
|
16
|
+
yard('HasN.things').should be_instance_of(CodeObjects::MethodObject)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should define reader methods for the 'has n' relationships" do
|
20
|
+
yard('HasN#things').should be_instance_of(CodeObjects::MethodObject)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should define writer methods for the 'has n' relationships" do
|
24
|
+
yard('HasN#things=').should be_instance_of(CodeObjects::MethodObject)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "has 0" do
|
29
|
+
before(:all) do
|
30
|
+
parse_file :has_zero
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should not define class-methods for the 'has 0' relationships" do
|
34
|
+
yard('HasZero.things').should be_nil
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should not define reader methods for the 'has 0' relationships" do
|
38
|
+
yard('HasZero#things').should be_nil
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should not define writer methods for the 'has 0' relationships" do
|
42
|
+
yard('HasZero#things=').should be_nil
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "has 1" do
|
47
|
+
before(:all) do
|
48
|
+
parse_file :has_one
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should define class-methods for the 'has 1' relationships" do
|
52
|
+
yard('HasOne.things').should be_instance_of(CodeObjects::MethodObject)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should define reader methods for the 'has 1' relationships" do
|
56
|
+
yard('HasOne#things').should be_instance_of(CodeObjects::MethodObject)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should define writer methods for the 'has 1' relationships" do
|
60
|
+
yard('HasOne#things=').should be_instance_of(CodeObjects::MethodObject)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "has 0..n" do
|
65
|
+
before(:all) do
|
66
|
+
parse_file :has_zero_to_n
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should define class-methods for the 'has 0..n' relationships" do
|
70
|
+
yard('HasZeroToN.things').should be_instance_of(CodeObjects::MethodObject)
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should define reader methods for the 'has 0..n' relationships" do
|
74
|
+
yard('HasZeroToN#things').should be_instance_of(CodeObjects::MethodObject)
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should define writer methods for the 'has 0..n' relationships" do
|
78
|
+
yard('HasZeroToN#things=').should be_instance_of(CodeObjects::MethodObject)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "has 1..n" do
|
83
|
+
before(:all) do
|
84
|
+
parse_file :has_one_to_n
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should define class-methods for the 'has 1..n' relationships" do
|
88
|
+
yard('HasOneToN.things').should be_instance_of(CodeObjects::MethodObject)
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should define reader methods for the 'has 1..n' relationships" do
|
92
|
+
yard('HasOneToN#things').should be_instance_of(CodeObjects::MethodObject)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should define writer methods for the 'has 1..n' relationships" do
|
96
|
+
yard('HasOneToN#things=').should be_instance_of(CodeObjects::MethodObject)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'yard'
|
2
|
+
|
3
|
+
module Helpers
|
4
|
+
module Examples
|
5
|
+
EXAMPLES_DIR = File.expand_path(File.join(File.dirname(__FILE__),'examples'))
|
6
|
+
|
7
|
+
def parse_file(file, thisfile = __FILE__)
|
8
|
+
YARD::Registry.clear
|
9
|
+
|
10
|
+
path = File.join(Helpers::Examples::EXAMPLES_DIR, "#{file}.rb.txt")
|
11
|
+
YARD::Parser::SourceParser.parse(path)
|
12
|
+
end
|
13
|
+
|
14
|
+
def yard(name)
|
15
|
+
YARD::Registry.at(name)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'helpers/examples'
|
3
|
+
|
4
|
+
require 'yard-dm/property_handler'
|
5
|
+
require 'yard-dm/legacy/property_handler'
|
6
|
+
|
7
|
+
describe "PropertyHandler" do
|
8
|
+
include Helpers::Examples
|
9
|
+
|
10
|
+
before(:all) do
|
11
|
+
parse_file :simple_properties
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should define class methods for the properties" do
|
15
|
+
yard('SimpleProperties.id').should be_instance_of(CodeObjects::MethodObject)
|
16
|
+
yard('SimpleProperties.name').should be_instance_of(CodeObjects::MethodObject)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should define reader methods for the properties" do
|
20
|
+
yard('SimpleProperties#id').should be_instance_of(CodeObjects::MethodObject)
|
21
|
+
yard('SimpleProperties#name').should be_instance_of(CodeObjects::MethodObject)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should define writer methods for the properties" do
|
25
|
+
yard('SimpleProperties#id=').should be_instance_of(CodeObjects::MethodObject)
|
26
|
+
yard('SimpleProperties#name=').should be_instance_of(CodeObjects::MethodObject)
|
27
|
+
end
|
28
|
+
end
|
data/spec/spec_helper.rb
ADDED
data/tasks/yard.rb
ADDED
metadata
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yard-dm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Postmodern
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDQDCCAiigAwIBAgIBADANBgkqhkiG9w0BAQUFADBGMRgwFgYDVQQDDA9wb3N0
|
14
|
+
bW9kZXJuLm1vZDMxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixk
|
15
|
+
ARkWA2NvbTAeFw0wOTA2MDMwNDU5MDNaFw0xMDA2MDMwNDU5MDNaMEYxGDAWBgNV
|
16
|
+
BAMMD3Bvc3Rtb2Rlcm4ubW9kMzEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYK
|
17
|
+
CZImiZPyLGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
|
18
|
+
1wvANkTDHFgVih5XLjuTwTZjgBq1lBGybXJiH6Id1lY2JOMqM5FB1DDHVvvij94i
|
19
|
+
mJabN0zkzu6VKWC70y0IwOxY7CPokr0eFdK/D0y7mCq1P8QITv76i2YqAl0eYqIt
|
20
|
+
W+IhIkANQ7E6uMZIZcdnfadC6lPAtlKkqtd9crvRbFgr6e3kyflmohbRnTEJHoRd
|
21
|
+
7SHHsybE6DSn7oTDs6XBTNrNIn5VfZA0z01eeos/+zBm1zKJOK2+/7xtLLDuDU9G
|
22
|
+
+Rd+ltUBbvxUrMNZmDG29pnmN2xTRH+Q8HxD2AxlvM5SRpK6OeZaHV7PaCCAVZ4L
|
23
|
+
T9BFl1sfMvRlABeGEkSyuQIDAQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIE
|
24
|
+
sDAdBgNVHQ4EFgQUKwsd+PqEYmBvyaTyoL+uRuk+PhEwDQYJKoZIhvcNAQEFBQAD
|
25
|
+
ggEBAB4TvHsrlbcXcKg6gX5BIb9tI+zGkpzo0Z7jnxMEcNO7NGGwmzafDBI/xZYv
|
26
|
+
xkRH3/HXbGGYDOi6Q6gWt5GujSx0bOImDtYTJTH8jnzN92HzEK5WdScm1QpZKF1e
|
27
|
+
cezArMbxbSPaosxTCtG6LQTkE28lFQsmFZ5xzouugS4h5+LVJiVMmiP+l3EfkjFa
|
28
|
+
GOURU+rNEMPWo8MCWivGW7jes6BMzWHcW7DQ0scNVmIcCIgdyMmpscuAEOSeghy9
|
29
|
+
/fFs57Ey2OXBL55nDOyvN/ZQ2Vab05UH4t+GCxjAPeirzL/29FBtePT6VD44c38j
|
30
|
+
pDj+ws7QjtH/Qcrr1l9jfN0ehDs=
|
31
|
+
-----END CERTIFICATE-----
|
32
|
+
|
33
|
+
date: 2010-01-13 00:00:00 -08:00
|
34
|
+
default_executable:
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: yard
|
38
|
+
type: :runtime
|
39
|
+
version_requirement:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 0.4.0
|
45
|
+
version:
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rubyforge
|
48
|
+
type: :development
|
49
|
+
version_requirement:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.0.3
|
55
|
+
version:
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: gemcutter
|
58
|
+
type: :development
|
59
|
+
version_requirement:
|
60
|
+
version_requirements: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 0.3.0
|
65
|
+
version:
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
name: rspec
|
68
|
+
type: :development
|
69
|
+
version_requirement:
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 1.2.9
|
75
|
+
version:
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: hoe
|
78
|
+
type: :development
|
79
|
+
version_requirement:
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 2.5.0
|
85
|
+
version:
|
86
|
+
description: |-
|
87
|
+
A YARD plugin for parsing DataMapper syntax.
|
88
|
+
|
89
|
+
Once yard-dm is installed, YARD will automatically load the plugin when ever
|
90
|
+
the +yardoc+ utility is ran on a project.
|
91
|
+
email:
|
92
|
+
- postmodern.mod3@gmail.com
|
93
|
+
executables: []
|
94
|
+
|
95
|
+
extensions: []
|
96
|
+
|
97
|
+
extra_rdoc_files:
|
98
|
+
- Manifest.txt
|
99
|
+
files:
|
100
|
+
- History.rdoc
|
101
|
+
- Manifest.txt
|
102
|
+
- README.rdoc
|
103
|
+
- Rakefile
|
104
|
+
- lib/yard-dm.rb
|
105
|
+
- lib/yard-dm/extensions.rb
|
106
|
+
- lib/yard-dm/property_handler.rb
|
107
|
+
- lib/yard-dm/has_handler.rb
|
108
|
+
- lib/yard-dm/belongs_to_handler.rb
|
109
|
+
- lib/yard-dm/legacy/property_handler.rb
|
110
|
+
- lib/yard-dm/legacy/has_handler.rb
|
111
|
+
- lib/yard-dm/legacy/belongs_to_handler.rb
|
112
|
+
- tasks/yard.rb
|
113
|
+
- spec/spec_helper.rb
|
114
|
+
- spec/helpers/examples.rb
|
115
|
+
- spec/helpers/examples/simple_properties.rb.txt
|
116
|
+
- spec/helpers/examples/simple_belongs_to.rb.txt
|
117
|
+
- spec/helpers/examples/has_n.rb.txt
|
118
|
+
- spec/helpers/examples/has_zero.rb.txt
|
119
|
+
- spec/helpers/examples/has_one.rb.txt
|
120
|
+
- spec/property_handler_spec.rb
|
121
|
+
- spec/belongs_to_handler_spec.rb
|
122
|
+
- spec/has_handler_spec.rb
|
123
|
+
has_rdoc: yard
|
124
|
+
homepage: http://github.com/postmodern/yard-dm
|
125
|
+
licenses: []
|
126
|
+
|
127
|
+
post_install_message:
|
128
|
+
rdoc_options:
|
129
|
+
- --main
|
130
|
+
- README.rdoc
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: "0"
|
138
|
+
version:
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: "0"
|
144
|
+
version:
|
145
|
+
requirements: []
|
146
|
+
|
147
|
+
rubyforge_project: yard-dm
|
148
|
+
rubygems_version: 1.3.5
|
149
|
+
signing_key:
|
150
|
+
specification_version: 3
|
151
|
+
summary: A YARD plugin for parsing DataMapper syntax
|
152
|
+
test_files: []
|
153
|
+
|
metadata.gz.sig
ADDED