datamapper 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. data/CHANGELOG +10 -2
  2. data/environment.rb +0 -3
  3. data/lib/data_mapper.rb +2 -0
  4. data/lib/data_mapper/adapters/abstract_adapter.rb +2 -2
  5. data/lib/data_mapper/adapters/data_object_adapter.rb +63 -73
  6. data/lib/data_mapper/adapters/mysql_adapter.rb +2 -13
  7. data/lib/data_mapper/adapters/postgresql_adapter.rb +3 -2
  8. data/lib/data_mapper/adapters/sql/coersion.rb +29 -11
  9. data/lib/data_mapper/adapters/sql/commands/load_command.rb +13 -9
  10. data/lib/data_mapper/adapters/sql/mappings/table.rb +7 -3
  11. data/lib/data_mapper/adapters/sql/quoting.rb +0 -53
  12. data/lib/data_mapper/adapters/sqlite3_adapter.rb +2 -1
  13. data/lib/data_mapper/base.rb +25 -9
  14. data/lib/data_mapper/context.rb +2 -2
  15. data/lib/data_mapper/database.rb +6 -6
  16. data/lib/data_mapper/support/active_record_impersonation.rb +1 -1
  17. data/lib/data_mapper/support/serialization.rb +10 -2
  18. data/lib/data_mapper/support/silence.rb +10 -0
  19. data/lib/data_mapper/support/string.rb +21 -1
  20. data/lib/data_mapper/validations/confirmation_validator.rb +1 -3
  21. data/lib/data_mapper/validations/format_validator.rb +6 -6
  22. data/lib/data_mapper/validations/generic_validator.rb +0 -5
  23. data/lib/data_mapper/validations/length_validator.rb +14 -13
  24. data/lib/data_mapper/validations/required_field_validator.rb +2 -8
  25. data/lib/data_mapper/validations/unique_validator.rb +1 -7
  26. data/plugins/dataobjects/do.rb +94 -2
  27. data/plugins/dataobjects/do_mysql.rb +17 -17
  28. data/plugins/dataobjects/do_postgres.rb +34 -15
  29. data/plugins/dataobjects/do_sqlite3.rb +9 -6
  30. data/rakefile.rb +3 -2
  31. data/spec/base_spec.rb +28 -0
  32. data/spec/dataobjects_spec.rb +2 -1
  33. data/spec/load_command_spec.rb +1 -1
  34. data/spec/serialization_spec.rb +2 -2
  35. data/spec/spec_helper.rb +1 -1
  36. data/spec/support_spec.rb +7 -0
  37. data/spec/validations_spec.rb +13 -0
  38. metadata +14 -6
  39. data/plugins/dataobjects/swig_mysql/Makefile +0 -146
  40. data/plugins/dataobjects/swig_mysql/mysql_c.o +0 -0
  41. data/plugins/dataobjects/swig_postgres/Makefile +0 -146
  42. data/plugins/dataobjects/swig_sqlite/db +0 -0
@@ -80,4 +80,17 @@ describe DataMapper::Validations do
80
80
  o.errors.should have(1).full_messages
81
81
  end
82
82
 
83
+ it 'should translate error messages' do
84
+ String::translations["%s must not be blank"] = "%s should not be blank!"
85
+
86
+ beth = Cow.new
87
+ beth.age = 30
88
+
89
+ beth.should_not be_valid
90
+
91
+ beth.errors.full_messages.should include('Name should not be blank!')
92
+
93
+ String::translations.delete("%s must not be blank")
94
+ end
95
+
83
96
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: datamapper
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.2.2
7
- date: 2007-11-02 00:00:00 -05:00
6
+ version: 0.2.3
7
+ date: 2007-11-05 00:00:00 -06:00
8
8
  summary: An Object/Relational Mapper for Ruby
9
9
  require_paths:
10
10
  - lib
@@ -69,6 +69,7 @@ files:
69
69
  - lib/data_mapper/support/enumerable.rb
70
70
  - lib/data_mapper/support/inflector.rb
71
71
  - lib/data_mapper/support/serialization.rb
72
+ - lib/data_mapper/support/silence.rb
72
73
  - lib/data_mapper/support/string.rb
73
74
  - lib/data_mapper/support/symbol.rb
74
75
  - lib/data_mapper/support/weak_hash.rb
@@ -116,6 +117,7 @@ files:
116
117
  - spec/serialization_spec.rb
117
118
  - spec/single_table_inheritance_spec.rb
118
119
  - spec/spec_helper.rb
120
+ - spec/support_spec.rb
119
121
  - spec/symbolic_operators_spec.rb
120
122
  - spec/validates_confirmation_of_spec.rb
121
123
  - spec/validates_format_of_spec.rb
