dm-predefined 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
File without changes
@@ -1,9 +1,7 @@
1
- History.txt
2
- LICENSE.txt
1
+ History.rdoc
3
2
  Manifest.txt
4
- README.txt
3
+ README.rdoc
5
4
  Rakefile
6
- TODO.txt
7
5
  lib/dm-predefined.rb
8
6
  lib/dm-predefined/exceptions/unknown_resource.rb
9
7
  lib/dm-predefined/predefined.rb
@@ -35,12 +35,15 @@ A DataMapper plugin for adding predefined resources to Models.
35
35
  Licence.gpl2
36
36
  # => #<Licence: id: 1, name: "GPL-2", url: "http://www.gnu.org/copyleft/gpl.html">
37
37
 
38
- Licence[:mit]
38
+ Licence.predefined_resource(:mit)
39
39
  # => #<Licence: id: 2, name: "MIT">
40
40
 
41
+ License.predefined_names
42
+ # => [:gpl2, :mit]
43
+
41
44
  == REQUIREMENTS:
42
45
 
43
- * {YARD}[http://yard.soen.ca/] >= 0.2.3.5
46
+ * {dm-core}[http://github.com/datamapper/dm-core/] >= 0.10.2
44
47
 
45
48
  == INSTALL:
46
49
 
@@ -48,7 +51,9 @@ A DataMapper plugin for adding predefined resources to Models.
48
51
 
49
52
  == LICENSE:
50
53
 
51
- Copyright (c) 2008-2009 Hal Brodigan
54
+ (The MIT License)
55
+
56
+ Copyright (c) 2008-2010 Hal Brodigan
52
57
 
53
58
  Permission is hereby granted, free of charge, to any person obtaining
54
59
  a copy of this software and associated documentation files (the
data/Rakefile CHANGED
@@ -3,23 +3,24 @@
3
3
  require 'rubygems'
4
4
  require 'hoe'
5
5
  require 'hoe/signing'
6
- require './tasks/spec.rb'
7
- require './tasks/yard.rb'
6
+
7
+ Hoe.plugin :yard
8
8
 
9
9
  Hoe.spec('dm-predefined') do
10
- self.rubyforge_name = 'dm-predefined'
11
10
  self.developer('Postmodern','postmodern.mod3@gmail.com')
11
+
12
+ self.rspec_options += ['--colour', '--format', 'specdoc']
13
+
14
+ self.yard_opts += ['--protected']
12
15
  self.remote_rdoc_dir = ''
13
- self.extra_deps = [
14
- ['yard', '>=0.2.3.5'],
15
- ['dm-core', '>=0.10.0']
16
- ]
17
16
 
18
- self.extra_dev_deps = [
19
- ['rspec', '>=1.2.8']
17
+ self.extra_deps += [
18
+ ['dm-core', '>=0.10.2']
20
19
  ]
21
20
 
22
- self.spec_extras = {:has_rdoc => 'yard'}
21
+ self.extra_dev_deps += [
22
+ ['rspec', '>=1.2.9']
23
+ ]
23
24
  end
24
25
 
25
26
  # vim: syntax=Ruby
@@ -10,6 +10,18 @@ module DataMapper
10
10
  end
11
11
 
12
12
  module ClassMethods
13
+ #
14
+ # Returns the names of the predefined resources.
15
+ #
16
+ # @return [Array<Symbol>]
17
+ # The names of the predefined resources.
18
+ #
19
+ # @since 0.2.1
20
+ #
21
+ def predefined_names
22
+ predefined_attributes.keys
23
+ end
24
+
13
25
  #
14
26
  # Finds or auto-creates the pre-defined resource with the given name.
15
27
  #
@@ -19,7 +31,13 @@ module DataMapper
19
31
  # @return [Object]
20
32
  # The pre-defined resource.
21
33
  #
22
- def [](name)
34
+ # @raise [UnknownResource]
35
+ # Indicates that there are no predefined attributes for the resource
36
+ # with the given name.
37
+ #
38
+ # @since 0.2.1
39
+ #
40
+ def predefined_resource(name)
23
41
  name = name.to_sym
24
42
  attributes = self.predefined_attributes[name]
25
43
 
@@ -64,7 +82,7 @@ module DataMapper
64
82
  class_eval %{
65
83
  class << self
66
84
  define_method(#{name.dump}) do
67
- self[#{name.dump}]
85
+ predefined_resource(#{name.dump})
68
86
  end
69
87
  end
70
88
  }
@@ -1,6 +1,6 @@
1
1
  module DataMapper
2
2
  module Predefined
3
3
  # The version of dm-predefined
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
6
6
  end
@@ -7,6 +7,10 @@ if (HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES)
7
7
  TestModel.auto_migrate!
8
8
  end
9
9
 
10
+ it "should provide the names of all predefined resources of a Model" do
11
+ TestModel.predefined_names.should =~ [:test1, :test2]
12
+ end
13
+
10
14
  it "should be able to define resources of a Model" do
11
15
  test1 = TestModel.test1
12
16
 
@@ -35,7 +39,7 @@ if (HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES)
35
39
  end
36
40
 
37
41
  it "should provide a generic interface for accessing resources" do
38
- test1 = TestModel[:test1]
42
+ test1 = TestModel.predefined_resource(:test1)
39
43
 
40
44
  test1.name.should == 'test1'
41
45
  test1.number.should == 1
@@ -43,7 +47,7 @@ if (HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES)
43
47
 
44
48
  it "should raise an UnknownResource exception when accessing undefined resources" do
45
49
  lambda {
46
- TestModel[:test3]
50
+ TestModel.predefined_resource(:test3)
47
51
  }.should raise_error(DataMapper::Predefined::UnknownResource)
48
52
  end
49
53
  end
@@ -1,7 +1,7 @@
1
1
  require 'pathname'
2
2
  require 'rubygems'
3
3
 
4
- gem 'rspec', '~>1.2.6'
4
+ gem 'rspec', '>=1.2.9'
5
5
  require 'spec'
6
6
 
7
7
  require Pathname(__FILE__).dirname.expand_path.parent + 'lib/dm-predefined'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-predefined
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
@@ -30,28 +30,58 @@ cert_chain:
30
30
  pDj+ws7QjtH/Qcrr1l9jfN0ehDs=
31
31
  -----END CERTIFICATE-----
32
32
 
33
- date: 2009-09-25 00:00:00 -07:00
33
+ date: 2010-01-11 00:00:00 -08:00
34
34
  default_executable:
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
- name: yard
37
+ name: dm-core
38
38
  type: :runtime
39
39
  version_requirement:
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  requirements:
42
42
  - - ">="
43
43
  - !ruby/object:Gem::Version
44
- version: 0.2.3.5
44
+ version: 0.10.2
45
45
  version:
46
46
  - !ruby/object:Gem::Dependency
47
- name: dm-core
48
- type: :runtime
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: yard
68
+ type: :development
69
+ version_requirement:
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 0.5.3
75
+ version:
76
+ - !ruby/object:Gem::Dependency
77
+ name: hoe-yard
78
+ type: :development
49
79
  version_requirement:
50
80
  version_requirements: !ruby/object:Gem::Requirement
51
81
  requirements:
52
82
  - - ">="
53
83
  - !ruby/object:Gem::Version
54
- version: 0.10.0
84
+ version: 0.1.1
55
85
  version:
56
86
  - !ruby/object:Gem::Dependency
57
87
  name: rspec
@@ -61,7 +91,7 @@ dependencies:
61
91
  requirements:
62
92
  - - ">="
63
93
  - !ruby/object:Gem::Version
64
- version: 1.2.8
94
+ version: 1.2.9
65
95
  version:
66
96
  - !ruby/object:Gem::Dependency
67
97
  name: hoe
@@ -71,7 +101,7 @@ dependencies:
71
101
  requirements:
72
102
  - - ">="
73
103
  - !ruby/object:Gem::Version
74
- version: 2.3.3
104
+ version: 2.5.0
75
105
  version:
76
106
  description: A DataMapper plugin for adding predefined resources to Models.
77
107
  email:
@@ -81,18 +111,13 @@ executables: []
81
111
  extensions: []
82
112
 
83
113
  extra_rdoc_files:
84
- - History.txt
85
- - LICENSE.txt
86
114
  - Manifest.txt
87
- - README.txt
88
- - TODO.txt
115
+ - History.rdoc
89
116
  files:
90
- - History.txt
91
- - LICENSE.txt
117
+ - History.rdoc
92
118
  - Manifest.txt
93
- - README.txt
119
+ - README.rdoc
94
120
  - Rakefile
95
- - TODO.txt
96
121
  - lib/dm-predefined.rb
97
122
  - lib/dm-predefined/exceptions/unknown_resource.rb
98
123
  - lib/dm-predefined/predefined.rb
@@ -112,8 +137,10 @@ licenses: []
112
137
 
113
138
  post_install_message:
114
139
  rdoc_options:
115
- - --main
116
- - README.txt
140
+ - --protected
141
+ - --title
142
+ - DmPredefined Documentation
143
+ - --quiet
117
144
  require_paths:
118
145
  - lib
119
146
  required_ruby_version: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file
@@ -1,20 +0,0 @@
1
- Copyright (c) 2008 Hal Brodigan
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/TODO.txt DELETED
File without changes