objectid_columns 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -7
- data/.travis.yml +16 -16
- data/CHANGES.md +4 -0
- data/lib/objectid_columns/extensions.rb +2 -1
- data/lib/objectid_columns/objectid_columns_manager.rb +2 -0
- data/lib/objectid_columns/version.rb +1 -1
- data/objectid_columns.gemspec +1 -1
- data/spec/objectid_columns/system/basic_system_spec.rb +6 -0
- metadata +136 -84
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
OTM2ZmNmNTFhMTVhOGU5YjM3NjJhYWMwMjQ2MTMzZWY5M2QzZjlmOA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NTdmODI1NjE4NGNjOTBlZjhiYjI3OGJhOTZiNDEzZDc0M2MyYjMxMg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ODQ3M2Q4NjhhMTk4ZWQzNGM1MDhjM2U4OWQ4N2E0YmY1ZTk0Yzg5ZTFmYWE3
|
10
|
+
M2Q4MzkxODFlMzVlZmJjNWJkNjUzOTVkMDdmYzg3YmFjOWIzNWI0M2VlNjYx
|
11
|
+
NzViZmZmN2I1MGU5MGU4MGFiNmExNzA5YzZhOTcyMDA3MGE0YTA=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NmQ4NGM2NTM3MDg1NWM5NjJhZjk2OWQ4N2Q4ZjI0MDA4NmI5Y2Y2YmEyYzI0
|
14
|
+
ODMwNDI0Y2MwMTg1MDI2YjA4NGVmNjIyNzdlYjAzN2IyZjI3MGJkM2UwM2E1
|
15
|
+
MTZkNmQ0M2M5NzkxYTYyMzcyZTcyZWVhNTgyMjk0NTliNjFlYWM=
|
data/.travis.yml
CHANGED
@@ -11,15 +11,15 @@ env:
|
|
11
11
|
- OBJECTID_COLUMNS_AR_TEST_VERSION=3.1.12 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=mysql
|
12
12
|
- OBJECTID_COLUMNS_AR_TEST_VERSION=3.1.12 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=postgres
|
13
13
|
- OBJECTID_COLUMNS_AR_TEST_VERSION=3.1.12 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=sqlite
|
14
|
-
- OBJECTID_COLUMNS_AR_TEST_VERSION=3.2.
|
15
|
-
- OBJECTID_COLUMNS_AR_TEST_VERSION=3.2.
|
16
|
-
- OBJECTID_COLUMNS_AR_TEST_VERSION=3.2.
|
17
|
-
- OBJECTID_COLUMNS_AR_TEST_VERSION=4.0.
|
18
|
-
- OBJECTID_COLUMNS_AR_TEST_VERSION=4.0.
|
19
|
-
- OBJECTID_COLUMNS_AR_TEST_VERSION=4.0.
|
20
|
-
- OBJECTID_COLUMNS_AR_TEST_VERSION=4.1.
|
21
|
-
- OBJECTID_COLUMNS_AR_TEST_VERSION=4.1.
|
22
|
-
- OBJECTID_COLUMNS_AR_TEST_VERSION=4.1.
|
14
|
+
- OBJECTID_COLUMNS_AR_TEST_VERSION=3.2.18 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=mysql
|
15
|
+
- OBJECTID_COLUMNS_AR_TEST_VERSION=3.2.18 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=postgres
|
16
|
+
- OBJECTID_COLUMNS_AR_TEST_VERSION=3.2.18 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=sqlite
|
17
|
+
- OBJECTID_COLUMNS_AR_TEST_VERSION=4.0.5 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=mysql
|
18
|
+
- OBJECTID_COLUMNS_AR_TEST_VERSION=4.0.5 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=postgres
|
19
|
+
- OBJECTID_COLUMNS_AR_TEST_VERSION=4.0.5 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=sqlite
|
20
|
+
- OBJECTID_COLUMNS_AR_TEST_VERSION=4.1.1 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=mysql
|
21
|
+
- OBJECTID_COLUMNS_AR_TEST_VERSION=4.1.1 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=postgres
|
22
|
+
- OBJECTID_COLUMNS_AR_TEST_VERSION=4.1.1 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=sqlite
|
23
23
|
before_script:
|
24
24
|
- mysql -e 'create database myapp_test;'
|
25
25
|
- psql -c 'create database myapp_test;' -U postgres
|
@@ -27,18 +27,18 @@ matrix:
|
|
27
27
|
exclude:
|
28
28
|
# ActiveRecord 4.x doesn't support Ruby 1.8.7
|
29
29
|
- rvm: 1.8.7
|
30
|
-
env: OBJECTID_COLUMNS_AR_TEST_VERSION=4.0.
|
30
|
+
env: OBJECTID_COLUMNS_AR_TEST_VERSION=4.0.5 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=mysql
|
31
31
|
- rvm: 1.8.7
|
32
|
-
env: OBJECTID_COLUMNS_AR_TEST_VERSION=4.0.
|
32
|
+
env: OBJECTID_COLUMNS_AR_TEST_VERSION=4.0.5 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=postgres
|
33
33
|
- rvm: 1.8.7
|
34
|
-
env: OBJECTID_COLUMNS_AR_TEST_VERSION=4.0.
|
34
|
+
env: OBJECTID_COLUMNS_AR_TEST_VERSION=4.0.5 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=sqlite
|
35
35
|
- rvm: 1.8.7
|
36
|
-
env: OBJECTID_COLUMNS_AR_TEST_VERSION=4.1.
|
36
|
+
env: OBJECTID_COLUMNS_AR_TEST_VERSION=4.1.1 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=mysql
|
37
37
|
- rvm: 1.8.7
|
38
|
-
env: OBJECTID_COLUMNS_AR_TEST_VERSION=4.1.
|
38
|
+
env: OBJECTID_COLUMNS_AR_TEST_VERSION=4.1.1 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=postgres
|
39
39
|
- rvm: 1.8.7
|
40
|
-
env: OBJECTID_COLUMNS_AR_TEST_VERSION=4.1.
|
40
|
+
env: OBJECTID_COLUMNS_AR_TEST_VERSION=4.1.1 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=sqlite
|
41
41
|
allow_failures:
|
42
42
|
- env: OBJECTID_COLUMNS_AR_TEST_VERSION=3.1.12 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=sqlite
|
43
43
|
- rvm: 1.8.7
|
44
|
-
env: OBJECTID_COLUMNS_AR_TEST_VERSION=3.2.
|
44
|
+
env: OBJECTID_COLUMNS_AR_TEST_VERSION=3.2.18 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=sqlite
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Change History for ObjectidColumns
|
2
2
|
|
3
|
+
### Version 1.0.3: June 11, 2014
|
4
|
+
|
5
|
+
* Fixed an issue where, if you tried to declare `has_objectid_primary_key` on a table that didn't exist (usually meaning it just hadn't been migrated into existence yet), you'd get an error. Now, we ignore this declaration.
|
6
|
+
|
3
7
|
### Version 1.0.2: April 14, 2014
|
4
8
|
|
5
9
|
* Fixed an issue where, if you tried to pass an ObjectID instance in a `where` clause for a column that didn't exist or wasn't on a table that declared any ObjectID columns, you could get an error from deep down in `ObjectidColumns`. (Now, you'll still get an error, but it will be the ActiveRecord error you expect, instead.)
|
@@ -34,7 +34,8 @@ String.class_eval do
|
|
34
34
|
elsif length == 12 && ((! respond_to?(:encoding)) || (encoding == Encoding::BINARY)) # :respond_to? is for Ruby 1.8.7 support
|
35
35
|
ObjectidColumns.construct_objectid(unpack("H*").first)
|
36
36
|
else
|
37
|
-
|
37
|
+
encoding_string = respond_to?(:encoding) ? ", in encoding #{encoding.inspect}" : ""
|
38
|
+
raise ArgumentError, "#{inspect} does not seem to be a valid BSON ID; it is in neither the valid hex (exactly 24 hex characters, any encoding) nor the valid binary (12 characters, binary/ASCII-8BIT encoding) form. It is #{length} characters long#{encoding_string}"
|
38
39
|
end
|
39
40
|
end
|
40
41
|
end
|
@@ -162,6 +162,8 @@ module ObjectidColumns
|
|
162
162
|
#
|
163
163
|
# This method handles composite primary keys, as provided by the +composite_primary_keys+ gem, correctly.
|
164
164
|
def has_objectid_primary_key(*primary_keys_that_are_objectid_columns)
|
165
|
+
return unless active_record_class.table_exists?
|
166
|
+
|
165
167
|
# First, normalize our set of primary keys that are ObjectId columns...
|
166
168
|
primary_keys_that_are_objectid_columns = primary_keys_that_are_objectid_columns.compact.map(&:to_s).uniq
|
167
169
|
|
data/objectid_columns.gemspec
CHANGED
@@ -61,7 +61,7 @@ Gem::Specification.new do |spec|
|
|
61
61
|
# between CPK and the rest of the system make it impossible to run those tests. There is corresponding code in our
|
62
62
|
# +basic_system_spec+ to exclude those combinations.
|
63
63
|
cpk_allowed = true
|
64
|
-
cpk_allowed = false if database_gem_name =~ /(pg|postgres)/i && RUBY_VERSION =~ /^(1\.9)|(2\.)/ && ar_version && ar_version =~ /^4\.0\./
|
64
|
+
cpk_allowed = false if database_gem_name =~ /(pg|postgres)/i && RUBY_VERSION =~ /^(1\.9)|(2\.)/ && ar_version && ar_version =~ /^4\.(0|1)\./
|
65
65
|
cpk_allowed = false if defined?(RUBY_ENGINE) && (RUBY_ENGINE == 'jruby') && ar_version && ar_version =~ /^3\.0\./
|
66
66
|
cpk_allowed = false if defined?(RUBY_ENGINE) && (RUBY_ENGINE == 'jruby') && ar_version && ar_version =~ /^3\.1\./ && database_gem_name =~ /(pg|postgres)/i
|
67
67
|
|
@@ -91,6 +91,12 @@ describe "ObjectidColumns basic operations" do
|
|
91
91
|
expect { ::SpectableNonexistent.class_eval { has_objectid_column :foo } }.to_not raise_error
|
92
92
|
end
|
93
93
|
|
94
|
+
it "should not fail if declared as a primary key and the table doesn't exist" do
|
95
|
+
define_model_class(:SpectableNonexistent, 'objectidcols_spec_table_nonexistent') { }
|
96
|
+
expect { ::SpectableNonexistent.class_eval { has_objectid_primary_key } }.to_not raise_error
|
97
|
+
expect { ::SpectableNonexistent.class_eval { has_objectid_primary_key :foo } }.to_not raise_error
|
98
|
+
end
|
99
|
+
|
94
100
|
if $composite_primary_keys_available
|
95
101
|
describe "composite primary key support" do
|
96
102
|
context "with an implicit PK" do
|
metadata
CHANGED
@@ -1,109 +1,160 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: objectid_columns
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Andrew Geweke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2014-06-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
15
14
|
name: activerecord
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
version: "3.0"
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
22
20
|
- - <=
|
23
|
-
- !ruby/object:Gem::Version
|
21
|
+
- !ruby/object:Gem::Version
|
24
22
|
version: 4.99.99
|
25
23
|
type: :runtime
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: activesupport
|
29
24
|
prerelease: false
|
30
|
-
|
31
|
-
requirements:
|
32
|
-
- -
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version:
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.0'
|
35
30
|
- - <=
|
36
|
-
- !ruby/object:Gem::Version
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 4.99.99
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: activesupport
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '3.0'
|
40
|
+
- - <=
|
41
|
+
- !ruby/object:Gem::Version
|
37
42
|
version: 4.99.99
|
38
43
|
type: :runtime
|
39
|
-
version_requirements: *id002
|
40
|
-
- !ruby/object:Gem::Dependency
|
41
|
-
name: bundler
|
42
44
|
prerelease: false
|
43
|
-
|
44
|
-
requirements:
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '3.0'
|
50
|
+
- - <=
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 4.99.99
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: bundler
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
45
57
|
- - ~>
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version:
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '1.5'
|
48
60
|
type: :development
|
49
|
-
version_requirements: *id003
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: rake
|
52
61
|
prerelease: false
|
53
|
-
|
54
|
-
requirements:
|
55
|
-
-
|
56
|
-
-
|
57
|
-
|
58
|
-
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ~>
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '1.5'
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: rake
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ! '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
59
74
|
type: :development
|
60
|
-
|
61
|
-
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
- !ruby/object:Gem::Dependency
|
62
82
|
name: rspec
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ~>
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '2.14'
|
88
|
+
type: :development
|
63
89
|
prerelease: false
|
64
|
-
|
65
|
-
requirements:
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ~>
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '2.14'
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: moped
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
66
99
|
- - ~>
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version:
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '1.5'
|
69
102
|
type: :development
|
70
|
-
version_requirements: *id005
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: bson
|
73
103
|
prerelease: false
|
74
|
-
|
75
|
-
requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ~>
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '1.5'
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
name: bson
|
111
|
+
requirement: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
76
113
|
- - ~>
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version:
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '1.9'
|
79
116
|
type: :development
|
80
|
-
version_requirements: *id006
|
81
|
-
- !ruby/object:Gem::Dependency
|
82
|
-
name: mysql2
|
83
117
|
prerelease: false
|
84
|
-
|
85
|
-
requirements:
|
86
|
-
-
|
118
|
+
version_requirements: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ~>
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '1.9'
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
name: mysql2
|
125
|
+
requirement: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ! '>='
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
87
130
|
type: :development
|
88
|
-
version_requirements: *id008
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: composite_primary_keys
|
91
131
|
prerelease: false
|
92
|
-
|
93
|
-
requirements:
|
94
|
-
-
|
132
|
+
version_requirements: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ! '>='
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
- !ruby/object:Gem::Dependency
|
138
|
+
name: composite_primary_keys
|
139
|
+
requirement: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ! '>='
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
95
144
|
type: :development
|
96
|
-
|
145
|
+
prerelease: false
|
146
|
+
version_requirements: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ! '>='
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
97
151
|
description:
|
98
|
-
email:
|
152
|
+
email:
|
99
153
|
- ageweke@swiftype.com
|
100
154
|
executables: []
|
101
|
-
|
102
155
|
extensions: []
|
103
|
-
|
104
156
|
extra_rdoc_files: []
|
105
|
-
|
106
|
-
files:
|
157
|
+
files:
|
107
158
|
- .gitignore
|
108
159
|
- .travis.yml
|
109
160
|
- CHANGES.md
|
@@ -126,29 +177,30 @@ files:
|
|
126
177
|
- spec/objectid_columns/system/basic_system_spec.rb
|
127
178
|
- spec/objectid_columns/system/extensions_spec.rb
|
128
179
|
homepage: https://www.github.com/swiftype/objectid_columns
|
129
|
-
licenses:
|
180
|
+
licenses:
|
130
181
|
- MIT
|
131
182
|
metadata: {}
|
132
|
-
|
133
183
|
post_install_message:
|
134
184
|
rdoc_options: []
|
135
|
-
|
136
|
-
require_paths:
|
185
|
+
require_paths:
|
137
186
|
- lib
|
138
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
139
|
-
requirements:
|
140
|
-
-
|
141
|
-
|
142
|
-
|
143
|
-
|
187
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
188
|
+
requirements:
|
189
|
+
- - ! '>='
|
190
|
+
- !ruby/object:Gem::Version
|
191
|
+
version: '0'
|
192
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
|
+
requirements:
|
194
|
+
- - ! '>='
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: '0'
|
144
197
|
requirements: []
|
145
|
-
|
146
198
|
rubyforge_project:
|
147
|
-
rubygems_version: 2.
|
199
|
+
rubygems_version: 2.2.1
|
148
200
|
signing_key:
|
149
201
|
specification_version: 4
|
150
202
|
summary: Transparently store MongoDB ObjectId values in ActiveRecord.
|
151
|
-
test_files:
|
203
|
+
test_files:
|
152
204
|
- spec/objectid_columns/helpers/database_helper.rb
|
153
205
|
- spec/objectid_columns/helpers/system_helpers.rb
|
154
206
|
- spec/objectid_columns/system/basic_system_spec.rb
|