@@ -157,18 +159,14 @@ files:
157
159
  - plugins/dataobjects/spec/spec_helper.rb
158
160
  - plugins/dataobjects/swig_mysql
159
161
  - plugins/dataobjects/swig_mysql/extconf.rb
160
- - plugins/dataobjects/swig_mysql/Makefile
161
162
  - plugins/dataobjects/swig_mysql/mysql_c.c
162
163
  - plugins/dataobjects/swig_mysql/mysql_c.i
163
- - plugins/dataobjects/swig_mysql/mysql_c.o
164
164
  - plugins/dataobjects/swig_mysql/mysql_supp.i
165
165
  - plugins/dataobjects/swig_postgres
166
166
  - plugins/dataobjects/swig_postgres/extconf.rb
167
- - plugins/dataobjects/swig_postgres/Makefile
168
167
  - plugins/dataobjects/swig_postgres/postgres_c.c
169
168
  - plugins/dataobjects/swig_postgres/postgres_c.i
170
169
  - plugins/dataobjects/swig_sqlite
171
- - plugins/dataobjects/swig_sqlite/db
172
170
  - plugins/dataobjects/swig_sqlite/extconf.rb
173
171
  - plugins/dataobjects/swig_sqlite/sqlite3_c.c
174
172
  - plugins/dataobjects/swig_sqlite/sqlite_c.i
@@ -220,6 +218,7 @@ extra_rdoc_files:
220
218
  - lib/data_mapper/support/enumerable.rb
221
219
  - lib/data_mapper/support/inflector.rb
222
220
  - lib/data_mapper/support/serialization.rb
221
+ - lib/data_mapper/support/silence.rb
223
222
  - lib/data_mapper/support/string.rb
224
223
  - lib/data_mapper/support/symbol.rb
225
224
  - lib/data_mapper/support/weak_hash.rb
@@ -268,3 +267,12 @@ dependencies:
268
267
  - !ruby/object:Gem::Version
269
268
  version: 0.0.0
270
269
  version:
