activeuuid 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5a34ea714bbb400c87aa8d865d1f9d6b9d18721e
4
+ data.tar.gz: 3571be3cd2b99c70035a061b3ba431433507ff86
5
+ SHA512:
6
+ metadata.gz: f5a48da1daa91b2e1f870aab9bf64d019aa058317dda0e58c5bedf9e9c05ec79314a2bdc2b3ba6027e5df0a27a826fc9e5e04fb3b93af25707f46504946519f5
7
+ data.tar.gz: 0293b179642829f7633ec4d1f84de53beaaddf1b17f98e167e003b7269c9119d2c80486e1fd5dbaf689c752ac568cf1b738152d6e76b5afa8957cd346a4fce9e
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm use 1.9.3@activeuuid --create
1
+ rvm use 2.1.5@activeuuid --create
@@ -5,6 +5,8 @@ before_script:
5
5
  rvm:
6
6
  - 1.9.3
7
7
  - 2.0.0
8
+ - 2.1.5
9
+ - 2.2.0
8
10
  - rbx-2
9
11
 
10
12
  gemfile:
@@ -12,6 +14,8 @@ gemfile:
12
14
  - gemfiles/Gemfile.rails-3-1
13
15
  - gemfiles/Gemfile.rails-3-2
14
16
  - gemfiles/Gemfile.rails-4-0
17
+ - gemfiles/Gemfile.rails-4-1
18
+ - gemfiles/Gemfile.rails-4-2
15
19
  - gemfiles/Gemfile.rails-head
16
20
 
17
21
  env:
@@ -22,3 +26,8 @@ env:
22
26
  matrix:
23
27
  allow_failures:
24
28
  - gemfile: gemfiles/Gemfile.rails-head
29
+ exclude:
30
+ - rvm: 2.2.0
31
+ gemfile: gemfiles/Gemfile.rails-3-1
32
+ - rvm: 2.2.0
33
+ gemfile: gemfiles/Gemfile.rails-3-2
@@ -0,0 +1,19 @@
1
+ The MIT License (MIT)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.mkd CHANGED
@@ -146,7 +146,18 @@ Or get the code here: https://github.com/jashmenn/activeuuid
146
146
  ## Dependencies
147
147
  Rails ~> 3.1.0
148
148
 
149
- ## Author
150
-
151
- Nate Murray <nate@xcombinator.com>
149
+ ## Authors
150
+
151
+ - Nate Murray
152
+ - pyromaniac
153
+ - Andrew Kane
154
+ - Devin Foley
155
+ - Arkadiy Zabazhanov
156
+ - Jean-Denis Koeck
157
+ - Florian Staudacher
158
+ - Schuyler Erle
159
+ - Florian Schwab
160
+ - Thomas Guillory
161
+ - Daniel Blanco Rojas
162
+ - Olivier Amblet
152
163
 
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec path: '../'
4
+
5
+ gem 'activerecord', '~> 4.2.0'
@@ -1,6 +1,36 @@
1
1
  require 'active_record'
2
2
  require 'active_support/concern'
3
3
 
4
+ if ActiveRecord::VERSION::MAJOR == 4 and ActiveRecord::VERSION::MINOR == 2
5
+ module ActiveRecord
6
+ module Type
7
+ class UUID < Binary # :nodoc:
8
+ def type
9
+ :uuid
10
+ end
11
+
12
+ def cast_value(value)
13
+ UUIDTools::UUID.serialize(value)
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ module ActiveRecord
20
+ module ConnectionAdapters
21
+ module PostgreSQL
22
+ module OID # :nodoc:
23
+ class Uuid < Type::Value # :nodoc:
24
+ def type_cast_from_user(value)
25
+ UUIDTools::UUID.serialize(value) if value
26
+ end
27
+ alias_method :type_cast_from_database, :type_cast_from_user
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
4
34
 
5
35
  module ActiveUUID
6
36
  module Patches
@@ -92,10 +122,10 @@ module ActiveUUID
92
122
  quote_without_visiting(value, column)
93
123
  end
94
124
 
95
- def type_cast_with_visiting(value, column = nil)
125
+ def type_cast_with_visiting(value, column = nil, *args)
96
126
  value = UUIDTools::UUID.serialize(value) if column && column.type == :uuid
97
127
  value = value.to_s if value.is_a? UUIDTools::UUID
98
- type_cast_without_visiting(value, column)
128
+ type_cast_without_visiting(value, column, *args)
99
129
  end
100
130
 
101
131
  def native_database_types_with_pguuid
@@ -108,12 +138,30 @@ module ActiveUUID
108
138
  end
