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 CHANGED
@@ -1,7 +1,15 @@
1
- ---
2
- SHA1:
3
- data.tar.gz: a7f678bd14b88d042886baff1b5414b11deb4707
4
- metadata.gz: e7b852e2a9fd9f1d1ca584b2cfd7e3af2cd9f03f
5
- SHA512:
6
- data.tar.gz: 9dd1a74b4e4923f9502f46ddded57492019f7cea242cf57ca7289174c4e37babadd0eb2ceb32a32df464cc83d7932462ead3d8ed8079e1d105524e2f6e7f10b2
7
- metadata.gz: bf0a9bcf3f653674d3a04ddc84bd25a2127cf05465be7582baa3e62445a95993b92c52c0b83cae4822b70c2b84d74f436a81ac876a59e192310863afea6ce0ad
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.17 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=mysql
15
- - OBJECTID_COLUMNS_AR_TEST_VERSION=3.2.17 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=postgres
16
- - OBJECTID_COLUMNS_AR_TEST_VERSION=3.2.17 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=sqlite
17
- - OBJECTID_COLUMNS_AR_TEST_VERSION=4.0.4 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=mysql
18
- - OBJECTID_COLUMNS_AR_TEST_VERSION=4.0.4 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=postgres
19
- - OBJECTID_COLUMNS_AR_TEST_VERSION=4.0.4 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=sqlite
20
- - OBJECTID_COLUMNS_AR_TEST_VERSION=4.1.0 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=mysql
21
- - OBJECTID_COLUMNS_AR_TEST_VERSION=4.1.0 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=postgres
22
- - OBJECTID_COLUMNS_AR_TEST_VERSION=4.1.0 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=sqlite
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.4 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=mysql
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.4 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=postgres
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.4 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=sqlite
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.0 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=mysql
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.0 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=postgres
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.0 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=sqlite
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.17 OBJECTID_COLUMNS_TRAVIS_CI_DATABASE_TYPE=sqlite
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
- 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"
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
 
@@ -1,4 +1,4 @@
1
1
  # What's the current version of this gem?
2
2
  module ObjectidColumns
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
4
4
  end
@@ -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.2
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
- date: 2014-04-14 00:00:00 Z
13
- dependencies:
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
- prerelease: false
17
- requirement: &id001 !ruby/object:Gem::Requirement
18
- requirements:
19
- - - ">="
20
- - !ruby/object:Gem::Version
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
- requirement: &id002 !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: "3.0"
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
- requirement: &id003 !ruby/object:Gem::Requirement
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: "1.5"
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
- requirement: &id004 !ruby/object:Gem::Requirement
54
- requirements:
55
- - &id007
56
- - ">="
57
- - !ruby/object:Gem::Version
58
- version: "0"
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
- version_requirements: *id004
61
- - !ruby/object:Gem::Dependency
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
- requirement: &id005 !ruby/object:Gem::Requirement
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: "2.14"
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
- requirement: &id006 !ruby/object:Gem::Requirement
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: "1.9"
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
- requirement: &id008 !ruby/object:Gem::Requirement
85
- requirements:
86
- - *id007
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
- requirement: &id009 !ruby/object:Gem::Requirement
93
- requirements:
94
- - *id007
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
- version_requirements: *id009
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
- - *id007
141
- required_rubygems_version: !ruby/object:Gem::Requirement
142
- requirements:
143
- - *id007
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.0.14
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