270
+ - !ruby/object:Gem::Dependency
271
+ name: rspec
272
+ version_requirement:
273
+ version_requirements: !ruby/object:Gem::Version::Requirement
274
+ requirements:
275
+ - - ">"
276
+ - !ruby/object:Gem::Version
277
+ version: 0.0.0
278
+ version:
@@ -1,146 +0,0 @@
1
-
2
- SHELL = /bin/sh
3
-
4
- #### Start of system configuration section. ####
5
-
6
- srcdir = .
7
- topdir = /opt/local/lib/ruby/1.8/i686-darwin8.9.1
8
- hdrdir = $(topdir)
9
- VPATH = $(srcdir):$(topdir):$(hdrdir)
10
- prefix = $(DESTDIR)/opt/local
11
- exec_prefix = $(DESTDIR)/opt/local
12
- sitedir = $(prefix)/lib/ruby/site_ruby
13
- rubylibdir = $(libdir)/ruby/$(ruby_version)
14
- archdir = $(rubylibdir)/$(arch)
15
- sbindir = $(exec_prefix)/sbin
16
- vendordir = $(prefix)/lib/ruby/vendor_ruby
17
- datadir = $(prefix)/share
18
- includedir = $(prefix)/include
19
- infodir = $(prefix)/info
20
- sysconfdir = $(prefix)/etc
21
- mandir = $(DESTDIR)/opt/local/share/man
22
- libdir = $(DESTDIR)/opt/local/lib
23
- sharedstatedir = $(prefix)/com
24
- oldincludedir = $(DESTDIR)/usr/include
25
- sitearchdir = $(sitelibdir)/$(sitearch)
26
- vendorarchdir = $(vendorlibdir)/$(vendorarch)
27
- bindir = $(exec_prefix)/bin
28
- localstatedir = $(prefix)/var
29
- vendorlibdir = $(vendordir)/$(ruby_version)
30
- sitelibdir = $(sitedir)/$(ruby_version)
31
- libexecdir = $(exec_prefix)/libexec
32
-
33
- CC = gcc
34
- LIBRUBY = $(LIBRUBY_SO)
35
- LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
36
- LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
37
- LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
38
-
39
- RUBY_EXTCONF_H =
40
- CFLAGS = -fno-common -O -pipe -I/opt/local/include -fno-common -pipe -fno-common -Wall
41
- INCFLAGS = -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.9.1 -I.
42
- CPPFLAGS = -I/usr/local/mysql/include -O -pipe -I/opt/local/include
43
- CXXFLAGS = $(CFLAGS)
44
- DLDFLAGS = -L/opt/local/lib
45
- LDSHARED = cc -dynamic -bundle -undefined suppress -flat_namespace
46
- AR = ar
47
- EXEEXT =
48
-
49
- RUBY_INSTALL_NAME = ruby
50
- RUBY_SO_NAME = ruby
51
- arch = i686-darwin8.9.1
52
- sitearch = i686-darwin8.9.1
53
- vendorarch = i686-darwin8.9.1
54
- ruby_version = 1.8
55
- ruby = /opt/local/bin/ruby
56
- RUBY = $(ruby)
57
- RM = rm -f
58
- MAKEDIRS = mkdir -p
59
- INSTALL = /usr/bin/install -c
60
- INSTALL_PROG = $(INSTALL) -m 0755
61
- INSTALL_DATA = $(INSTALL) -m 644
62
- COPY = cp
63
-
64
- #### End of system configuration section. ####
65
-
66
- preload =
67
-
68
- libpath = $(libdir) /usr/local/mysql/lib -lmysqlclient_r -lz -lm
69
- LIBPATH = -L"$(libdir)" -L""/usr/local/mysql/lib -lmysqlclient_r -lz -lm""
70
- DEFFILE =
71
-
72
- CLEANFILES =
73
- DISTCLEANFILES =
74
-
75
- extout =
76
- extout_prefix =
77
- target_prefix =
78
- LOCAL_LIBS =
79
- LIBS = $(LIBRUBYARG_SHARED) -lmysqlclient -lpthread -ldl -lobjc
80
- SRCS = mysql_c.c
81
- OBJS = mysql_c.o
82
- TARGET = mysql_c
83
- DLLIB = $(TARGET).bundle
84
- EXTSTATIC =
85
- STATIC_LIB =
86
-
87
- RUBYCOMMONDIR = $(sitedir)$(target_prefix)
88
- RUBYLIBDIR = $(sitelibdir)$(target_prefix)
89
- RUBYARCHDIR = $(sitearchdir)$(target_prefix)
90
-
91
- TARGET_SO = $(DLLIB)
92
- CLEANLIBS = $(TARGET).bundle $(TARGET).il? $(TARGET).tds $(TARGET).map
93
- CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
94
-
95
- all: $(DLLIB)
96
- static: $(STATIC_LIB)
97
-
98
- clean:
99
- @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
100
-
101
- distclean: clean
102
- @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
103
- @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
104
-
105
- realclean: distclean
106
- install: install-so install-rb
107
-
108
- install-so: $(RUBYARCHDIR)
109
- install-so: $(RUBYARCHDIR)/$(DLLIB)
110
- $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
111
- $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
112
- install-rb: pre-install-rb install-rb-default
113
- install-rb-default: pre-install-rb-default
114
- pre-install-rb: Makefile
115
- pre-install-rb-default: Makefile
116
- $(RUBYARCHDIR):
117
- $(MAKEDIRS) $@
118
-
119
- site-install: site-install-so site-install-rb
120
- site-install-so: install-so
121
- site-install-rb: install-rb
122
-
123
- .SUFFIXES: .c .m .cc .cxx .cpp .C .o
124
-
125
- .cc.o:
126
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
127
-
128
- .cxx.o:
129
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
130
-
131
- .cpp.o:
132
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
133
-
134
- .C.o:
135
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
136
-
137
- .c.o:
138
- $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
139
-
140
- $(DLLIB): $(OBJS)
141
- @-$(RM) $@
142
- $(LDSHARED) $(DLDFLAGS) $(LIBPATH) -o $@ $(OBJS) $(LOCAL_LIBS) $(LIBS)
143
-
144
-
145
-
146
- $(OBJS): ruby.h defines.h
@@ -1,146 +0,0 @@
1
-
2
- SHELL = /bin/sh
3
-
4
- #### Start of system configuration section. ####
5
-
6
- srcdir = .
7
- topdir = /opt/local/lib/ruby/1.8/i686-darwin8.10.1
8
- hdrdir = $(topdir)
9
- VPATH = $(srcdir):$(topdir):$(hdrdir)
10
- prefix = $(DESTDIR)/opt/local
11
- exec_prefix = $(DESTDIR)/opt/local
12
- sitedir = $(prefix)/lib/ruby/site_ruby
13
- rubylibdir = $(libdir)/ruby/$(ruby_version)
14
- archdir = $(rubylibdir)/$(arch)
15
- sbindir = $(exec_prefix)/sbin
16
- vendordir = $(prefix)/lib/ruby/vendor_ruby
17
- datadir = $(prefix)/share
18
- includedir = $(prefix)/include
19
- infodir = $(prefix)/info
20
- sysconfdir = $(prefix)/etc
21
- mandir = $(DESTDIR)/opt/local/share/man
22
- libdir = $(DESTDIR)/opt/local/lib
23
- sharedstatedir = $(prefix)/com
24
- oldincludedir = $(DESTDIR)/usr/include
25
- sitearchdir = $(sitelibdir)/$(sitearch)
26
- vendorarchdir = $(vendorlibdir)/$(vendorarch)
27
- bindir = $(exec_prefix)/bin
28
- localstatedir = $(prefix)/var
29
- vendorlibdir = $(vendordir)/$(ruby_version)
30
- sitelibdir = $(sitedir)/$(ruby_version)
31
- libexecdir = $(exec_prefix)/libexec
32
-
33
- CC = gcc
34
- LIBRUBY = $(LIBRUBY_SO)
35
- LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
36
- LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
37
- LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
38
-
39
- RUBY_EXTCONF_H =
40
- CFLAGS = -fno-common -O2 -fno-common -pipe -fno-common -Wall
41
- INCFLAGS = -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.10.1 -I.
42
- CPPFLAGS = -DHAVE_LIBPQ_FE_H -DHAVE_LIBPQ_LIBPQ_FS_H -DHAVE_PQSETCLIENTENCODING -DHAVE_PG_ENCODING_TO_CHAR -DHAVE_PQFREEMEM -I/opt/local/include/postgresql82 -I/opt/local/include
43
- CXXFLAGS = $(CFLAGS)
44
- DLDFLAGS = -L/opt/local/lib
45
- LDSHARED = cc -dynamic -bundle -undefined suppress -flat_namespace
46
- AR = ar
47
- EXEEXT =
48
-
49
- RUBY_INSTALL_NAME = ruby
50
- RUBY_SO_NAME = ruby
51
- arch = i686-darwin8.10.1
52
- sitearch = i686-darwin8.10.1
53
- vendorarch = i686-darwin8.10.1
54
- ruby_version = 1.8
55
- ruby = /opt/local/bin/ruby
56
- RUBY = $(ruby)
57
- RM = rm -f
58
- MAKEDIRS = mkdir -p
59
- INSTALL = /usr/bin/install -c
60
- INSTALL_PROG = $(INSTALL) -m 0755
61
- INSTALL_DATA = $(INSTALL) -m 644
62
- COPY = cp
63
-
64
- #### End of system configuration section. ####
65
-
66
- preload =
67
-
68
- libpath = $(libdir) /opt/local/lib/postgresql82
69
- LIBPATH = -L"$(libdir)" -L"/opt/local/lib/postgresql82"
70
- DEFFILE =
71
-
72
- CLEANFILES =
73
- DISTCLEANFILES =
74
-
75
- extout =
76
- extout_prefix =
77
- target_prefix =
78
- LOCAL_LIBS =
79
- LIBS = $(LIBRUBYARG_SHARED) -lpq -lpthread -ldl -lobjc
80
- SRCS = postgres_c.c
81
- OBJS = postgres_c.o
82
- TARGET = postgres_c
83
- DLLIB = $(TARGET).bundle
84
- EXTSTATIC =
85
- STATIC_LIB =
86
-
87
- RUBYCOMMONDIR = $(sitedir)$(target_prefix)
88
- RUBYLIBDIR = $(sitelibdir)$(target_prefix)
89
- RUBYARCHDIR = $(sitearchdir)$(target_prefix)
90
-
91
- TARGET_SO = $(DLLIB)
92
- CLEANLIBS = $(TARGET).bundle $(TARGET).il? $(TARGET).tds $(TARGET).map
93
- CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
94
-
95
- all: $(DLLIB)
96
- static: $(STATIC_LIB)
97
-
98
- clean:
99
- @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
100
-
101
- distclean: clean
102
- @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
103
- @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
104
-
105
- realclean: distclean
106
- install: install-so install-rb
107
-
108
- install-so: $(RUBYARCHDIR)
109
- install-so: $(RUBYARCHDIR)/$(DLLIB)
110
- $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
111
- $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
112
- install-rb: pre-install-rb install-rb-default
113
- install-rb-default: pre-install-rb-default
114
- pre-install-rb: Makefile
115
- pre-install-rb-default: Makefile
116
- $(RUBYARCHDIR):
117
- $(MAKEDIRS) $@
118
-
119
- site-install: site-install-so site-install-rb
120
- site-install-so: install-so
121
- site-install-rb: install-rb
122
-
123
- .SUFFIXES: .c .m .cc .cxx .cpp .C .o
124
-
125
- .cc.o:
126
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
127
-
128
- .cxx.o:
129
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
130
-
131
- .cpp.o:
132
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
133
-
134
- .C.o:
135
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
136
-
137
- .c.o:
138
- $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
139
-
140
- $(DLLIB): $(OBJS)
141
- @-$(RM) $@
142
- $(LDSHARED) $(DLDFLAGS) $(LIBPATH) -o $@ $(OBJS) $(LOCAL_LIBS) $(LIBS)
143
-
144
-
145
-
146
- $(OBJS): ruby.h defines.h
Binary file