dm-constraints 0.10.2 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +37 -0
- data/Gemfile +141 -0
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/dm-constraints.gemspec +35 -14
- data/lib/dm-constraints/adapters/dm-abstract-adapter.rb +22 -0
- data/lib/dm-constraints/adapters/dm-do-adapter.rb +189 -0
- data/lib/dm-constraints/adapters/dm-mysql-adapter.rb +40 -0
- data/lib/dm-constraints/adapters/dm-oracle-adapter.rb +13 -0
- data/lib/dm-constraints/adapters/dm-postgres-adapter.rb +13 -0
- data/lib/dm-constraints/adapters/dm-sqlite-adapter.rb +22 -0
- data/lib/dm-constraints/adapters/dm-sqlserver-adapter.rb +13 -0
- data/lib/dm-constraints/migrations.rb +26 -240
- data/lib/dm-constraints/relationships.rb +41 -0
- data/lib/dm-constraints.rb +64 -38
- data/spec/integration/constraints_spec.rb +29 -7
- data/spec/isolated/require_after_setup_spec.rb +36 -0
- data/spec/isolated/require_before_setup_spec.rb +36 -0
- data/spec/isolated/require_spec.rb +14 -0
- data/spec/spec_helper.rb +12 -49
- data/tasks/local_gemfile.rake +18 -0
- data/tasks/spec.rake +0 -3
- metadata +67 -26
data/spec/spec_helper.rb
CHANGED
@@ -1,63 +1,26 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
require 'dm-core'
|
7
|
-
|
8
|
-
# Support running specs with 'rake spec' and 'spec'
|
9
|
-
$LOAD_PATH.unshift('lib') unless $LOAD_PATH.include?('lib')
|
3
|
+
require 'dm-core/spec/setup'
|
4
|
+
require 'dm-core/spec/lib/spec_helper'
|
5
|
+
require 'dm-core/spec/lib/adapter_helpers'
|
10
6
|
|
11
7
|
require 'dm-constraints'
|
12
8
|
|
13
|
-
ADAPTERS = {}
|
14
|
-
def load_driver(name, default_uri)
|
15
|
-
connection_string = ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri
|
16
|
-
begin
|
17
|
-
adapter = DataMapper.setup(name.to_sym, connection_string)
|
18
|
-
|
19
|
-
# test the connection if possible
|
20
|
-
if adapter.respond_to?(:query)
|
21
|
-
adapter.select('SELECT 1')
|
22
|
-
end
|
23
|
-
|
24
|
-
ADAPTERS[name] = connection_string
|
25
|
-
rescue LoadError => e
|
26
|
-
warn "Could not load do_#{name}: #{e}"
|
27
|
-
false
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:')
|
33
|
-
HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test')
|
34
|
-
HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test')
|
35
|
-
|
36
|
-
|
37
9
|
Spec::Runner.configure do |config|
|
38
|
-
config.after :all do
|
39
|
-
# global model cleanup
|
40
|
-
descendants = DataMapper::Model.descendants.to_a
|
41
|
-
while model = descendants.shift
|
42
|
-
descendants.concat(model.descendants.to_a - [ model ])
|
43
|
-
|
44
|
-
parts = model.name.split('::')
|
45
|
-
constant_name = parts.pop.to_sym
|
46
|
-
base = parts.empty? ? Object : Object.full_const_get(parts.join('::'))
|
47
10
|
|
48
|
-
|
49
|
-
|
50
|
-
end
|
11
|
+
config.extend(DataMapper::Spec::Adapters::Helpers)
|
12
|
+
config.extend(DataMapper::Spec::Helpers)
|
51
13
|
|
52
|
-
|
53
|
-
|
14
|
+
config.before(:each) do
|
15
|
+
DataMapper.auto_migrate!
|
54
16
|
end
|
55
17
|
|
56
|
-
config.
|
57
|
-
DataMapper.
|
18
|
+
config.after :each do
|
19
|
+
DataMapper.send(:auto_migrate_down!, DataMapper::Spec.adapter.name)
|
58
20
|
end
|
59
21
|
|
60
|
-
config.after do
|
61
|
-
DataMapper.
|
22
|
+
config.after :all do
|
23
|
+
DataMapper::Spec.cleanup_models
|
62
24
|
end
|
25
|
+
|
63
26
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
desc "Support bundling from local source code (allows BUNDLE_GEMFILE=Gemfile.local bundle foo)"
|
2
|
+
task :local_gemfile do |t|
|
3
|
+
|
4
|
+
root = Pathname(__FILE__).dirname.parent
|
5
|
+
datamapper = root.parent
|
6
|
+
|
7
|
+
source_regex = /DATAMAPPER = 'git:\/\/github.com\/datamapper'/
|
8
|
+
gem_source_regex = /:git => \"#\{DATAMAPPER\}\/(.+?)(?:\.git)?\"/
|
9
|
+
|
10
|
+
root.join('Gemfile.local').open('w') do |f|
|
11
|
+
root.join('Gemfile').open.each do |line|
|
12
|
+
line.sub!(source_regex, "DATAMAPPER = '#{datamapper}'")
|
13
|
+
line.sub!(gem_source_regex, ':path => "#{DATAMAPPER}/\1"')
|
14
|
+
f.puts line
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
data/tasks/spec.rake
CHANGED
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-constraints
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: true
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- rc1
|
10
|
+
version: 1.0.0.rc1
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Dirkjan Bussink
|
@@ -9,39 +15,52 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2010-05-19 00:00:00 -07:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: dm-core
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
25
|
requirements:
|
21
26
|
- - ~>
|
22
27
|
- !ruby/object:Gem::Version
|
23
|
-
|
24
|
-
|
28
|
+
segments:
|
29
|
+
- 1
|
30
|
+
- 0
|
31
|
+
- 0
|
32
|
+
- rc1
|
33
|
+
version: 1.0.0.rc1
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
25
36
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
name: dm-migrations
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
40
|
requirements:
|
31
41
|
- - ~>
|
32
42
|
- !ruby/object:Gem::Version
|
33
|
-
|
34
|
-
|
43
|
+
segments:
|
44
|
+
- 1
|
45
|
+
- 0
|
46
|
+
- 0
|
47
|
+
- rc1
|
48
|
+
version: 1.0.0.rc1
|
49
|
+
type: :runtime
|
50
|
+
version_requirements: *id002
|
35
51
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
37
|
-
|
38
|
-
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
name: rspec
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
55
|
requirements:
|
41
56
|
- - ~>
|
42
57
|
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
|
58
|
+
segments:
|
59
|
+
- 1
|
60
|
+
- 3
|
61
|
+
version: "1.3"
|
62
|
+
type: :development
|
63
|
+
version_requirements: *id003
|
45
64
|
description: DataMapper plugin constraining relationships
|
46
65
|
email: d.bussink [a] gmail [d] com
|
47
66
|
executables: []
|
@@ -52,19 +71,33 @@ extra_rdoc_files:
|
|
52
71
|
- LICENSE
|
53
72
|
- README.rdoc
|
54
73
|
files:
|
74
|
+
- .gitignore
|
75
|
+
- Gemfile
|
55
76
|
- LICENSE
|
56
77
|
- README.rdoc
|
57
78
|
- Rakefile
|
58
79
|
- VERSION
|
59
80
|
- dm-constraints.gemspec
|
60
81
|
- lib/dm-constraints.rb
|
82
|
+
- lib/dm-constraints/adapters/dm-abstract-adapter.rb
|
83
|
+
- lib/dm-constraints/adapters/dm-do-adapter.rb
|
84
|
+
- lib/dm-constraints/adapters/dm-mysql-adapter.rb
|
85
|
+
- lib/dm-constraints/adapters/dm-oracle-adapter.rb
|
86
|
+
- lib/dm-constraints/adapters/dm-postgres-adapter.rb
|
87
|
+
- lib/dm-constraints/adapters/dm-sqlite-adapter.rb
|
88
|
+
- lib/dm-constraints/adapters/dm-sqlserver-adapter.rb
|
61
89
|
- lib/dm-constraints/delete_constraint.rb
|
62
90
|
- lib/dm-constraints/migrations.rb
|
91
|
+
- lib/dm-constraints/relationships.rb
|
63
92
|
- spec/integration/constraints_spec.rb
|
93
|
+
- spec/isolated/require_after_setup_spec.rb
|
94
|
+
- spec/isolated/require_before_setup_spec.rb
|
95
|
+
- spec/isolated/require_spec.rb
|
64
96
|
- spec/rcov.opts
|
65
97
|
- spec/spec.opts
|
66
98
|
- spec/spec_helper.rb
|
67
99
|
- tasks/ci.rake
|
100
|
+
- tasks/local_gemfile.rake
|
68
101
|
- tasks/metrics.rake
|
69
102
|
- tasks/spec.rake
|
70
103
|
- tasks/yard.rake
|
@@ -82,20 +115,28 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
115
|
requirements:
|
83
116
|
- - ">="
|
84
117
|
- !ruby/object:Gem::Version
|
118
|
+
segments:
|
119
|
+
- 0
|
85
120
|
version: "0"
|
86
|
-
version:
|
87
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
122
|
requirements:
|
89
|
-
- - "
|
123
|
+
- - ">"
|
90
124
|
- !ruby/object:Gem::Version
|
91
|
-
|
92
|
-
|
125
|
+
segments:
|
126
|
+
- 1
|
127
|
+
- 3
|
128
|
+
- 1
|
129
|
+
version: 1.3.1
|
93
130
|
requirements: []
|
94
131
|
|
95
132
|
rubyforge_project: datamapper
|
96
|
-
rubygems_version: 1.3.
|
133
|
+
rubygems_version: 1.3.6
|
97
134
|
signing_key:
|
98
135
|
specification_version: 3
|
99
136
|
summary: DataMapper plugin constraining relationships
|
100
|
-
test_files:
|
101
|
-
|
137
|
+
test_files:
|
138
|
+
- spec/integration/constraints_spec.rb
|
139
|
+
- spec/isolated/require_after_setup_spec.rb
|
140
|
+
- spec/isolated/require_before_setup_spec.rb
|
141
|
+
- spec/isolated/require_spec.rb
|
142
|
+
- spec/spec_helper.rb
|