dm-rails-gae 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/dm-rails-gae.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dm-rails-gae}
|
8
|
-
s.version = "0.0
|
8
|
+
s.version = "0.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["joshsmoore"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2010-01-08}
|
13
13
|
s.description = %q{Integrate datamapper to rails3 for the Google App Engine}
|
14
14
|
s.email = %q{joshsmoore@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -28,6 +28,9 @@ Gem::Specification.new do |s|
|
|
28
28
|
"generators/data_mapper/model/model_generator.rb",
|
29
29
|
"generators/data_mapper/model/templates/model.rb",
|
30
30
|
"generators/data_mapper/templates/model.rb",
|
31
|
+
"generators/dm_model/dm_model_generator.rb",
|
32
|
+
"generators/dm_model/templates/model.rb",
|
33
|
+
"generators/dm_model/templates/unit_test.rb",
|
31
34
|
"lib/USAGE",
|
32
35
|
"lib/dm-rails-gae.rb",
|
33
36
|
"lib/generators/data_mapper/USAGE",
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rails_generator/generators/components/model/model_generator'
|
2
|
+
require 'active_record'
|
3
|
+
require 'dm-core'
|
4
|
+
|
5
|
+
class DmModelGenerator < ModelGenerator
|
6
|
+
|
7
|
+
def manifest
|
8
|
+
record do |m|
|
9
|
+
|
10
|
+
# Check for class naming collisions.
|
11
|
+
m.class_collisions class_path, class_name, "#{class_name}Test"
|
12
|
+
|
13
|
+
# Model, test, and fixture directories.
|
14
|
+
m.directory File.join('app/models', class_path)
|
15
|
+
m.directory File.join('test/unit', class_path)
|
16
|
+
|
17
|
+
# 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
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<% max = min = 10 -%>
|
2
|
+
<% Array(attributes).each do |attribute|
|
3
|
+
max = attribute.name.size if max < attribute.name.size
|
4
|
+
min = attribute.name.size if min > attribute.name.size
|
5
|
+
|
6
|
+
Array(DataMapper::Property::PRIMITIVES).collect{|i| i.to_s}|DataMapper::Types.constants
|
7
|
+
unless (Array(DataMapper::Property::PRIMITIVES).collect{|i| i.to_s}|DataMapper::Types.constants).include? attribute.type.to_s
|
8
|
+
puts "I am here"
|
9
|
+
|
10
|
+
raise "unknown property type '#{attribute.type}'"
|
11
|
+
end
|
12
|
+
|
13
|
+
max += 1
|
14
|
+
end
|
15
|
+
-%>
|
16
|
+
class <%= class_name %>
|
17
|
+
include DataMapper::Resource
|
18
|
+
|
19
|
+
property :id,<%= " " * (max - 2) %>Serial
|
20
|
+
<% Array(attributes).each do |attribute| -%>
|
21
|
+
property :<%= attribute.name %>,<%= " " * (max - attribute.name.size) %><%= attribute.type %>
|
22
|
+
<% end -%>
|
23
|
+
<% unless options[:skip_timestamps] -%>
|
24
|
+
property :created_at, <%= " " * (max - 11) %>DateTime
|
25
|
+
property :updated_at, <%= " " * (max - 11) %>DateTime
|
26
|
+
<% end -%>
|
27
|
+
end
|
data/lib/dm-rails-gae.rb
CHANGED
@@ -1,2 +1,16 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# patch for -- dm-core 0.10.2 & rails 2.3.5
|
2
|
+
|
3
|
+
module DataMapper
|
4
|
+
module Resource
|
5
|
+
# avoid object references in URLs
|
6
|
+
def to_param; id.to_s; end
|
7
|
+
# silence deprecation warnings
|
8
|
+
def new_record?; new?; end
|
9
|
+
def update_attributes(*args); update(*args); end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
# DataMapper::Validate
|
13
|
+
class Dictionary; alias count length; end
|
14
|
+
|
15
|
+
# TODO: still need to fix this TypeError
|
16
|
+
# compared with non class/module
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-rails-gae
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- joshsmoore
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-08 00:00:00 +08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -43,6 +43,9 @@ files:
|
|
43
43
|
- generators/data_mapper/model/model_generator.rb
|
44
44
|
- generators/data_mapper/model/templates/model.rb
|
45
45
|
- generators/data_mapper/templates/model.rb
|
46
|
+
- generators/dm_model/dm_model_generator.rb
|
47
|
+
- generators/dm_model/templates/model.rb
|
48
|
+
- generators/dm_model/templates/unit_test.rb
|
46
49
|
- lib/USAGE
|
47
50
|
- lib/dm-rails-gae.rb
|
48
51
|
- lib/generators/data_mapper/USAGE
|