rails_dm_datastore 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -12,6 +12,10 @@ Description goes here.
12
12
  (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
13
  * Send me a pull request. Bonus points for topic branches.
14
14
 
15
+ == Build the gem
16
+ rake gemspec
17
+ rake build
18
+
15
19
  == Copyright
16
20
 
17
21
  Copyright (c) 2009 joshsmoore. See LICENSE for details.
data/Rakefile CHANGED
@@ -19,6 +19,7 @@ begin
19
19
  gem.add_dependency 'dm-timestamps', DM_VERSION
20
20
  gem.add_dependency 'dm-validations', DM_VERSION
21
21
  gem.add_dependency 'dm-appengine'
22
+ gem.add_dependency 'rails_appengine'
22
23
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
23
24
  end
24
25
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.5
1
+ 0.2.6
@@ -3,6 +3,11 @@ require 'active_record'
3
3
  require 'dm-core'
4
4
 
5
5
  class DdModelGenerator < ModelGenerator
6
+
7
+ VALID_TYPES = %w{String ByteString Boolean Integer Float DateTime Date
8
+ Time List StringList Reference SelfReference BlobReference User Blob
9
+ Text Category Link Email GeoPt IM PhoneNumber PostalAddress Rating
10
+ AncestorKey Key Object Serial} # these last few are also valid
6
11
 
7
12
  def manifest
8
13
  record do |m|
@@ -15,10 +20,11 @@ class DdModelGenerator < ModelGenerator
15
20
  m.directory File.join('test/unit', class_path)
16
21
 
17
22
  # Model class, unit test, and fixtures.
18
- m.template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
19
- m.template 'unit_test.rb', File.join('test/unit', class_path, "#{file_name}_test.rb")
20
-
23
+ m.template 'model.rb',
24
+ File.join('app/models', class_path, "#{file_name}.rb")
25
+ m.template 'unit_test.rb',
26
+ File.join('test/unit', class_path, "#{file_name}_test.rb")
21
27
  end
22
28
  end
23
29
 
24
- end
30
+ end
@@ -3,16 +3,13 @@ class <%= class_name %>
3
3
  presets = {'Text' => ':lazy => false', 'String' => ':length => 500'}
4
4
  reserved_dm_names = DataMapper::Resource.instance_methods +
5
5
  DataMapper::Resource.private_instance_methods
6
- datastore_types = (DataMapper::Property::PRIMITIVES +
7
- DataMapper::Types.constants.map{|c| DataMapper::Types.const_get(c)}.
8
- select{|t| t.respond_to? :primitive}).map {|c| c.to_s.split('::')[-1]}
9
6
  Array(attributes).each do |attribute|
10
7
  if reserved_dm_names.include? attribute.name
11
8
  raise "reserved property name '#{attribute.name}'"
12
- elsif !datastore_types.include? attribute.type.to_s.camelcase
9
+ elsif !DdModelGenerator::VALID_TYPES.include? attribute.type.to_s.camelcase
13
10
  raise "unknown property type '#{attribute.type}'"
14
11
  end
15
- max = attribute.name.size if attribute.name.size > max -%>
12
+ max = attribute.name.size if attribute.name.size > max
16
13
  end -%>
17
14
  include DataMapper::Resource
18
15
 
@@ -5,12 +5,10 @@ require 'dm-timestamps'
5
5
  require 'dm-validations'
6
6
  DataMapper.setup(:default, "appengine://auto")
7
7
 
8
- require 'rails_dm_datastore/multiparameter_assignments'
9
8
  require 'rails_dm_datastore/data_mapper'
10
9
  require 'rails_dm_datastore/local_object_space'
11
10
  require 'rails_dm_datastore/extlib'
12
11
  require 'rails_dm_datastore/action_view'
13
- require 'rails_dm_datastore/active_support'
14
12
 
15
13
  # DataMapper::Validate
16
14
  class Dictionary; alias count length; end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rails_dm_datastore}
