dm-mapping 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,5 +1,8 @@
1
1
  = dm-mapper changes history
2
2
 
3
+ === dm-mapping 0.4.1, 2008-08-14
4
+ * removed type hack, replaced with rejecting special type to lookup.
5
+
3
6
  === dm-mapping 0.4.0, 2008-08-04
4
7
  * added Migration#auto_genclass!.
5
8
  * updated README.
data/README CHANGED
@@ -1,4 +1,4 @@
1
- = dm-mapping 0.4.0
1
+ = dm-mapping 0.4.1
2
2
  by Lin Jen-Shin (a.k.a. godfat-真常[http://godfat.org])
3
3
  godfat (XD) godfat.org
4
4
 
@@ -23,7 +23,7 @@ by Lin Jen-Shin (a.k.a. godfat-真常[http://godfat.org])
23
23
 
24
24
  class User
25
25
  include DataMapper::Resource
26
- # maping all
26
+ # mapping all
27
27
  mapping /.*/
28
28
 
29
29
  # mapping for ended with _at, and started with salt_
@@ -46,10 +46,10 @@ by Lin Jen-Shin (a.k.a. godfat-真常[http://godfat.org])
46
46
  # there's no guarantee of the order in fields array
47
47
  User.fields.sort
48
48
  # => [['created_at', DateTime, {}],
49
- ['email', String, {:default => 'nospam@nospam.tw'}],
49
+ ['email', String, {:size => 255, :default => 'nospam@nospam.tw'}],
50
50
  ['id', Integer, {:serial => true}],
51
- ['salt_first', String, {}],
52
- ['salt_second', String, {}]]
51
+ ['salt_first', String, {:size => 50}],
52
+ ['salt_second', String, {:size => 50}]]
53
53
 
54
54
  dm.fields('users').sort == User.fields.sort
55
55
  # => true
@@ -58,8 +58,8 @@ by Lin Jen-Shin (a.k.a. godfat-真常[http://godfat.org])
58
58
  # => {'users' => [['id', Integer, {:serial => true}],
59
59
  ['email', String, {:default => 'nospam@nospam.tw'}],
60
60
  ['created_at', DateTime, {}],
61
- ['salt_first', String, {}],
62
- ['salt_second', String, {}]]}
61
+ ['salt_first', String, {:size => 50}],
62
+ ['salt_second', String, {:size => 50}]]}
63
63
 
64
64
  # there's no guarantee of the order in returned array
65
65
  dm.auto_genclass!
@@ -74,6 +74,7 @@ by Lin Jen-Shin (a.k.a. godfat-真常[http://godfat.org])
74
74
  == REQUIREMENTS:
75
75
 
76
76
  * dm-core 0.9.3
77
+ * at least one do_* adapter (currently only sqlite3 is supported)
77
78
 
78
79
  == INSTALL:
79
80
 
data/Rakefile CHANGED
@@ -45,15 +45,16 @@ PROJ.gem.dependencies << ['dm-core', '>=0.9.3'] << ['extlib', '>=0.9.3']
45
45
  # PROJ.gem.files = []
46
46
 
47
47
  PROJ.manifest_file = 'Manifest'
48
- PROJ.exclude << 'Manifest' << '^tmp' << 'tmp$' << '^pkg'
48
+ PROJ.exclude += ['Manifest', '^tmp', 'tmp$', '^pkg', '.gitignore', '^ann-']
49
49
 
50
50
  PROJ.readme_file = 'README'
51
51
  PROJ.rdoc.main = 'README'
52
52
  PROJ.rdoc.remote_dir = 'dm-mapping'
53
- PROJ.rdoc.exclude << 'Rakefile' << '^tasks' << '^test'
53
+ PROJ.rdoc.exclude += ['Rakefile', '^tasks', '^test']
54
54
  PROJ.rdoc.include << '\w+'
55
55
  PROJ.rdoc.opts << '--diagram' if !WIN32 and `which dot` =~ %r/\/dot/
56
- PROJ.rdoc.opts << '--charset=utf-8' << '--inline-source' << '--line-numbers' << '--promiscuous'
56
+ PROJ.rdoc.opts += ['--charset=utf-8', '--inline-source',
57
+ '--line-numbers', '--promiscuous']
57
58
 
58
59
  PROJ.spec.opts << '--color'
59
60
 
data/TODO CHANGED
@@ -1,4 +1,5 @@
1
1
  = dm-mapping todo list
2
2
 
3
- * postgresql adapter in 0.5
4
- * mysql adapter in 0.6
3
+ * automatic determine model relationship
4
+ * mysql adapter in 0.5
5
+ * postgresql adapter in 0.6
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.0"
4
+ s.version = "0.4.1"
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
- s.date = %q{2008-08-04}
8
+ s.date = %q{2008-08-14}
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
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"]
11
+ s.extra_rdoc_files = ["CHANGES", "LICENSE", "NOTICE", "README", "TODO", "dm-mapping.gemspec"]
12
+ s.files = ["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"]
@@ -23,9 +23,6 @@ module DataMapper
23
23
  type, chain = self.class.type_map.
24
24
  lookup_primitive(field.type.gsub(/\(\d+\)/, '').upcase)
25
25
 
26
- # stupid hack
27
- type = String if type == Class
28
-
29
26
  attrs = {}
30
27
  attrs[:serial] = true if field.pk != 0
31
28
  attrs[:nullable] = true if field.notnull != 0 && !attrs[:serial]
@@ -7,7 +7,11 @@ module DataMapper
7
7
  # # => { DateTime => {:auto_validation => true} }
8
8
  def lookup_primitive primitive, type_map = self
9
9
  type_map.chains.find{ |type, chain|
10
- primitive == chain.primitive
10
+ primitive == chain.primitive &&
11
+ [Integer, Float, BigDecimal,
12
+ String, TrueClass, FalseClass,
13
+ DateTime, Date, Time,
14
+ DM::Text, DM::Boolean].member?(type)
11
15
  } or lookup_primitive(primitive, type_map.parent)
12
16
  end
13
17
  end
@@ -1,5 +1,5 @@
1
1
  module DataMapper
2
2
  module Mapping
3
- VERSION = '0.4.0' unless defined?(DataMapper::Mapping::VERSION)
3
+ VERSION = '0.4.1' unless defined?(DataMapper::Mapping::VERSION)
4
4
  end
5
5
  end
data/tasks/manifest.rake CHANGED
@@ -15,9 +15,9 @@ namespace :manifest do
15
15
  lines.map! do |line|
16
16
  case line
17
17
  when %r/^(-{3}|\+{3})/; nil
18
- when %r/^@/; Console::ANSICode.blue line
19
- when %r/^\+/; Console::ANSICode.green line
20
- when %r/^\-/; Console::ANSICode.red line
18
+ when %r/^@/; ANSICode.blue line
19
+ when %r/^\+/; ANSICode.green line
20
+ when %r/^\-/; ANSICode.red line
21
21
  else line end
22
22
  end
23
23
  end
data/test/test_sqlite3.rb CHANGED
@@ -50,17 +50,17 @@ class DMMTest < Test::Unit::TestCase
50
50
  end
51
51
 
52
52
  def user_fields
53
- [['created_at', DateTime, {}],
54
- ['id', Integer, {:serial => true}],
55
- ['login', String, {}],
56
- ['sig', DataMapper::Types::Text, {}]]
53
+ [['created_at', DateTime, {}],
54
+ ['id', Integer, {:serial => true}],
55
+ ['login', String, {:size => 50}],
56
+ ['sig', DM::Text, {}]]
57
57
  end
58
58
 
59
59
  def comment_fields
60
- [['body', DataMapper::Types::Text, {}],
61
- ['id', Integer , {:serial => true}],
62
- ['title', String , {:default => 'default title'}],
63
- ['user_id', Integer , {}]]
60
+ [['body', DM::Text, {}],
61
+ ['id', Integer, {:serial => true}],
62
+ ['title', String, {:size => 50, :default => 'default title'}],
63
+ ['user_id', Integer, {}]]
64
64
  end
65
65
 
66
66
  def test_storages
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.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Lin Jen-Shin (a.k.a. godfat \xE7\x9C\x9F\xE5\xB8\xB8)"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-04 00:00:00 +08:00
12
+ date: 2008-08-14 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -39,7 +39,6 @@ executables: []
39
39
  extensions: []
40
40
 
41
41
  extra_rdoc_files:
42
- - .gitignore
43
42
  - CHANGES
44
43
  - LICENSE
45
44
  - NOTICE
@@ -47,7 +46,6 @@ extra_rdoc_files:
47
46
  - TODO
48
47
  - dm-mapping.gemspec
49
48
  files:
50
- - .gitignore
51
49
  - CHANGES
52
50
  - LICENSE
53
51
  - NOTICE
data/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- tmp*
2
- pkg
3
- doc