109
139
  end
110
140
 
141
+ module AbstractAdapter
142
+ extend ActiveSupport::Concern
143
+
144
+ included do
145
+ def initialize_type_map_with_uuid(m)
146
+ initialize_type_map_without_uuid(m)
147
+ register_class_with_limit m, /binary\(16(,0)?\)/i, ::ActiveRecord::Type::UUID
148
+ end
149
+
150
+ alias_method_chain :initialize_type_map, :uuid
151
+ end
152
+ end
153
+
111
154
  def self.apply!
112
155
  ActiveRecord::ConnectionAdapters::Table.send :include, Migrations if defined? ActiveRecord::ConnectionAdapters::Table
113
156
  ActiveRecord::ConnectionAdapters::TableDefinition.send :include, Migrations if defined? ActiveRecord::ConnectionAdapters::TableDefinition
114
157
 
115
- ActiveRecord::ConnectionAdapters::Column.send :include, Column
116
- ActiveRecord::ConnectionAdapters::PostgreSQLColumn.send :include, PostgreSQLColumn if defined? ActiveRecord::ConnectionAdapters::PostgreSQLColumn
158
+ if ActiveRecord::VERSION::MAJOR == 4 and ActiveRecord::VERSION::MINOR == 2
159
+ ActiveRecord::ConnectionAdapters::Mysql2Adapter.send :include, AbstractAdapter if defined? ActiveRecord::ConnectionAdapters::Mysql2Adapter
160
+ ActiveRecord::ConnectionAdapters::SQLite3Adapter.send :include, AbstractAdapter if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter
161
+ else
162
+ ActiveRecord::ConnectionAdapters::Column.send :include, Column
163
+ ActiveRecord::ConnectionAdapters::PostgreSQLColumn.send :include, PostgreSQLColumn if defined? ActiveRecord::ConnectionAdapters::PostgreSQLColumn
164
+ end
117
165
 
118
166
  ActiveRecord::ConnectionAdapters::Mysql2Adapter.send :include, Quoting if defined? ActiveRecord::ConnectionAdapters::Mysql2Adapter
119
167
  ActiveRecord::ConnectionAdapters::SQLite3Adapter.send :include, Quoting if defined? ActiveRecord::ConnectionAdapters::SQLite3Adapter
@@ -1,3 +1,3 @@
1
1
  module Activeuuid
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -88,6 +88,18 @@ describe Article do
88
88
  its(:delete) { should be_truthy }
89
89
  its(:destroy) { should be_truthy }
90
90
  end
91
+
92
+ context '#save' do
93
+ subject { article }
94
+ let(:array) { [1, 2, 3] }
95
+
96
+ its(:save) { should be_truthy }
97
+
98
+ context 'when change array field' do
99
+ before { article.some_array = array }
100
+ its(:save) { should be_truthy }
101
+ end
102
+ end
91
103
  end
92
104
 
93
105
  describe UuidArticle do
@@ -0,0 +1,5 @@
1
+ class AddArrayToArticles < ActiveRecord::Migration
2
+ def change
3
+ add_column :articles, :some_array, :integer, array: true
4
+ end
5
+ end
metadata CHANGED
@@ -1,206 +1,181 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeuuid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
5
- prerelease:
4
+ version: 0.6.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Nate Murray
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-06-17 00:00:00.000000000 Z
11
+ date: 2015-02-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
33
  version: 2.99.0
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
40
  version: 2.99.0
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec-its
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: activesupport
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: database_cleaner
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: forgery
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - ">="
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - ">="
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: fabrication
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - ">="
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - ">="
124
109
  - !ruby/object:Gem::Version
125
110
  version: '0'
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: sqlite3
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>='
115
+ - - ">="
132
116
  - !ruby/object:Gem::Version
133
117
  version: '0'
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>='
122
+ - - ">="
140
123
  - !ruby/object:Gem::Version
141
124
  version: '0'
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: pg
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
- - - ! '>='
129
+ - - ">="
148
130
  - !ruby/object:Gem::Version
149
131
  version: '0'
150
132
  type: :development
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
- - - ! '>='
136
+ - - ">="
156
137
  - !ruby/object:Gem::Version
157
138
  version: '0'
158
139
  - !ruby/object:Gem::Dependency
159
140
  name: mysql2
160
141
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
142
  requirements:
163
- - - ! '>='
143
+ - - ">="
164
144
  - !ruby/object:Gem::Version
165
145
  version: '0'
166
146
  type: :development
167
147
  prerelease: false
168
148
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
149
  requirements:
171
- - - ! '>='
150
+ - - ">="
172
151
  - !ruby/object:Gem::Version
173
152
  version: '0'
174
153
  - !ruby/object:Gem::Dependency
175
154
  name: uuidtools
176
155
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
156
  requirements:
179
- - - ! '>='
157
+ - - ">="
180
158
  - !ruby/object:Gem::Version
181
159
  version: '0'
182
160
  type: :runtime
183
161
  prerelease: false
184
162
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
163
  requirements:
187
- - - ! '>='
164
+ - - ">="
188
165
  - !ruby/object:Gem::Version
189
166
  version: '0'
190
167
  - !ruby/object:Gem::Dependency
191
168
  name: activerecord
192
169
  requirement: !ruby/object:Gem::Requirement
193
- none: false
194
170
  requirements:
195
- - - ! '>='
171
+ - - ">="
196
172
  - !ruby/object:Gem::Version
197
173
  version: '3.1'
198
174
  type: :runtime
199
175
  prerelease: false
200
176
  version_requirements: !ruby/object:Gem::Requirement
201
- none: false
202
177
  requirements:
203
- - - ! '>='
178
+ - - ">="
204
179
  - !ruby/object:Gem::Version
205
180
  version: '3.1'
206
181
  description: Add binary (not string) UUIDs to ActiveRecord in MySQL
@@ -210,11 +185,12 @@ executables: []
210
185
  extensions: []
211
186
  extra_rdoc_files: []
212
187
  files:
213
- - .gitignore
214
- - .rspec
215
- - .rvmrc
216
- - .travis.yml
188
+ - ".gitignore"
189
+ - ".rspec"
190
+ - ".rvmrc"
191
+ - ".travis.yml"
217
192
  - Gemfile
193
+ - LICENSE.md
218
194
  - README.mkd
219
195
  - Rakefile
220
196
  - activeuuid.gemspec
@@ -222,6 +198,7 @@ files:
222
198
  - gemfiles/Gemfile.rails-3-2
223
199
  - gemfiles/Gemfile.rails-4-0
224
200
  - gemfiles/Gemfile.rails-4-1
201
+ - gemfiles/Gemfile.rails-4-2
225
202
  - gemfiles/Gemfile.rails-head
226
203
  - lib/activeuuid.rb
227
204
  - lib/activeuuid/patches.rb
@@ -238,6 +215,7 @@ files:
238
215
  - spec/support/database.yml
239
216
  - spec/support/migrate/20111117081813_create_articles.rb
240
217
  - spec/support/migrate/20120817081813_create_uuid_articles.rb
218
+ - spec/support/migrate/20141017204945_add_array_to_articles.rb
241
219
  - spec/support/models/article.rb
242
220
  - spec/support/models/uuid_article.rb
243
221
  - spec/support/models/uuid_article_with_namespace.rb
@@ -245,27 +223,26 @@ files:
245
223
  - spec/support/spec_for_adapter.rb
246
224
  homepage: https://github.com/jashmenn/activeuuid
247
225
  licenses: []
226
+ metadata: {}
248
227
  post_install_message:
249
228
  rdoc_options: []
250
229
  require_paths:
251
230
  - lib
252
231
  required_ruby_version: !ruby/object:Gem::Requirement
253
- none: false
254
232
  requirements:
255
- - - ! '>='
233
+ - - ">="
256
234
  - !ruby/object:Gem::Version
257
235
  version: '0'
258
236
  required_rubygems_version: !ruby/object:Gem::Requirement
259
- none: false
260
237
  requirements:
261
- - - ! '>='
238
+ - - ">="
262
239
  - !ruby/object:Gem::Version
263
240
  version: '0'
264
241
  requirements: []
265
242
  rubyforge_project:
266
- rubygems_version: 1.8.23
243
+ rubygems_version: 2.4.5
267
244
  signing_key:
268
- specification_version: 3
245
+ specification_version: 4
269
246
  summary: Add binary UUIDs to ActiveRecord in MySQL
270
247
  test_files:
271
248
  - spec/fabricators/article_fabricator.rb
@@ -278,6 +255,7 @@ test_files:
278
255
  - spec/support/database.yml
279
256
  - spec/support/migrate/20111117081813_create_articles.rb
280
257
  - spec/support/migrate/20120817081813_create_uuid_articles.rb
258
+ - spec/support/migrate/20141017204945_add_array_to_articles.rb
281
259
  - spec/support/models/article.rb
282
260
  - spec/support/models/uuid_article.rb
283
261
  - spec/support/models/uuid_article_with_namespace.rb