8
- s.version = "0.2.5"
8
+ s.version = "0.2.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Josh S Moore", "John Woodell"]
12
- s.date = %q{2010-02-20}
12
+ s.date = %q{2010-03-01}
13
13
  s.description = %q{Integrate datamapper to Rails for the Google App Engine}
14
14
  s.email = ["joshsmoore@gmail.com", "woodie@netpress.com"]
15
15
  s.extra_rdoc_files = [
@@ -29,11 +29,9 @@ Gem::Specification.new do |s|
29
29
  "generators/dd_model/templates/unit_test.rb",
30
30
  "lib/rails_dm_datastore.rb",
31
31
  "lib/rails_dm_datastore/action_view.rb",
32
- "lib/rails_dm_datastore/active_support.rb",
33
32
  "lib/rails_dm_datastore/data_mapper.rb",
34
33
  "lib/rails_dm_datastore/extlib.rb",
35
34
  "lib/rails_dm_datastore/local_object_space.rb",
36
- "lib/rails_dm_datastore/multiparameter_assignments.rb",
37
35
  "rails_dm_datastore.gemspec",
38
36
  "test/helper.rb",
39
37
  "test/test_dm-rails-gae.rb",
@@ -42,11 +40,11 @@ Gem::Specification.new do |s|
42
40
  s.homepage = %q{http://github.com/joshsmoore/dm-rails-gae}
43
41
  s.rdoc_options = ["--charset=UTF-8"]
44
42
  s.require_paths = ["lib"]
45
- s.rubygems_version = %q{1.3.5}
43
+ s.rubygems_version = %q{1.3.6}
46
44
  s.summary = %q{Generators for dm on gae}
47
45
  s.test_files = [
48
- "test/test_dm-rails-gae.rb",
49
- "test/helper.rb",
46
+ "test/helper.rb",
47
+ "test/test_dm-rails-gae.rb",
50
48
  "test/test_weak_reference.rb"
51
49
  ]
52
50
 
@@ -62,6 +60,7 @@ Gem::Specification.new do |s|
62
60
  s.add_runtime_dependency(%q<dm-timestamps>, ["= 0.10.2"])
63
61
  s.add_runtime_dependency(%q<dm-validations>, ["= 0.10.2"])
64
62
  s.add_runtime_dependency(%q<dm-appengine>, [">= 0"])
63
+ s.add_runtime_dependency(%q<rails_appengine>, [">= 0"])
65
64
  else
66
65
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
67
66
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
@@ -70,6 +69,7 @@ Gem::Specification.new do |s|
70
69
  s.add_dependency(%q<dm-timestamps>, ["= 0.10.2"])
71
70
  s.add_dependency(%q<dm-validations>, ["= 0.10.2"])
72
71
  s.add_dependency(%q<dm-appengine>, [">= 0"])
72
+ s.add_dependency(%q<rails_appengine>, [">= 0"])
73
73
  end
74
74
  else
75
75
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
@@ -79,6 +79,7 @@ Gem::Specification.new do |s|
79
79
  s.add_dependency(%q<dm-timestamps>, ["= 0.10.2"])
80
80
  s.add_dependency(%q<dm-validations>, ["= 0.10.2"])
81
81
  s.add_dependency(%q<dm-appengine>, [">= 0"])
82
+ s.add_dependency(%q<rails_appengine>, [">= 0"])
82
83
  end
83
84
  end
84
85
 
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_dm_datastore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 6
9
+ version: 0.2.6
5
10
  platform: ruby
6
11
  authors:
7
12
  - Josh S Moore
@@ -10,79 +15,113 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2010-02-20 00:00:00 +08:00
18
+ date: 2010-03-01 00:00:00 -08:00
14
19
  default_executable:
15
20
  dependencies:
16
21
  - !ruby/object:Gem::Dependency
17
22
  name: thoughtbot-shoulda
18
- type: :development
19
- version_requirement:
20
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
21
25
  requirements:
22
26
  - - ">="
23
27
  - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
24
30
  version: "0"
25
- version:
31
+ type: :development
32
+ version_requirements: *id001
26
33
  - !ruby/object:Gem::Dependency
27
34
  name: thoughtbot-shoulda
28
- type: :development
29
- version_requirement:
30
- version_requirements: !ruby/object:Gem::Requirement
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
31
37
  requirements:
32
38
  - - ">="
33
39
  - !ruby/object:Gem::Version
40
+ segments:
41
+ - 0
34
42
  version: "0"
35
- version:
43
+ type: :development
44
+ version_requirements: *id002
36
45
  - !ruby/object:Gem::Dependency
37
46
  name: dm-core
38
- type: :runtime
39
- version_requirement:
40
- version_requirements: !ruby/object:Gem::Requirement
47
+ prerelease: false
48
+ requirement: &id003 !ruby/object:Gem::Requirement
41
49
  requirements:
42
50
  - - "="
43
51
  - !ruby/object:Gem::Version
52
+ segments:
53
+ - 0
54
+ - 10
55
+ - 2
44
56
  version: 0.10.2
45
- version:
57
+ type: :runtime
58
+ version_requirements: *id003
46
59
  - !ruby/object:Gem::Dependency
47
60
  name: dm-ar-finders
48
- type: :runtime
49
- version_requirement:
50
- version_requirements: !ruby/object:Gem::Requirement
61
+ prerelease: false
62
+ requirement: &id004 !ruby/object:Gem::Requirement
51
63
  requirements:
52
64
  - - "="
53
65
  - !ruby/object:Gem::Version
66
+ segments:
67
+ - 0
68
+ - 10
69
+ - 2
54
70
  version: 0.10.2
55
- version:
71
+ type: :runtime
72
+ version_requirements: *id004
56
73
  - !ruby/object:Gem::Dependency
57
74
  name: dm-timestamps
58
- type: :runtime
59
- version_requirement:
60
- version_requirements: !ruby/object:Gem::Requirement
75
+ prerelease: false
76
+ requirement: &id005 !ruby/object:Gem::Requirement
61
77
  requirements:
62
78
  - - "="
63
79
  - !ruby/object:Gem::Version
80
+ segments:
81
+ - 0
82
+ - 10
83
+ - 2
64
84
  version: 0.10.2
65
- version:
85
+ type: :runtime
86
+ version_requirements: *id005
66
87
  - !ruby/object:Gem::Dependency
67
88
  name: dm-validations
68
- type: :runtime
69
- version_requirement:
70
- version_requirements: !ruby/object:Gem::Requirement
89
+ prerelease: false
90
+ requirement: &id006 !ruby/object:Gem::Requirement
71
91
  requirements:
72
92
  - - "="
73
93
  - !ruby/object:Gem::Version
94
+ segments:
95
+ - 0
96
+ - 10
97
+ - 2
74
98
  version: 0.10.2
75
- version:
99
+ type: :runtime
100
+ version_requirements: *id006
76
101
  - !ruby/object:Gem::Dependency
77
102
  name: dm-appengine
103
+ prerelease: false
104
+ requirement: &id007 !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ segments:
109
+ - 0
110
+ version: "0"
78
111
  type: :runtime
79
- version_requirement:
80
- version_requirements: !ruby/object:Gem::Requirement
112
+ version_requirements: *id007
113
+ - !ruby/object:Gem::Dependency
114
+ name: rails_appengine
115
+ prerelease: false
116
+ requirement: &id008 !ruby/object:Gem::Requirement
81
117
  requirements:
82
118
  - - ">="
83
119
  - !ruby/object:Gem::Version
120
+ segments:
121
+ - 0
84
122
  version: "0"
85
- version:
123
+ type: :runtime
124
+ version_requirements: *id008
86
125
  description: Integrate datamapper to Rails for the Google App Engine
87
126
  email:
88
127
  - joshsmoore@gmail.com
@@ -107,11 +146,9 @@ files:
107
146
  - generators/dd_model/templates/unit_test.rb
108
147
  - lib/rails_dm_datastore.rb
109
148
  - lib/rails_dm_datastore/action_view.rb
110
- - lib/rails_dm_datastore/active_support.rb
111
149
  - lib/rails_dm_datastore/data_mapper.rb
112
150
  - lib/rails_dm_datastore/extlib.rb
113
151
  - lib/rails_dm_datastore/local_object_space.rb
114
- - lib/rails_dm_datastore/multiparameter_assignments.rb
115
152
  - rails_dm_datastore.gemspec
116
153
  - test/helper.rb
117
154
  - test/test_dm-rails-gae.rb
@@ -129,22 +166,24 @@ required_ruby_version: !ruby/object:Gem::Requirement
129
166
  requirements:
130
167
  - - ">="
131
168
  - !ruby/object:Gem::Version
169
+ segments:
170
+ - 0
132
171
  version: "0"
133
- version:
134
172
  required_rubygems_version: !ruby/object:Gem::Requirement
135
173
  requirements:
136
174
  - - ">="
137
175
  - !ruby/object:Gem::Version
176
+ segments:
177
+ - 0
138
178
  version: "0"
139
- version:
140
179
  requirements: []
141
180
 
142
181
  rubyforge_project:
143
- rubygems_version: 1.3.5
182
+ rubygems_version: 1.3.6
144
183
  signing_key:
145
184
  specification_version: 3
146
185
  summary: Generators for dm on gae
147
186
  test_files:
148
- - test/test_dm-rails-gae.rb
149
187
  - test/helper.rb
188
+ - test/test_dm-rails-gae.rb
150
189
  - test/test_weak_reference.rb
@@ -1,42 +0,0 @@
1
- # set a nil date or time when a date cannot be parced
2
- # to avoid exception by ruby via to_date and to_time
3
- module ActiveSupport #:nodoc:
4
- module CoreExtensions #:nodoc:
5
- module String #:nodoc:
6
- # Converting strings to other objects
7
- module Conversions
8
- # 'a'.ord == 'a'[0] for Ruby 1.9 forward compatibility.
9
- def ord
10
- self[0]
11
- end if RUBY_VERSION < '1.9'
12
- # Form can be either :utc (default) or :local.
13
- def to_time(form = :utc)
14
- begin
15
- ::Time.send("#{form}_time", *::Date._parse(self, false).
16
- values_at(:year, :mon, :mday, :hour, :min, :sec).
17
- map { |arg| arg || 0 })
18
- rescue
19
- nil
20
- end
21
- end
22
- def to_date
23
- begin
24
- ::Date.new(*::Date._parse(self, false).
25
- values_at(:year, :mon, :mday))
26
- rescue
27
- nil
28
- end
29
- end
30
- def to_datetime
31
- begin
32
- ::DateTime.civil(*::Date._parse(self, false).
33
- values_at(:year, :mon, :mday, :hour, :min, :sec).
34
- map { |arg| arg || 0 })
35
- rescue
36
- nil
37
- end
38
- end
39
- end
40
- end
41
- end
42
- end
@@ -1,27 +0,0 @@
1
- # Convert the values from the date and time picker
2
- # to a date or time class that the datastore can accept
3
- module MultiparameterAssignments
4
- def self.fix_date(hash, property, type)
5
- total_attributes = 0
6
- if Date == type
7
- total_attributes = 3
8
- else
9
- total_attributes = 5
10
- end
11
- time_string = ""
12
- 1.upto(total_attributes) do |n|
13
- if n == 1
14
- time_string << hash[:"#{property}(#{n}i)"]
15
- elsif n > 1 && n <= 3
16
- time_string << '-' + hash[:"#{property}(#{n}i)"]
17
- elsif n == 4
18
- time_string << ' ' + hash[:"#{property}(#{n}i)"]
19
- elsif n > 4
20
- time_string << ':' + hash[:"#{property}(#{n}i)"]
21
- end
22
- hash.delete :"#{property}(#{n}i)"
23
- end
24
- hash[property] = type.parse(time_string).send("to_#{type.to_s.downcase}")
25
- hash
26
- end
27
- end