dm-mapping 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/CHANGES +8 -7
- data/README +40 -29
- data/Rakefile +9 -4
- data/TODO +2 -2
- data/dm-mapping.gemspec +8 -5
- data/lib/dm-mapping.rb +6 -0
- data/lib/dm-mapping/adapters/abstract_adapter.rb +41 -2
- data/lib/dm-mapping/adapters/sqlite3adapter.rb +1 -1
- data/lib/dm-mapping/model.rb +27 -1
- data/lib/dm-mapping/type_map.rb +4 -0
- data/lib/dm-mapping/version.rb +1 -1
- data/test/{test_dm-mapping.rb → test_sqlite3.rb} +35 -5
- metadata +14 -16
data/.gitignore
CHANGED
data/CHANGES
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
= dm-mapper changes history
|
2
2
|
|
3
|
-
|
3
|
+
=== dm-mapping 0.4.0, 2008-08-04
|
4
|
+
* added Migration#auto_genclass!.
|
5
|
+
* updated README.
|
6
|
+
* added more rdoc.
|
4
7
|
|
8
|
+
=== dm-mapping 0.3.0, 2008-08-04
|
5
9
|
* added support of mapping Integer, DateTime, etc.
|
6
10
|
* renamed some internals.
|
7
11
|
* changed the way requiring adapter. no more setup first.
|
@@ -12,14 +16,12 @@
|
|
12
16
|
* added support of multiple arguments.
|
13
17
|
* removed Mapping::All, use /.*/ instead.
|
14
18
|
|
15
|
-
|
16
|
-
|
19
|
+
=== dm-mapping 0.2.1, 2008-08-03
|
17
20
|
* fixed a bug that type map should lookup for parent.
|
18
21
|
* fixed a bug that sql type could be lower case.
|
19
22
|
fixed by calling upcase.
|
20
23
|
|
21
|
-
|
22
|
-
|
24
|
+
=== dm-mapping 0.2.0, 2008-08-02
|
23
25
|
* added Sqlite3Adapter::Migration#fields
|
24
26
|
* added DataMapper::Model#mapping
|
25
27
|
* added DataMapper::Model#fields
|
@@ -27,8 +29,7 @@
|
|
27
29
|
mapping SQL type back to Ruby type.
|
28
30
|
* added corresponded test.
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
+
=== dm-mapping 0.1.0, 2008-07-27
|
32
33
|
* birthday!
|
33
34
|
* added DataMapper.repository.storages for sqlite3.
|
34
35
|
* please refer:
|
data/README
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
-
= dm-mapping 0.
|
1
|
+
= dm-mapping 0.4.0
|
2
2
|
by Lin Jen-Shin (a.k.a. godfat-真常[http://godfat.org])
|
3
|
-
|
3
|
+
godfat (XD) godfat.org
|
4
4
|
|
5
|
+
== LINKS:
|
6
|
+
|
7
|
+
* rdoc[http://ludy.rubyforge.org/dm-mapping]
|
5
8
|
* github-project[http://github.com/godfat/dm-mapping]
|
9
|
+
* rubyforge-project[http://rubyforge.org/projects/ludy]
|
6
10
|
|
7
11
|
== DESCRIPTION:
|
8
12
|
|
@@ -11,12 +15,11 @@ by Lin Jen-Shin (a.k.a. godfat-真常[http://godfat.org])
|
|
11
15
|
|
12
16
|
== SYNOPSIS:
|
13
17
|
|
14
|
-
require 'dm-core'
|
15
|
-
|
16
|
-
# setup first, or dm-mapping can't determine which adapter it should load up
|
17
|
-
DataMapper.setup :default, 'sqlite3:db/development.sqlite3'
|
18
|
-
|
19
18
|
require 'dm-mapping'
|
19
|
+
dm = DataMapper.setup :default, 'sqlite3:db/development.sqlite3'
|
20
|
+
|
21
|
+
dm.object_id == DataMapper.repository.adapter.object_id
|
22
|
+
# => true
|
20
23
|
|
21
24
|
class User
|
22
25
|
include DataMapper::Resource
|
@@ -36,30 +39,38 @@ by Lin Jen-Shin (a.k.a. godfat-真常[http://godfat.org])
|
|
36
39
|
mapping :login, Integer
|
37
40
|
end
|
38
41
|
|
39
|
-
|
42
|
+
# there's no guarantee of the order in storages array
|
43
|
+
dm.storages
|
40
44
|
# => ['users']
|
41
45
|
|
42
|
-
|
43
|
-
|
46
|
+
# there's no guarantee of the order in fields array
|
47
|
+
User.fields.sort
|
48
|
+
# => [['created_at', DateTime, {}],
|
44
49
|
['email', String, {:default => 'nospam@nospam.tw'}],
|
45
|
-
['
|
50
|
+
['id', Integer, {:serial => true}],
|
46
51
|
['salt_first', String, {}],
|
47
52
|
['salt_second', String, {}]]
|
48
53
|
|
49
|
-
|
50
|
-
# =>
|
51
|
-
['email', String, {:default => 'nospam@nospam.tw'}],
|
52
|
-
['created_at', DateTime, {}],
|
53
|
-
['salt_first', String, {}],
|
54
|
-
['salt_second', String, {}]]
|
54
|
+
dm.fields('users').sort == User.fields.sort
|
55
|
+
# => true
|
55
56
|
|
56
|
-
|
57
|
+
dm.storages_and_fields
|
57
58
|
# => {'users' => [['id', Integer, {:serial => true}],
|
58
59
|
['email', String, {:default => 'nospam@nospam.tw'}],
|
59
60
|
['created_at', DateTime, {}],
|
60
61
|
['salt_first', String, {}],
|
61
62
|
['salt_second', String, {}]]}
|
62
63
|
|
64
|
+
# there's no guarantee of the order in returned array
|
65
|
+
dm.auto_genclass!
|
66
|
+
# => [DataMapper::Mapping::User,
|
67
|
+
DataMapper::Mapping::SchemaInfo,
|
68
|
+
DataMapper::Mapping::Session]
|
69
|
+
|
70
|
+
# you can change the scope of generated models:
|
71
|
+
dm.auto_genclass! Object
|
72
|
+
# => [User, SchemaInfo, Session]
|
73
|
+
|
63
74
|
== REQUIREMENTS:
|
64
75
|
|
65
76
|
* dm-core 0.9.3
|
@@ -70,18 +81,18 @@ by Lin Jen-Shin (a.k.a. godfat-真常[http://godfat.org])
|
|
70
81
|
|
71
82
|
== LICENSE:
|
72
83
|
|
73
|
-
Apache License 2.0
|
84
|
+
Apache License 2.0
|
74
85
|
|
75
|
-
Copyright (c) 2008, Lin Jen-Shin (a.k.a. godfat 真常)
|
86
|
+
Copyright (c) 2008, Lin Jen-Shin (a.k.a. godfat 真常)
|
76
87
|
|
77
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
78
|
-
you may not use this file except in compliance with the License.
|
79
|
-
You may obtain a copy of the License at
|
88
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
89
|
+
you may not use this file except in compliance with the License.
|
90
|
+
You may obtain a copy of the License at
|
80
91
|
|
81
|
-
|
92
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
82
93
|
|
83
|
-
Unless required by applicable law or agreed to in writing, software
|
84
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
85
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
86
|
-
See the License for the specific language governing permissions and
|
87
|
-
limitations under the License.
|
94
|
+
Unless required by applicable law or agreed to in writing, software
|
95
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
96
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
97
|
+
See the License for the specific language governing permissions and
|
98
|
+
limitations under the License.
|
data/Rakefile
CHANGED
@@ -33,26 +33,31 @@ PROJ.ruby_opts.delete '-w'
|
|
33
33
|
|
34
34
|
PROJ.name = 'dm-mapping'
|
35
35
|
PROJ.authors = 'Lin Jen-Shin (a.k.a. godfat 真常)'
|
36
|
-
PROJ.email = '
|
36
|
+
PROJ.email = 'godfat (XD) godfat.org'
|
37
37
|
PROJ.url = 'http://github.com/godfat/dm-mapping'
|
38
38
|
PROJ.description = PROJ.summary = paragraphs_of('README', 'description').join("\n\n")
|
39
39
|
PROJ.changes = paragraphs_of('CHANGES', 0..1).join("\n\n")
|
40
40
|
PROJ.rubyforge.name = 'ludy'
|
41
41
|
PROJ.version = File.open('lib/dm-mapping/version.rb', 0){ |f| f.read.gsub(/.*VERSION = '(.*)'.*/m, '\1') }
|
42
42
|
|
43
|
-
PROJ.gem.dependencies << ['dm-core', '>=0.9.3']
|
43
|
+
PROJ.gem.dependencies << ['dm-core', '>=0.9.3'] << ['extlib', '>=0.9.3']
|
44
44
|
# PROJ.gem.executables = []
|
45
45
|
# PROJ.gem.files = []
|
46
46
|
|
47
47
|
PROJ.manifest_file = 'Manifest'
|
48
|
-
PROJ.exclude << 'Manifest' << '^tmp'
|
48
|
+
PROJ.exclude << 'Manifest' << '^tmp' << 'tmp$' << '^pkg'
|
49
49
|
|
50
|
+
PROJ.readme_file = 'README'
|
50
51
|
PROJ.rdoc.main = 'README'
|
51
|
-
PROJ.rdoc.
|
52
|
+
PROJ.rdoc.remote_dir = 'dm-mapping'
|
53
|
+
PROJ.rdoc.exclude << 'Rakefile' << '^tasks' << '^test'
|
52
54
|
PROJ.rdoc.include << '\w+'
|
53
55
|
PROJ.rdoc.opts << '--diagram' if !WIN32 and `which dot` =~ %r/\/dot/
|
54
56
|
PROJ.rdoc.opts << '--charset=utf-8' << '--inline-source' << '--line-numbers' << '--promiscuous'
|
55
57
|
|
56
58
|
PROJ.spec.opts << '--color'
|
57
59
|
|
60
|
+
PROJ.ann.file = "ann-dm-mapping-#{PROJ.version}"
|
61
|
+
PROJ.ann.paragraphs.concat %w[LINKS SYNOPSIS REQUIREMENTS INSTALL LICENSE]
|
62
|
+
|
58
63
|
# EOF
|
data/TODO
CHANGED
data/dm-mapping.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = %q{dm-mapping}
|
4
|
-
s.version = "0.
|
4
|
+
s.version = "0.4.0"
|
5
5
|
|
6
6
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
7
7
|
s.authors = ["Lin Jen-Shin (a.k.a. godfat \347\234\237\345\270\270)"]
|
8
8
|
s.date = %q{2008-08-04}
|
9
9
|
s.description = %q{DataMapper plugin that helps you manipulate an existing database. It creates mappings between existing columns and model's properties.}
|
10
|
-
s.email = %q{
|
11
|
-
s.extra_rdoc_files = [".gitignore", "CHANGES", "LICENSE", "NOTICE", "README", "TODO", "dm-mapping.gemspec"
|
12
|
-
s.files = [".gitignore", "CHANGES", "LICENSE", "NOTICE", "README", "Rakefile", "TODO", "dm-mapping.gemspec", "lib/dm-mapping.rb", "lib/dm-mapping/adapters/abstract_adapter.rb", "lib/dm-mapping/adapters/sqlite3adapter.rb", "lib/dm-mapping/model.rb", "lib/dm-mapping/type_map.rb", "lib/dm-mapping/version.rb", "tasks/ann.rake", "tasks/bones.rake", "tasks/gem.rake", "tasks/git.rake", "tasks/manifest.rake", "tasks/notes.rake", "tasks/post_load.rake", "tasks/rdoc.rake", "tasks/rubyforge.rake", "tasks/setup.rb", "tasks/spec.rake", "tasks/svn.rake", "tasks/test.rake", "test/
|
10
|
+
s.email = %q{godfat (XD) godfat.org}
|
11
|
+
s.extra_rdoc_files = [".gitignore", "CHANGES", "LICENSE", "NOTICE", "README", "TODO", "dm-mapping.gemspec"]
|
12
|
+
s.files = [".gitignore", "CHANGES", "LICENSE", "NOTICE", "README", "Rakefile", "TODO", "dm-mapping.gemspec", "lib/dm-mapping.rb", "lib/dm-mapping/adapters/abstract_adapter.rb", "lib/dm-mapping/adapters/sqlite3adapter.rb", "lib/dm-mapping/model.rb", "lib/dm-mapping/type_map.rb", "lib/dm-mapping/version.rb", "tasks/ann.rake", "tasks/bones.rake", "tasks/gem.rake", "tasks/git.rake", "tasks/manifest.rake", "tasks/notes.rake", "tasks/post_load.rake", "tasks/rdoc.rake", "tasks/rubyforge.rake", "tasks/setup.rb", "tasks/spec.rake", "tasks/svn.rake", "tasks/test.rake", "test/test_sqlite3.rb"]
|
13
13
|
s.has_rdoc = true
|
14
14
|
s.homepage = %q{http://github.com/godfat/dm-mapping}
|
15
15
|
s.rdoc_options = ["--diagram", "--charset=utf-8", "--inline-source", "--line-numbers", "--promiscuous", "--main", "README"]
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.rubyforge_project = %q{ludy}
|
18
18
|
s.rubygems_version = %q{1.2.0}
|
19
19
|
s.summary = %q{DataMapper plugin that helps you manipulate an existing database. It creates mappings between existing columns and model's properties.}
|
20
|
-
s.test_files = ["test/
|
20
|
+
s.test_files = ["test/test_sqlite3.rb"]
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
23
23
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
@@ -25,10 +25,13 @@ Gem::Specification.new do |s|
|
|
25
25
|
|
26
26
|
if current_version >= 3 then
|
27
27
|
s.add_runtime_dependency(%q<dm-core>, [">= 0.9.3"])
|
28
|
+
s.add_runtime_dependency(%q<extlib>, [">= 0.9.3"])
|
28
29
|
else
|
29
30
|
s.add_dependency(%q<dm-core>, [">= 0.9.3"])
|
31
|
+
s.add_dependency(%q<extlib>, [">= 0.9.3"])
|
30
32
|
end
|
31
33
|
else
|
32
34
|
s.add_dependency(%q<dm-core>, [">= 0.9.3"])
|
35
|
+
s.add_dependency(%q<extlib>, [">= 0.9.3"])
|
33
36
|
end
|
34
37
|
end
|
data/lib/dm-mapping.rb
CHANGED
@@ -4,6 +4,10 @@ require 'dm-core'
|
|
4
4
|
|
5
5
|
module DataMapper
|
6
6
|
|
7
|
+
# default scope for Migration#auto_genclass!.
|
8
|
+
module Mapping # namespace
|
9
|
+
end
|
10
|
+
|
7
11
|
class << self
|
8
12
|
# ensure the using adapter is extended by dm-mapping
|
9
13
|
def ensure_required_dm_mapping_adapter
|
@@ -14,6 +18,8 @@ module DataMapper
|
|
14
18
|
# dirty hack that hook requirement after setup.
|
15
19
|
alias_method :__setup_alias_by_dm_mapping__, :setup
|
16
20
|
private :__setup_alias_by_dm_mapping__
|
21
|
+
# dirty hack that hook requirement after setup.
|
22
|
+
# usage is the same as original setup.
|
17
23
|
def setup name, uri_or_options
|
18
24
|
adapter = __setup_alias_by_dm_mapping__ name, uri_or_options
|
19
25
|
ensure_required_dm_mapping_adapter
|
@@ -3,22 +3,61 @@ module DataMapper
|
|
3
3
|
module Adapters
|
4
4
|
class AbstractAdapter
|
5
5
|
module Migration
|
6
|
-
# returns all tables in the repository.
|
7
|
-
#
|
6
|
+
# returns all tables' name in the repository.
|
7
|
+
# e.g.
|
8
|
+
# ['comments', 'users']
|
8
9
|
def storages
|
9
10
|
raise NotImplementedError
|
10
11
|
end
|
11
12
|
|
13
|
+
# returns all fields, with format [[name, type, attrs]]
|
14
|
+
# e.g.
|
15
|
+
# [['created_at', DateTime, {}],
|
16
|
+
# ['email', String, {:default => 'nospam@nospam.tw'}],
|
17
|
+
# ['id', Integer, {:serial => true}],
|
18
|
+
# ['salt_first', String, {}],
|
19
|
+
# ['salt_second', String, {}]]
|
12
20
|
def fields storage
|
13
21
|
raise NotImplementedError
|
14
22
|
end
|
15
23
|
|
24
|
+
# returns a hash with storage names in keys and
|
25
|
+
# corresponded fields in values. e.g.
|
26
|
+
# {'users' => [['id', Integer, {:serial => true}],
|
27
|
+
# ['email', String, {:default => 'nospam@nospam.tw'}],
|
28
|
+
# ['created_at', DateTime, {}],
|
29
|
+
# ['salt_first', String, {}],
|
30
|
+
# ['salt_second', String, {}]]}
|
31
|
+
# see Migration#storages and Migration#fields for detail
|
16
32
|
def storages_and_fields
|
17
33
|
storages.inject({}){ |result, storage|
|
18
34
|
result[storage] = fields(storage)
|
19
35
|
result
|
20
36
|
}
|
21
37
|
end
|
38
|
+
|
39
|
+
# automaticly generate all model classes and mapping
|
40
|
+
# all fields with mapping /.*/ for you.
|
41
|
+
# e.g.
|
42
|
+
# dm.auto_genclass!
|
43
|
+
# # => [DataMapper::Mapping::User,
|
44
|
+
# # DataMapper::Mapping::SchemaInfo,
|
45
|
+
# # DataMapper::Mapping::Session]
|
46
|
+
#
|
47
|
+
# you can change the scope of generated models:
|
48
|
+
# e.g.
|
49
|
+
# dm.auto_genclass! Object
|
50
|
+
# # => [User, SchemaInfo, Session]
|
51
|
+
def auto_genclass! scope = DataMapper::Mapping
|
52
|
+
require 'extlib'
|
53
|
+
storages_and_fields.map{ |storage, fields|
|
54
|
+
model = Class.new
|
55
|
+
model.__send__ :include, DataMapper::Resource
|
56
|
+
model.storage_names[:default] = storage
|
57
|
+
model.__send__ :mapping, /.*/
|
58
|
+
scope.const_set(Extlib::Inflection.classify(storage), model)
|
59
|
+
}
|
60
|
+
end
|
22
61
|
end
|
23
62
|
end
|
24
63
|
end
|
@@ -4,7 +4,7 @@ require 'dm-mapping/type_map'
|
|
4
4
|
|
5
5
|
module DataMapper
|
6
6
|
module Adapters
|
7
|
-
class Sqlite3Adapter < DataObjectsAdapter
|
7
|
+
class Sqlite3Adapter < DataObjectsAdapter #:nodoc: all
|
8
8
|
module Migration
|
9
9
|
def storages
|
10
10
|
# activerecord-2.1.0/lib/active_record/connection_adapters/sqlite_adapter.rb: 177
|
data/lib/dm-mapping/model.rb
CHANGED
@@ -1,13 +1,39 @@
|
|
1
1
|
|
2
2
|
module DataMapper
|
3
3
|
module Model
|
4
|
-
#
|
4
|
+
# it simply calls Migration#fields(self.storage_name)
|
5
|
+
# e.g.
|
6
|
+
# DataMapper.repository.adapter.fields storage_name
|
5
7
|
def fields
|
6
8
|
DataMapper.ensure_required_dm_mapping_adapter
|
7
9
|
DataMapper.repository.adapter.fields storage_name
|
8
10
|
end
|
9
11
|
|
10
12
|
protected
|
13
|
+
# it automaticly creates mappings from storage fields to properties.
|
14
|
+
# i.e. you don't have to specify any property if you are connecting
|
15
|
+
# to an existing database.
|
16
|
+
# you can pass it Regexp to map any field it matched, or just
|
17
|
+
# the field name in Symbol or String, or a Class telling it
|
18
|
+
# map any field which type equals to the Class.
|
19
|
+
# e.g.
|
20
|
+
# class User
|
21
|
+
# include DataMapper::Resource
|
22
|
+
# # maping all
|
23
|
+
# mapping /.*/
|
24
|
+
#
|
25
|
+
# # mapping for ended with _at, and started with salt_
|
26
|
+
# mapping /_at$/, /^salt_/
|
27
|
+
#
|
28
|
+
# # mapping id and email
|
29
|
+
# mapping :id, :email
|
30
|
+
#
|
31
|
+
# # mapping all fields with type String, and id
|
32
|
+
# mapping String, :id
|
33
|
+
#
|
34
|
+
# # mapping login, and all fields with type Integer
|
35
|
+
# mapping :login, Integer
|
36
|
+
# end
|
11
37
|
def mapping *targets
|
12
38
|
DataMapper.ensure_required_dm_mapping_adapter
|
13
39
|
targets << /.*/ if targets.empty?
|
data/lib/dm-mapping/type_map.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
|
2
2
|
module DataMapper
|
3
3
|
class TypeMap
|
4
|
+
# reversed lookup for primitive type to ruby type.
|
5
|
+
# e.g.
|
6
|
+
# lookup_primitive('DATETIME')
|
7
|
+
# # => { DateTime => {:auto_validation => true} }
|
4
8
|
def lookup_primitive primitive, type_map = self
|
5
9
|
type_map.chains.find{ |type, chain|
|
6
10
|
primitive == chain.primitive
|
data/lib/dm-mapping/version.rb
CHANGED
@@ -25,17 +25,26 @@ class DMMTest < Test::Unit::TestCase
|
|
25
25
|
property :body, Text
|
26
26
|
end
|
27
27
|
|
28
|
+
|
29
|
+
# override it to test with another adapter
|
30
|
+
# NOTE:
|
31
|
+
# please provide an clean database because it is a destructive test!!
|
32
|
+
def setup_data_mapper
|
33
|
+
DataMapper.setup(:default, 'sqlite3:tmp.db')
|
34
|
+
end
|
35
|
+
|
36
|
+
|
28
37
|
class Model; end
|
29
38
|
|
30
39
|
def create_fake_model
|
31
|
-
[Model.dup.__send__(:include, DataMapper::Resource),
|
32
|
-
|
40
|
+
[ Model.dup.__send__(:include, DataMapper::Resource),
|
41
|
+
setup_data_mapper ]
|
33
42
|
end
|
34
43
|
|
35
|
-
|
36
|
-
def dm; @@dm; end
|
37
|
-
|
44
|
+
attr_reader :dm
|
38
45
|
def setup
|
46
|
+
@dm = setup_data_mapper
|
47
|
+
# this is significant faster than DataMapper.auto_migrate!
|
39
48
|
User.auto_migrate!
|
40
49
|
Comment.auto_migrate!
|
41
50
|
end
|
@@ -134,4 +143,25 @@ class DMMTest < Test::Unit::TestCase
|
|
134
143
|
}
|
135
144
|
end
|
136
145
|
|
146
|
+
def test_auto_genclass
|
147
|
+
for_test_auto_genclass
|
148
|
+
for_test_auto_genclass Object
|
149
|
+
end
|
150
|
+
|
151
|
+
def for_test_auto_genclass scope = DataMapper::Mapping
|
152
|
+
assert_equal ["#{scope == Object ? '' : "#{scope}::"}DmmTestComment",
|
153
|
+
"#{scope == Object ? '' : "#{scope}::"}DmmTestUser"],
|
154
|
+
dm.auto_genclass!(scope).map(&:to_s).sort
|
155
|
+
|
156
|
+
comment = scope.const_get('DmmTestComment')
|
157
|
+
|
158
|
+
assert_equal comment_fields, comment.fields.sort
|
159
|
+
|
160
|
+
test_create_comment
|
161
|
+
|
162
|
+
assert_equal 'XD', comment.first.title
|
163
|
+
comment.create(:title => 'orz', :body => 'dm-mapping')
|
164
|
+
assert_equal 'dm-mapping', comment.get(2).body
|
165
|
+
end
|
166
|
+
|
137
167
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-mapping
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Lin Jen-Shin (a.k.a. godfat \xE7\x9C\x9F\xE5\xB8\xB8)"
|
@@ -22,8 +22,18 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 0.9.3
|
24
24
|
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: extlib
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.9.3
|
34
|
+
version:
|
25
35
|
description: DataMapper plugin that helps you manipulate an existing database. It creates mappings between existing columns and model's properties.
|
26
|
-
email:
|
36
|
+
email: godfat (XD) godfat.org
|
27
37
|
executables: []
|
28
38
|
|
29
39
|
extensions: []
|
@@ -36,18 +46,6 @@ extra_rdoc_files:
|
|
36
46
|
- README
|
37
47
|
- TODO
|
38
48
|
- dm-mapping.gemspec
|
39
|
-
- tasks/ann.rake
|
40
|
-
- tasks/bones.rake
|
41
|
-
- tasks/gem.rake
|
42
|
-
- tasks/git.rake
|
43
|
-
- tasks/manifest.rake
|
44
|
-
- tasks/notes.rake
|
45
|
-
- tasks/post_load.rake
|
46
|
-
- tasks/rdoc.rake
|
47
|
-
- tasks/rubyforge.rake
|
48
|
-
- tasks/spec.rake
|
49
|
-
- tasks/svn.rake
|
50
|
-
- tasks/test.rake
|
51
49
|
files:
|
52
50
|
- .gitignore
|
53
51
|
- CHANGES
|
@@ -76,7 +74,7 @@ files:
|
|
76
74
|
- tasks/spec.rake
|
77
75
|
- tasks/svn.rake
|
78
76
|
- tasks/test.rake
|
79
|
-
- test/
|
77
|
+
- test/test_sqlite3.rb
|
80
78
|
has_rdoc: true
|
81
79
|
homepage: http://github.com/godfat/dm-mapping
|
82
80
|
post_install_message:
|
@@ -110,4 +108,4 @@ signing_key:
|
|
110
108
|
specification_version: 2
|
111
109
|
summary: DataMapper plugin that helps you manipulate an existing database. It creates mappings between existing columns and model's properties.
|
112
110
|
test_files:
|
113
|
-
- test/
|
111
|
+
- test/test_sqlite3.rb
|