dm-predefined 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -0
- data/.specopts +1 -0
- data/.yardopts +1 -0
- data/ChangeLog.md +29 -0
- data/{README.rdoc → LICENSE.txt} +0 -53
- data/README.md +57 -0
- data/Rakefile +36 -20
- data/dm-predefined.gemspec +68 -0
- data/lib/dm-predefined/predefined.rb +37 -2
- data/lib/dm-predefined/version.rb +1 -1
- data/spec/integration/predefined_spec.rb +43 -9
- metadata +55 -100
- data/History.rdoc +0 -18
- data/Manifest.txt +0 -17
- data/lib/dm-predefined/yard/handlers/ruby/legacy/predefine_handler.rb +0 -26
- data/lib/dm-predefined/yard/handlers/ruby/legacy.rb +0 -1
- data/lib/dm-predefined/yard/handlers/ruby/predefine_handler.rb +0 -35
- data/lib/dm-predefined/yard/handlers/ruby.rb +0 -2
- data/lib/dm-predefined/yard/handlers.rb +0 -1
- data/lib/dm-predefined/yard.rb +0 -1
- data.tar.gz.sig +0 -2
- metadata.gz.sig +0 -0
data/.gitignore
ADDED
data/.specopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour --format specdoc
|
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--markup markdown --title 'dm-predefined Documentation' --protected --files ChangeLog.md,LICENSE.txt
|
data/ChangeLog.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
### 0.2.2 / 2010-03-20
|
2
|
+
|
3
|
+
* Switched to Jeweler for the building and releasing of RubyGems.
|
4
|
+
* Split `dm-predefined/yard` out into the `yard-dm-predefined` library.
|
5
|
+
* Require dm-core >= 0.10.2.
|
6
|
+
* Renamed `DataMapper::Predefined::ClassMethods#[]` to
|
7
|
+
{DataMapper::Predefined::ClassMethods#predefined_resource}.
|
8
|
+
* Added {DataMapper::Predefined::ClassMethods#predefined_names}.
|
9
|
+
* Added {DataMapper::Predefined::ClassMethods#predefined_resource_with}.
|
10
|
+
* Added more specs.
|
11
|
+
|
12
|
+
### 0.2.0 / 2009-09-21
|
13
|
+
|
14
|
+
* Require Hoe >= 2.3.3.
|
15
|
+
* Require YARD >= 0.2.3.5.
|
16
|
+
* Require dm-core >= 0.10.0.
|
17
|
+
* Moved to YARD based documentation.
|
18
|
+
* Added YARD handlers for documenting +predefine+ method-calls.
|
19
|
+
* Renamed Predefined.predefined to Predefined.predefine.
|
20
|
+
|
21
|
+
### 0.1.1 / 2009-01-17
|
22
|
+
|
23
|
+
* Fixed specs to work with RSpec 1.1.12.
|
24
|
+
* All specs pass in Ruby 1.9.1-rc1.
|
25
|
+
|
26
|
+
### 0.1.0 / 2008-12-21
|
27
|
+
|
28
|
+
* Initial release.
|
29
|
+
|
data/{README.rdoc → LICENSE.txt}
RENAMED
@@ -1,56 +1,3 @@
|
|
1
|
-
= dm-predefined
|
2
|
-
|
3
|
-
* http://dm-predefined.rubyforge.org/
|
4
|
-
* http://github.com/postmodern/dm-predefined
|
5
|
-
* Postmodern (postmodern.mod3 at gmail.com)
|
6
|
-
|
7
|
-
== DESCRIPTION:
|
8
|
-
|
9
|
-
A DataMapper plugin for adding predefined resources to Models.
|
10
|
-
|
11
|
-
== EXAMPLES:
|
12
|
-
|
13
|
-
require 'dm-core'
|
14
|
-
require 'dm-predefined'
|
15
|
-
|
16
|
-
class Licence
|
17
|
-
|
18
|
-
include DataMapper::Resource
|
19
|
-
include DataMapper::Predefined
|
20
|
-
|
21
|
-
# Name of the Licence
|
22
|
-
property :name, String
|
23
|
-
|
24
|
-
# URL to the licence
|
25
|
-
property :url, String
|
26
|
-
|
27
|
-
predefine :gpl2,
|
28
|
-
:name => 'GPL-2',
|
29
|
-
:url => 'http://www.gnu.org/copyleft/gpl.html'
|
30
|
-
|
31
|
-
predefine :mit, :name => 'MIT'
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
Licence.gpl2
|
36
|
-
# => #<Licence: id: 1, name: "GPL-2", url: "http://www.gnu.org/copyleft/gpl.html">
|
37
|
-
|
38
|
-
Licence.predefined_resource(:mit)
|
39
|
-
# => #<Licence: id: 2, name: "MIT">
|
40
|
-
|
41
|
-
License.predefined_names
|
42
|
-
# => [:gpl2, :mit]
|
43
|
-
|
44
|
-
== REQUIREMENTS:
|
45
|
-
|
46
|
-
* {dm-core}[http://github.com/datamapper/dm-core/] >= 0.10.2
|
47
|
-
|
48
|
-
== INSTALL:
|
49
|
-
|
50
|
-
$ sudo gem install dm-predefined
|
51
|
-
|
52
|
-
== LICENSE:
|
53
|
-
|
54
1
|
(The MIT License)
|
55
2
|
|
56
3
|
Copyright (c) 2008-2010 Hal Brodigan
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# dm-predefined
|
2
|
+
|
3
|
+
* [github.com/postmodern/dm-predefined](http://github.com/postmodern/dm-predefined)
|
4
|
+
* Postmodern (postmodern.mod3 at gmail.com)
|
5
|
+
|
6
|
+
## Description
|
7
|
+
|
8
|
+
A DataMapper plugin for adding predefined resources to Models.
|
9
|
+
|
10
|
+
## Example
|
11
|
+
|
12
|
+
require 'dm-core'
|
13
|
+
require 'dm-predefined'
|
14
|
+
|
15
|
+
class Licence
|
16
|
+
|
17
|
+
include DataMapper::Resource
|
18
|
+
include DataMapper::Predefined
|
19
|
+
|
20
|
+
# Name of the Licence
|
21
|
+
property :name, String
|
22
|
+
|
23
|
+
# URL to the licence
|
24
|
+
property :url, String
|
25
|
+
|
26
|
+
predefine :gpl2,
|
27
|
+
:name => 'GPL-2',
|
28
|
+
:url => 'http://www.gnu.org/copyleft/gpl.html'
|
29
|
+
|
30
|
+
predefine :mit, :name => 'MIT'
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
Licence.gpl2
|
35
|
+
# => #<Licence: id: 1, name: "GPL-2", url: "http://www.gnu.org/copyleft/gpl.html">
|
36
|
+
|
37
|
+
Licence.predefined_resource(:mit)
|
38
|
+
# => #<Licence: id: 2, name: "MIT">
|
39
|
+
|
40
|
+
License.predefined_resource_with(:name => 'GPL-2')
|
41
|
+
# => #<License: id: 1, name: "GPL-2", url: "http://www.gnu.org/copyleft/gpl.html">
|
42
|
+
|
43
|
+
License.predefined_names
|
44
|
+
# => [:gpl2, :mit]
|
45
|
+
|
46
|
+
## Requirements
|
47
|
+
|
48
|
+
* [dm-core](http://github.com/datamapper/dm-core/) >= 0.10.2
|
49
|
+
|
50
|
+
## Install
|
51
|
+
|
52
|
+
$ sudo gem install dm-predefined
|
53
|
+
|
54
|
+
## License
|
55
|
+
|
56
|
+
See {file:LICENSE.txt} for license information.
|
57
|
+
|
data/Rakefile
CHANGED
@@ -1,26 +1,42 @@
|
|
1
|
-
# -*- ruby -*-
|
2
|
-
|
3
1
|
require 'rubygems'
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
require 'rake'
|
3
|
+
require './lib/dm-predefined/version.rb'
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'jeweler'
|
7
|
+
Jeweler::Tasks.new do |gem|
|
8
|
+
gem.name = 'dm-predefined'
|
9
|
+
gem.version = DataMapper::Predefined::VERSION
|
10
|
+
gem.summary = %Q{A DataMapper plugin for adding predefined resources to Models.}
|
11
|
+
gem.description = %Q{A DataMapper plugin for adding predefined resources to Models.}
|
12
|
+
gem.email = 'postmodern.mod3@gmail.com'
|
13
|
+
gem.homepage = 'http://github.com/postmodern/dm-predefined'
|
14
|
+
gem.authors = ['Postmodern']
|
15
|
+
gem.add_dependency 'dm-core', '>= 0.10.2'
|
16
|
+
gem.add_development_dependency 'rspec', '>= 1.3.0'
|
17
|
+
gem.add_development_dependency 'yard', '>= 0.5.3'
|
18
|
+
gem.has_rdoc = 'yard'
|
19
|
+
end
|
20
|
+
rescue LoadError
|
21
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
22
|
+
end
|
11
23
|
|
12
|
-
|
24
|
+
require 'spec/rake/spectask'
|
25
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
26
|
+
spec.libs += ['lib', 'spec']
|
27
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
28
|
+
spec.spec_opts = ['--options', '.specopts']
|
29
|
+
end
|
13
30
|
|
14
|
-
|
15
|
-
|
31
|
+
task :spec => :check_dependencies
|
32
|
+
task :default => :spec
|
16
33
|
|
17
|
-
|
18
|
-
|
19
|
-
]
|
34
|
+
begin
|
35
|
+
require 'yard'
|
20
36
|
|
21
|
-
|
22
|
-
|
23
|
-
|
37
|
+
YARD::Rake::YardocTask.new
|
38
|
+
rescue LoadError
|
39
|
+
task :yard do
|
40
|
+
abort "YARD is not available. In order to run yard, you must: gem install yard"
|
41
|
+
end
|
24
42
|
end
|
25
|
-
|
26
|
-
# vim: syntax=Ruby
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{dm-predefined}
|
8
|
+
s.version = "0.2.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Postmodern"]
|
12
|
+
s.date = %q{2010-03-20}
|
13
|
+
s.description = %q{A DataMapper plugin for adding predefined resources to Models.}
|
14
|
+
s.email = %q{postmodern.mod3@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"ChangeLog.md",
|
17
|
+
"LICENSE.txt",
|
18
|
+
"README.md"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".gitignore",
|
22
|
+
".specopts",
|
23
|
+
".yardopts",
|
24
|
+
"ChangeLog.md",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.md",
|
27
|
+
"Rakefile",
|
28
|
+
"dm-predefined.gemspec",
|
29
|
+
"lib/dm-predefined.rb",
|
30
|
+
"lib/dm-predefined/exceptions/unknown_resource.rb",
|
31
|
+
"lib/dm-predefined/predefined.rb",
|
32
|
+
"lib/dm-predefined/version.rb",
|
33
|
+
"spec/integration/models/test_model.rb",
|
34
|
+
"spec/integration/predefined_spec.rb",
|
35
|
+
"spec/spec_helper.rb"
|
36
|
+
]
|
37
|
+
s.has_rdoc = %q{yard}
|
38
|
+
s.homepage = %q{http://github.com/postmodern/dm-predefined}
|
39
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
40
|
+
s.require_paths = ["lib"]
|
41
|
+
s.rubygems_version = %q{1.3.6}
|
42
|
+
s.summary = %q{A DataMapper plugin for adding predefined resources to Models.}
|
43
|
+
s.test_files = [
|
44
|
+
"spec/spec_helper.rb",
|
45
|
+
"spec/integration/predefined_spec.rb",
|
46
|
+
"spec/integration/models/test_model.rb"
|
47
|
+
]
|
48
|
+
|
49
|
+
if s.respond_to? :specification_version then
|
50
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
51
|
+
s.specification_version = 3
|
52
|
+
|
53
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
54
|
+
s.add_runtime_dependency(%q<dm-core>, [">= 0.10.2"])
|
55
|
+
s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
|
56
|
+
s.add_development_dependency(%q<yard>, [">= 0.5.3"])
|
57
|
+
else
|
58
|
+
s.add_dependency(%q<dm-core>, [">= 0.10.2"])
|
59
|
+
s.add_dependency(%q<rspec>, [">= 1.3.0"])
|
60
|
+
s.add_dependency(%q<yard>, [">= 0.5.3"])
|
61
|
+
end
|
62
|
+
else
|
63
|
+
s.add_dependency(%q<dm-core>, [">= 0.10.2"])
|
64
|
+
s.add_dependency(%q<rspec>, [">= 1.3.0"])
|
65
|
+
s.add_dependency(%q<yard>, [">= 0.5.3"])
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
@@ -28,7 +28,7 @@ module DataMapper
|
|
28
28
|
# @param [Symbol, String] name
|
29
29
|
# The name of the pre-defined resource.
|
30
30
|
#
|
31
|
-
# @return [
|
31
|
+
# @return [DataMapper::Resource]
|
32
32
|
# The pre-defined resource.
|
33
33
|
#
|
34
34
|
# @raise [UnknownResource]
|
@@ -42,12 +42,43 @@ module DataMapper
|
|
42
42
|
attributes = self.predefined_attributes[name]
|
43
43
|
|
44
44
|
unless attributes
|
45
|
-
raise(UnknownResource,"
|
45
|
+
raise(UnknownResource,"The resource '#{name}' was not predefined",caller)
|
46
46
|
end
|
47
47
|
|
48
48
|
self.first_or_create(attributes)
|
49
49
|
end
|
50
50
|
|
51
|
+
#
|
52
|
+
# Finds or auto-creates the predefined resource which shares the
|
53
|
+
# given attributes.
|
54
|
+
#
|
55
|
+
# @param [Hash{Symbol => Object}] desired_attributes
|
56
|
+
# The attribute names and values that the predefined resource
|
57
|
+
# should shared.
|
58
|
+
#
|
59
|
+
# @return [DataMapper::Resource]
|
60
|
+
# The predefined resource.
|
61
|
+
#
|
62
|
+
# @raise [UnknownResource]
|
63
|
+
# Could not find a predefined resource that shared all of the
|
64
|
+
# desired attributes.
|
65
|
+
#
|
66
|
+
# @since 0.2.1
|
67
|
+
#
|
68
|
+
def predefined_resource_with(desired_attributes={})
|
69
|
+
self.predefined_attributes.each do |name,attributes|
|
70
|
+
shares_attributes = desired_attributes.all? do |key,value|
|
71
|
+
key = key.to_sym
|
72
|
+
|
73
|
+
attributes.has_key?(key) && (attributes[key] == value)
|
74
|
+
end
|
75
|
+
|
76
|
+
return predefined_resource(name) if shares_attributes
|
77
|
+
end
|
78
|
+
|
79
|
+
raise(UnknownResource,"Could not find a predefined resource which shared the given attributes",caller)
|
80
|
+
end
|
81
|
+
|
51
82
|
protected
|
52
83
|
|
53
84
|
@@predefined_attributes = {}
|
@@ -77,6 +108,10 @@ module DataMapper
|
|
77
108
|
def predefine(name,attributes={})
|
78
109
|
name = name.to_s
|
79
110
|
|
111
|
+
if attributes.empty?
|
112
|
+
raise(ArgumentError,"Cannot predefine a resource with no attributes",caller)
|
113
|
+
end
|
114
|
+
|
80
115
|
self.predefined_attributes[name.to_sym] = attributes
|
81
116
|
|
82
117
|
class_eval %{
|
@@ -21,7 +21,7 @@ if (HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES)
|
|
21
21
|
test1.body.should == %{This is a test.}
|
22
22
|
end
|
23
23
|
|
24
|
-
it "should be able to define resources with
|
24
|
+
it "should be able to define resources with missing attributes" do
|
25
25
|
test2 = TestModel.test2
|
26
26
|
|
27
27
|
test2.should_not be_nil
|
@@ -38,17 +38,51 @@ if (HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES)
|
|
38
38
|
first_test1.id.should == second_test1.id
|
39
39
|
end
|
40
40
|
|
41
|
-
|
42
|
-
|
41
|
+
describe "predefined_resource" do
|
42
|
+
it "should provide a generic interface for accessing resources" do
|
43
|
+
test1 = TestModel.predefined_resource(:test1)
|
43
44
|
|
44
|
-
|
45
|
-
|
45
|
+
test1.name.should == 'test1'
|
46
|
+
test1.number.should == 1
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should raise UnknownResource when accessing undefined resources" do
|
50
|
+
lambda {
|
51
|
+
TestModel.predefined_resource(:missing_test)
|
52
|
+
}.should raise_error(DataMapper::Predefined::UnknownResource)
|
53
|
+
end
|
46
54
|
end
|
47
55
|
|
48
|
-
|
49
|
-
|
50
|
-
TestModel.
|
51
|
-
|
56
|
+
describe "predefined_resource_with" do
|
57
|
+
it "should find resources based on attributes they share" do
|
58
|
+
test2 = TestModel.predefined_resource_with(:name => 'test2', :number => 2)
|
59
|
+
|
60
|
+
test2.name.should == 'test2'
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should raise UnknownResource if no resource shares all attribute names" do
|
64
|
+
lambda {
|
65
|
+
TestModel.predefined_resource_with(:number => 1, :missing => 'yo')
|
66
|
+
}.should raise_error(DataMapper::Predefined::UnknownResource)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should raise UnknownResource if no resource shares any attribute names" do
|
70
|
+
lambda {
|
71
|
+
TestModel.predefined_resource_with(:missing => 1, :typo => 'yo')
|
72
|
+
}.should raise_error(DataMapper::Predefined::UnknownResource)
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should raise UnknownResource if no resource shares all attribute values" do
|
76
|
+
lambda {
|
77
|
+
TestModel.predefined_resource_with(:number => 2, :optional => 'yo')
|
78
|
+
}.should raise_error(DataMapper::Predefined::UnknownResource)
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should raise UnknownResource if no resource shares any attribute values" do
|
82
|
+
lambda {
|
83
|
+
TestModel.predefined_resource_with(:number => 3, :optional => 'bla')
|
84
|
+
}.should raise_error(DataMapper::Predefined::UnknownResource)
|
85
|
+
end
|
52
86
|
end
|
53
87
|
end
|
54
88
|
end
|
metadata
CHANGED
@@ -1,166 +1,121 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-predefined
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 2
|
8
|
+
- 2
|
9
|
+
version: 0.2.2
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Postmodern
|
8
13
|
autorequire:
|
9
14
|
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-----
|
15
|
+
cert_chain: []
|
32
16
|
|
33
|
-
date: 2010-
|
17
|
+
date: 2010-03-20 00:00:00 -07:00
|
34
18
|
default_executable:
|
35
19
|
dependencies:
|
36
20
|
- !ruby/object:Gem::Dependency
|
37
21
|
name: dm-core
|
38
|
-
|
39
|
-
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
41
24
|
requirements:
|
42
25
|
- - ">="
|
43
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 10
|
30
|
+
- 2
|
44
31
|
version: 0.10.2
|
45
|
-
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
46
34
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
48
|
-
|
49
|
-
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
35
|
+
name: rspec
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
51
38
|
requirements:
|
52
39
|
- - ">="
|
53
40
|
- !ruby/object:Gem::Version
|
54
|
-
|
55
|
-
|
56
|
-
-
|
57
|
-
|
41
|
+
segments:
|
42
|
+
- 1
|
43
|
+
- 3
|
44
|
+
- 0
|
45
|
+
version: 1.3.0
|
58
46
|
type: :development
|
59
|
-
|
60
|
-
version_requirements: !ruby/object:Gem::Requirement
|
61
|
-
requirements:
|
62
|
-
- - ">="
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: 0.3.0
|
65
|
-
version:
|
47
|
+
version_requirements: *id002
|
66
48
|
- !ruby/object:Gem::Dependency
|
67
49
|
name: yard
|
68
|
-
|
69
|
-
|
70
|
-
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
71
52
|
requirements:
|
72
53
|
- - ">="
|
73
54
|
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 0
|
57
|
+
- 5
|
58
|
+
- 3
|
74
59
|
version: 0.5.3
|
75
|
-
version:
|
76
|
-
- !ruby/object:Gem::Dependency
|
77
|
-
name: hoe-yard
|
78
|
-
type: :development
|
79
|
-
version_requirement:
|
80
|
-
version_requirements: !ruby/object:Gem::Requirement
|
81
|
-
requirements:
|
82
|
-
- - ">="
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
version: 0.1.1
|
85
|
-
version:
|
86
|
-
- !ruby/object:Gem::Dependency
|
87
|
-
name: rspec
|
88
|
-
type: :development
|
89
|
-
version_requirement:
|
90
|
-
version_requirements: !ruby/object:Gem::Requirement
|
91
|
-
requirements:
|
92
|
-
- - ">="
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
version: 1.2.9
|
95
|
-
version:
|
96
|
-
- !ruby/object:Gem::Dependency
|
97
|
-
name: hoe
|
98
60
|
type: :development
|
99
|
-
|
100
|
-
version_requirements: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - ">="
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: 2.5.0
|
105
|
-
version:
|
61
|
+
version_requirements: *id003
|
106
62
|
description: A DataMapper plugin for adding predefined resources to Models.
|
107
|
-
email:
|
108
|
-
- postmodern.mod3@gmail.com
|
63
|
+
email: postmodern.mod3@gmail.com
|
109
64
|
executables: []
|
110
65
|
|
111
66
|
extensions: []
|
112
67
|
|
113
68
|
extra_rdoc_files:
|
114
|
-
-
|
115
|
-
-
|
69
|
+
- ChangeLog.md
|
70
|
+
- LICENSE.txt
|
71
|
+
- README.md
|
116
72
|
files:
|
117
|
-
-
|
118
|
-
-
|
119
|
-
-
|
73
|
+
- .gitignore
|
74
|
+
- .specopts
|
75
|
+
- .yardopts
|
76
|
+
- ChangeLog.md
|
77
|
+
- LICENSE.txt
|
78
|
+
- README.md
|
120
79
|
- Rakefile
|
80
|
+
- dm-predefined.gemspec
|
121
81
|
- lib/dm-predefined.rb
|
122
82
|
- lib/dm-predefined/exceptions/unknown_resource.rb
|
123
83
|
- lib/dm-predefined/predefined.rb
|
124
84
|
- lib/dm-predefined/version.rb
|
125
|
-
- lib/dm-predefined/yard.rb
|
126
|
-
- lib/dm-predefined/yard/handlers.rb
|
127
|
-
- lib/dm-predefined/yard/handlers/ruby.rb
|
128
|
-
- lib/dm-predefined/yard/handlers/ruby/predefine_handler.rb
|
129
|
-
- lib/dm-predefined/yard/handlers/ruby/legacy.rb
|
130
|
-
- lib/dm-predefined/yard/handlers/ruby/legacy/predefine_handler.rb
|
131
85
|
- spec/integration/models/test_model.rb
|
132
86
|
- spec/integration/predefined_spec.rb
|
133
87
|
- spec/spec_helper.rb
|
134
88
|
has_rdoc: yard
|
135
|
-
homepage: http://dm-predefined
|
89
|
+
homepage: http://github.com/postmodern/dm-predefined
|
136
90
|
licenses: []
|
137
91
|
|
138
92
|
post_install_message:
|
139
93
|
rdoc_options:
|
140
|
-
- --
|
141
|
-
- --title
|
142
|
-
- DmPredefined Documentation
|
143
|
-
- --quiet
|
94
|
+
- --charset=UTF-8
|
144
95
|
require_paths:
|
145
96
|
- lib
|
146
97
|
required_ruby_version: !ruby/object:Gem::Requirement
|
147
98
|
requirements:
|
148
99
|
- - ">="
|
149
100
|
- !ruby/object:Gem::Version
|
101
|
+
segments:
|
102
|
+
- 0
|
150
103
|
version: "0"
|
151
|
-
version:
|
152
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
105
|
requirements:
|
154
106
|
- - ">="
|
155
107
|
- !ruby/object:Gem::Version
|
108
|
+
segments:
|
109
|
+
- 0
|
156
110
|
version: "0"
|
157
|
-
version:
|
158
111
|
requirements: []
|
159
112
|
|
160
|
-
rubyforge_project:
|
161
|
-
rubygems_version: 1.3.
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 1.3.6
|
162
115
|
signing_key:
|
163
116
|
specification_version: 3
|
164
117
|
summary: A DataMapper plugin for adding predefined resources to Models.
|
165
|
-
test_files:
|
166
|
-
|
118
|
+
test_files:
|
119
|
+
- spec/spec_helper.rb
|
120
|
+
- spec/integration/predefined_spec.rb
|
121
|
+
- spec/integration/models/test_model.rb
|
data/History.rdoc
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
=== 0.2.0 / 2009-09-21
|
2
|
-
|
3
|
-
* Require Hoe >= 2.3.3.
|
4
|
-
* Require YARD >= 0.2.3.5.
|
5
|
-
* Require dm-core >= 0.10.0.
|
6
|
-
* Moved to YARD based documentation.
|
7
|
-
* Added YARD handlers for documenting +predefine+ method-calls.
|
8
|
-
* Renamed Predefined.predefined to Predefined.predefine.
|
9
|
-
|
10
|
-
=== 0.1.1 / 2009-01-17
|
11
|
-
|
12
|
-
* Fixed specs to work with RSpec 1.1.12.
|
13
|
-
* All specs pass in Ruby 1.9.1-rc1.
|
14
|
-
|
15
|
-
=== 0.1.0 / 2008-12-21
|
16
|
-
|
17
|
-
* Initial release.
|
18
|
-
|
data/Manifest.txt
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
History.rdoc
|
2
|
-
Manifest.txt
|
3
|
-
README.rdoc
|
4
|
-
Rakefile
|
5
|
-
lib/dm-predefined.rb
|
6
|
-
lib/dm-predefined/exceptions/unknown_resource.rb
|
7
|
-
lib/dm-predefined/predefined.rb
|
8
|
-
lib/dm-predefined/version.rb
|
9
|
-
lib/dm-predefined/yard.rb
|
10
|
-
lib/dm-predefined/yard/handlers.rb
|
11
|
-
lib/dm-predefined/yard/handlers/ruby.rb
|
12
|
-
lib/dm-predefined/yard/handlers/ruby/predefine_handler.rb
|
13
|
-
lib/dm-predefined/yard/handlers/ruby/legacy.rb
|
14
|
-
lib/dm-predefined/yard/handlers/ruby/legacy/predefine_handler.rb
|
15
|
-
spec/integration/models/test_model.rb
|
16
|
-
spec/integration/predefined_spec.rb
|
17
|
-
spec/spec_helper.rb
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'yard'
|
2
|
-
|
3
|
-
module YARD
|
4
|
-
module Handlers
|
5
|
-
module Ruby
|
6
|
-
module Legacy
|
7
|
-
class PredefineHandler < Base
|
8
|
-
|
9
|
-
handles /\Apredefine\s/
|
10
|
-
|
11
|
-
def process
|
12
|
-
nobj = namespace
|
13
|
-
name = statement.tokens[2,1].to_s[1..-1]
|
14
|
-
|
15
|
-
register MethodObject.new(nobj, name, :class) do |o|
|
16
|
-
o.visibility = :public
|
17
|
-
o.source = statement.source
|
18
|
-
o.signature = "def #{nobj}.#{name}"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
require 'dm-predefined/yard/handlers/ruby/legacy/predefine_handler'
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'yard'
|
2
|
-
|
3
|
-
module YARD
|
4
|
-
module Handlers
|
5
|
-
module Ruby
|
6
|
-
class PredefineHandler < Base
|
7
|
-
|
8
|
-
handles method_call(:predefine)
|
9
|
-
|
10
|
-
def process
|
11
|
-
nobj = namespace
|
12
|
-
name = if statement.type == :predefine
|
13
|
-
statement.jump(:ident, :op, :kw, :const).source
|
14
|
-
elsif statement.call?
|
15
|
-
obj = statement.parameters(false).first
|
16
|
-
|
17
|
-
case obj.type
|
18
|
-
when :symbol_literal
|
19
|
-
obj.jump(:ident, :op, :kw, :const).source
|
20
|
-
when :string_literal
|
21
|
-
obj.jump(:string_content).source
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
register MethodObject.new(nobj, name, :class) do |o|
|
26
|
-
o.visibility = :public
|
27
|
-
o.source = statement.source
|
28
|
-
o.signature = "def #{nobj}.#{name}"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
require 'dm-predefined/yard/handlers/ruby'
|
data/lib/dm-predefined/yard.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'dm-predefined/yard/handlers'
|
data.tar.gz.sig
DELETED
metadata.gz.sig
DELETED
Binary file
|