dm-core 1.2.0.rc1 → 1.2.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +11 -4
- data/VERSION +1 -1
- data/dm-core.gemspec +2 -2
- data/lib/dm-core/property/binary.rb +15 -0
- data/lib/dm-core/property/decimal.rb +2 -2
- data/lib/dm-core/spec/shared/semipublic/property_spec.rb +4 -10
- data/spec/public/property/binary_spec.rb +19 -0
- data/spec/semipublic/property/boolean_spec.rb +0 -18
- metadata +16 -16
data/Gemfile
CHANGED
@@ -5,9 +5,10 @@ source 'http://rubygems.org'
|
|
5
5
|
SOURCE = ENV.fetch('SOURCE', :git).to_sym
|
6
6
|
REPO_POSTFIX = SOURCE == :path ? '' : '.git'
|
7
7
|
DATAMAPPER = SOURCE == :path ? Pathname(__FILE__).dirname.parent : 'http://github.com/datamapper'
|
8
|
-
DM_VERSION = '~> 1.2.0.
|
8
|
+
DM_VERSION = '~> 1.2.0.rc2'
|
9
9
|
DO_VERSION = '~> 0.10.6'
|
10
10
|
DM_DO_ADAPTERS = %w[ sqlite postgres mysql oracle sqlserver ]
|
11
|
+
CURRENT_BRANCH = ENV.fetch('GIT_BRANCH', 'master')
|
11
12
|
|
12
13
|
gem 'addressable', '~> 2.2.6'
|
13
14
|
|
@@ -48,18 +49,24 @@ group :datamapper do
|
|
48
49
|
gem "do_#{adapter}", DO_VERSION, do_options.dup
|
49
50
|
end
|
50
51
|
|
51
|
-
gem 'dm-do-adapter', DM_VERSION,
|
52
|
+
gem 'dm-do-adapter', DM_VERSION,
|
53
|
+
SOURCE => "#{DATAMAPPER}/dm-do-adapter#{REPO_POSTFIX}",
|
54
|
+
:branch => CURRENT_BRANCH
|
52
55
|
end
|
53
56
|
|
54
57
|
adapters.each do |adapter|
|
55
|
-
gem "dm-#{adapter}-adapter", ENV.fetch('ADAPTER_VERSION', DM_VERSION),
|
58
|
+
gem "dm-#{adapter}-adapter", ENV.fetch('ADAPTER_VERSION', DM_VERSION),
|
59
|
+
SOURCE => "#{DATAMAPPER}/dm-#{adapter}-adapter#{REPO_POSTFIX}",
|
60
|
+
:branch => CURRENT_BRANCH
|
56
61
|
end
|
57
62
|
|
58
63
|
plugins = ENV['PLUGINS'] || ENV['PLUGIN']
|
59
64
|
plugins = plugins.to_s.tr(',', ' ').split.push('dm-migrations').uniq
|
60
65
|
|
61
66
|
plugins.each do |plugin|
|
62
|
-
gem plugin, DM_VERSION,
|
67
|
+
gem plugin, DM_VERSION,
|
68
|
+
SOURCE => "#{DATAMAPPER}/#{plugin}#{REPO_POSTFIX}",
|
69
|
+
:branch => CURRENT_BRANCH
|
63
70
|
end
|
64
71
|
|
65
72
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.0.
|
1
|
+
1.2.0.rc2
|
data/dm-core.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "dm-core"
|
8
|
-
s.version = "1.2.0.
|
8
|
+
s.version = "1.2.0.rc2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dan Kubb"]
|
12
|
-
s.date = "2011-09-
|
12
|
+
s.date = "2011-09-20"
|
13
13
|
s.description = "Faster, Better, Simpler."
|
14
14
|
s.email = "dan.kubb@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -2,6 +2,21 @@ module DataMapper
|
|
2
2
|
class Property
|
3
3
|
class Binary < String
|
4
4
|
include PassThroughLoadDump
|
5
|
+
|
6
|
+
if RUBY_VERSION >= "1.9"
|
7
|
+
|
8
|
+
def load(value)
|
9
|
+
super.dup.force_encoding("BINARY") unless value.nil?
|
10
|
+
end
|
11
|
+
|
12
|
+
def dump(value)
|
13
|
+
value.dup.force_encoding("BINARY") unless value.nil?
|
14
|
+
rescue
|
15
|
+
value
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
5
20
|
end # class Binary
|
6
21
|
end # class Property
|
7
22
|
end # module DataMapper
|
@@ -15,8 +15,8 @@ module DataMapper
|
|
15
15
|
super
|
16
16
|
|
17
17
|
[ :scale, :precision ].each do |key|
|
18
|
-
unless options.key?(key)
|
19
|
-
warn "options[#{key.inspect}] should be set for #{self.class}, defaulting to #{send(key).inspect}"
|
18
|
+
unless @options.key?(key)
|
19
|
+
warn "options[#{key.inspect}] should be set for #{self.class}, defaulting to #{send(key).inspect} (#{caller.first})"
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -73,19 +73,13 @@ share_examples_for 'A semipublic Property' do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
describe '#load' do
|
76
|
-
before :all do
|
77
|
-
@value = mock(@value)
|
78
|
-
end
|
79
|
-
|
80
76
|
subject { @property.load(@value) }
|
81
77
|
|
82
|
-
|
83
|
-
|
84
|
-
return_value = mock(@other_value)
|
85
|
-
@property.should_receive(:typecast).with(@value).and_return(return_value)
|
86
|
-
should == return_value
|
87
|
-
end
|
78
|
+
before do
|
79
|
+
@property.should_receive(:typecast).with(@value).and_return(@value)
|
88
80
|
end
|
81
|
+
|
82
|
+
it { should eql(@value) }
|
89
83
|
end
|
90
84
|
|
91
85
|
describe "#typecast" do
|
@@ -19,4 +19,23 @@ describe DataMapper::Property::Binary do
|
|
19
19
|
|
20
20
|
it { should eql(:primitive => @primitive, :length => 50) }
|
21
21
|
end
|
22
|
+
|
23
|
+
if RUBY_VERSION >= "1.9"
|
24
|
+
describe 'encoding' do
|
25
|
+
let(:model) do
|
26
|
+
Class.new do
|
27
|
+
include ::DataMapper::Resource
|
28
|
+
property :bin_data, ::DataMapper::Property::Binary
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should always dump with BINARY' do
|
33
|
+
model.bin_data.dump("foo".freeze).encoding.names.should include("BINARY")
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should always load with BINARY' do
|
37
|
+
model.bin_data.load("foo".freeze).encoding.names.should include("BINARY")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
22
41
|
end
|
@@ -11,24 +11,6 @@ describe DataMapper::Property::Boolean do
|
|
11
11
|
|
12
12
|
it_should_behave_like 'A semipublic Property'
|
13
13
|
|
14
|
-
describe '#load' do
|
15
|
-
before :all do
|
16
|
-
@value = mock('value')
|
17
|
-
end
|
18
|
-
|
19
|
-
subject { @property.load(@value) }
|
20
|
-
|
21
|
-
before do
|
22
|
-
@property = @type.new(@model, @name)
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'should delegate to #type.load' do
|
26
|
-
return_value = mock('return value')
|
27
|
-
@property.should_receive(:load).with(@value).and_return(return_value)
|
28
|
-
should == return_value
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
14
|
describe '#valid?' do
|
33
15
|
[ true, false ].each do |value|
|
34
16
|
it "returns true when value is #{value.inspect}" do
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15424017
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
9
|
- 0
|
10
10
|
- rc
|
11
|
-
-
|
12
|
-
version: 1.2.0.
|
11
|
+
- 2
|
12
|
+
version: 1.2.0.rc2
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Dan Kubb
|
@@ -17,11 +17,12 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-09-
|
20
|
+
date: 2011-09-21 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
type: :runtime
|
24
|
-
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
26
|
none: false
|
26
27
|
requirements:
|
27
28
|
- - ~>
|
@@ -32,12 +33,12 @@ dependencies:
|
|
32
33
|
- 2
|
33
34
|
- 6
|
34
35
|
version: 2.2.6
|
35
|
-
|
36
|
-
requirement: *id001
|
36
|
+
version_requirements: *id001
|
37
37
|
name: addressable
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
type: :development
|
40
|
-
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
42
|
none: false
|
42
43
|
requirements:
|
43
44
|
- - ~>
|
@@ -48,12 +49,12 @@ dependencies:
|
|
48
49
|
- 6
|
49
50
|
- 4
|
50
51
|
version: 1.6.4
|
51
|
-
|
52
|
-
requirement: *id002
|
52
|
+
version_requirements: *id002
|
53
53
|
name: jeweler
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
55
|
type: :development
|
56
|
-
|
56
|
+
prerelease: false
|
57
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
58
|
none: false
|
58
59
|
requirements:
|
59
60
|
- - ~>
|
@@ -64,12 +65,12 @@ dependencies:
|
|
64
65
|
- 9
|
65
66
|
- 2
|
66
67
|
version: 0.9.2
|
67
|
-
|
68
|
-
requirement: *id003
|
68
|
+
version_requirements: *id003
|
69
69
|
name: rake
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
type: :development
|
72
|
-
|
72
|
+
prerelease: false
|
73
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
74
|
none: false
|
74
75
|
requirements:
|
75
76
|
- - ~>
|
@@ -80,8 +81,7 @@ dependencies:
|
|
80
81
|
- 3
|
81
82
|
- 2
|
82
83
|
version: 1.3.2
|
83
|
-
|
84
|
-
requirement: *id004
|
84
|
+
version_requirements: *id004
|
85
85
|
name: rspec
|
86
86
|
description: Faster, Better, Simpler.
|
87
87
|
email: dan.kubb@gmail.com
|