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/spec/spec_helper.rb CHANGED
@@ -1,63 +1,26 @@
1
1
  require 'rubygems'
2
2
 
3
- # use local dm-core if running from a typical dev checkout.
4
- lib = File.join('..', '..', 'dm-core', 'lib')
5
- $LOAD_PATH.unshift(lib) if File.directory?(lib)
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
- if base.const_defined?(constant_name)
49
- base.send(:remove_const, constant_name)
50
- end
11
+ config.extend(DataMapper::Spec::Adapters::Helpers)
12
+ config.extend(DataMapper::Spec::Helpers)
51
13
 
52
- DataMapper::Model.descendants.delete(model)
53
- end
14
+ config.before(:each) do
15
+ DataMapper.auto_migrate!
54
16
  end
55
17
 
56
- config.before do
57
- DataMapper.auto_migrate!
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.send(:auto_migrate_down!, @repository.name)
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
@@ -35,7 +35,4 @@ rescue LoadError
35
35
  end
36
36
  end
37
37
 
38
- task :spec => :check_dependencies
39
- task :rcov => :check_dependencies
40
-
41
38
  task :default => :spec
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
- version: 0.10.2
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: 2009-12-11 00:00:00 -08:00
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
- type: :runtime
18
- version_requirement:
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
- version: 0.10.2
24
- version:
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: rspec
27
- type: :development
28
- version_requirement:
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
- version: 1.2.9
34
- version:
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: yard
37
- type: :development
38
- version_requirement:
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
- version: 0.4.0
44
- version:
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
- version: "0"
92
- version:
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.5
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