cequel 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c970b068b50a1215dc4bf58af07dfc5b1b936214
4
- data.tar.gz: c7470426d1cac668b2bd698d7f35608835b2bf0a
3
+ metadata.gz: a80d11ecb01e9f096a0204ed67d0cfa65a897d59
4
+ data.tar.gz: 020e36ad78e92832d03b139d5e2999ab37f26239
5
5
  SHA512:
6
- metadata.gz: 5ce7dfd8aa2d73dc6d6748a789b4cd84ab137fb7c3d98bc70df830c6f64d8fb86a0e4e3fb26de6ce0d0c8167db8fcb8a0a2e3c57799f6847cf239db0ae73e4e0
7
- data.tar.gz: 886e98099ef58ee431a76f4560e89ad10e3146a0850293671aa8bef45b852fa1bcdab41d2968639ec24dd7bfcba45c516ac88bf1de0f119f3fecf8b15a0eda95
6
+ metadata.gz: 3807632c2c476021c1e539835d5a45fc4fbd37ecc61cfd94b1af653f2a2cca28aabcd905df664cfccf6b3ba82004335411fe15dc571bc157168ff4248bc94203
7
+ data.tar.gz: cf8c648c7a1053687ea86a71ded3cb09cacf6dd277ec936d8401ac95608848fd1991b90ee8546d11803fca238b0e2da43dbfc6262a0a47b4b3f0b8599f751786
@@ -1,3 +1,6 @@
1
+ ## 3.0.1
2
+ - fix list modification bug with Cassandra versions > 2.2.10 and 3.11.0
3
+
1
4
  ## 3.0.0
2
5
  * Drop support for changing the type of cluster keys as it is no longer support by Cassandra.
3
6
  * Drop support for non-option based index specification in table schema DSL. For example, `column :author_name, :text, true` must be rewritten as `column :author_name, :text, index: true`.
@@ -1,16 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cequel (3.0.0)
4
+ cequel (3.0.1)
5
5
  activemodel (>= 4.0)
6
6
  cassandra-driver (~> 3.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (5.0.0.1)
12
- activesupport (= 5.0.0.1)
13
- activesupport (5.0.0.1)
11
+ activemodel (5.1.4)
12
+ activesupport (= 5.1.4)
13
+ activesupport (5.1.4)
14
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
15
  i18n (~> 0.7)
16
16
  minitest (~> 5.1)
@@ -21,93 +21,98 @@ GEM
21
21
  rake
22
22
  thor (>= 0.14.0)
23
23
  ast (2.3.0)
24
- backports (3.6.8)
24
+ backports (3.10.3)
25
25
  byebug (2.7.0)
26
26
  columnize (~> 0.3)
27
27
  debugger-linecache (~> 1.2)
28
- cassandra-driver (3.0.3)
28
+ cassandra-driver (3.2.0)
29
29
  ione (~> 1.2)
30
- coderay (1.1.1)
30
+ cassandra-driver (3.2.0-java)
31
+ ione (~> 1.2)
32
+ coderay (1.1.2)
31
33
  columnize (0.9.0)
32
- concurrent-ruby (1.0.2)
34
+ concurrent-ruby (1.0.5)
35
+ concurrent-ruby (1.0.5-java)
33
36
  debugger-linecache (1.2.0)
34
- diff-lcs (1.2.5)
35
- ethon (0.9.1)
37
+ diff-lcs (1.3)
38
+ ethon (0.11.0)
36
39
  ffi (>= 1.3.0)
37
- faraday (0.9.2)
40
+ faraday (0.13.1)
38
41
  multipart-post (>= 1.2, < 3)
39
- faraday_middleware (0.10.0)
40
- faraday (>= 0.7.4, < 0.10)
41
- ffi (1.9.14)
42
- ffi (1.9.14-java)
42
+ faraday_middleware (0.12.2)
43
+ faraday (>= 0.7.4, < 1.0)
44
+ ffi (1.9.18)
45
+ ffi (1.9.18-java)
43
46
  ffi2-generators (0.1.1)
44
- gh (0.14.0)
45
- addressable
47
+ gh (0.15.1)
48
+ addressable (~> 2.4.0)
46
49
  backports
47
50
  faraday (~> 0.8)
48
51
  multi_json (~> 1.0)
49
- net-http-persistent (>= 2.7)
52
+ net-http-persistent (~> 2.9)
50
53
  net-http-pipeline
51
54
  highline (1.7.8)
52
- i18n (0.7.0)
53
- ione (1.2.3)
54
- json (2.0.2)
55
- json (2.0.2-java)
55
+ i18n (0.9.1)
56
+ concurrent-ruby (~> 1.0)
57
+ ione (1.2.4)
58
+ json (2.1.0)
59
+ json (2.1.0-java)
56
60
  launchy (2.4.3)
57
61
  addressable (~> 2.3)
58
62
  launchy (2.4.3-java)
59
63
  addressable (~> 2.3)
60
64
  spoon (~> 0.0.1)
61
- method_source (0.8.2)
62
- minitest (5.9.1)
63
- multi_json (1.12.1)
65
+ method_source (0.9.0)
66
+ minitest (5.10.3)
67
+ multi_json (1.12.2)
64
68
  multipart-post (2.0.0)
65
69
  net-http-persistent (2.9.4)
66
70
  net-http-pipeline (1.0.1)
67
- parser (2.3.1.4)
71
+ parallel (1.12.0)
72
+ parser (2.4.0.0)
68
73
  ast (~> 2.2)
69
74
  powerpack (0.1.1)
70
- pry (0.10.4)
75
+ pry (0.11.2)
71
76
  coderay (~> 1.1.0)
72
- method_source (~> 0.8.1)
73
- slop (~> 3.4)
74
- pry (0.10.4-java)
77
+ method_source (~> 0.9.0)
78
+ pry (0.11.2-java)
75
79
  coderay (~> 1.1.0)
76
- method_source (~> 0.8.1)
77
- slop (~> 3.4)
80
+ method_source (~> 0.9.0)
78
81
  spoon (~> 0.0)
79
- psych (2.1.1)
82
+ psych (2.2.4)
80
83
  pusher-client (0.6.2)
81
84
  json
82
85
  websocket (~> 1.0)
83
86
  racc (1.4.14)
84
- rainbow (2.1.0)
87
+ rainbow (2.2.2)
88
+ rake
85
89
  rake (10.5.0)
86
- rspec (3.5.0)
87
- rspec-core (~> 3.5.0)
88
- rspec-expectations (~> 3.5.0)
89
- rspec-mocks (~> 3.5.0)
90
- rspec-core (3.5.4)
91
- rspec-support (~> 3.5.0)
92
- rspec-expectations (3.5.0)
90
+ rspec (3.7.0)
91
+ rspec-core (~> 3.7.0)
92
+ rspec-expectations (~> 3.7.0)
93
+ rspec-mocks (~> 3.7.0)
94
+ rspec-core (3.7.0)
95
+ rspec-support (~> 3.7.0)
96
+ rspec-expectations (3.7.0)
93
97
  diff-lcs (>= 1.2.0, < 2.0)
94
- rspec-support (~> 3.5.0)
98
+ rspec-support (~> 3.7.0)
95
99
  rspec-its (1.2.0)
96
100
  rspec-core (>= 3.0.0)
97
101
  rspec-expectations (>= 3.0.0)
98
- rspec-mocks (3.5.0)
102
+ rspec-mocks (3.7.0)
99
103
  diff-lcs (>= 1.2.0, < 2.0)
100
- rspec-support (~> 3.5.0)
101
- rspec-retry (0.5.3)
102
- rspec-core (> 3.3, < 3.6)
103
- rspec-support (3.5.0)
104
- rubocop (0.43.0)
105
- parser (>= 2.3.1.1, < 3.0)
104
+ rspec-support (~> 3.7.0)
105
+ rspec-retry (0.5.6)
106
+ rspec-core (> 3.3, < 3.8)
107
+ rspec-support (3.7.0)
108
+ rubocop (0.51.0)
109
+ parallel (~> 1.10)
110
+ parser (>= 2.3.3.1, < 3.0)
106
111
  powerpack (~> 0.1)
107
- rainbow (>= 1.99.1, < 3.0)
112
+ rainbow (>= 2.2.2, < 3.0)
108
113
  ruby-progressbar (~> 1.7)
109
114
  unicode-display_width (~> 1.0, >= 1.0.1)
110
- ruby-progressbar (1.8.1)
115
+ ruby-progressbar (1.9.0)
111
116
  rubysl (2.2.0)
112
117
  rubysl-abbrev (~> 2.0)
113
118
  rubysl-base64 (~> 2.0)
@@ -249,7 +254,7 @@ GEM
249
254
  rubysl-mkmf (2.1)
250
255
  rubysl-fileutils (~> 2.0)
251
256
  rubysl-shellwords (~> 2.0)
252
- rubysl-monitor (2.0.0)
257
+ rubysl-monitor (2.1)
253
258
  rubysl-mutex_m (2.0.0)
254
259
  rubysl-net-ftp (2.0.1)
255
260
  rubysl-net-http (2.0.4)
@@ -265,7 +270,7 @@ GEM
265
270
  rubysl-observer (2.0.0)
266
271
  rubysl-open-uri (2.0.0)
267
272
  rubysl-open3 (2.0.0)
268
- rubysl-openssl (2.8.0)
273
+ rubysl-openssl (2.9)
269
274
  rubysl-optparse (2.0.1)
270
275
  rubysl-shellwords (~> 2.0)
271
276
  rubysl-ostruct (2.1.0)
@@ -286,15 +291,15 @@ GEM
286
291
  rubysl-set (2.0.1)
287
292
  rubysl-shellwords (2.0.0)
288
293
  rubysl-singleton (2.0.0)
289
- rubysl-socket (2.1.2)
294
+ rubysl-socket (2.2.1)
290
295
  rubysl-fcntl (~> 2.0)
291
- rubysl-stringio (2.1.0)
296
+ rubysl-stringio (2.2)
292
297
  rubysl-strscan (2.0.0)
293
298
  rubysl-sync (2.0.0)
294
299
  rubysl-syslog (2.1.0)
295
300
  ffi2-generators (~> 0.1)
296
301
  rubysl-tempfile (2.0.1)
297
- rubysl-thread (2.0.3)
302
+ rubysl-thread (2.1)
298
303
  rubysl-thwait (2.0.0)
299
304
  rubysl-time (2.0.3)
300
305
  rubysl-timeout (2.0.0)
@@ -310,13 +315,13 @@ GEM
310
315
  rubysl-xmlrpc (2.0.0)
311
316
  rubysl-yaml (2.1.0)
312
317
  rubysl-zlib (2.0.1)
313
- slop (3.6.0)
314
318
  spoon (0.0.6)
315
319
  ffi
316
- thor (0.19.1)
317
- thread_safe (0.3.5)
318
- timecop (0.8.1)
319
- travis (1.8.2)
320
+ thor (0.20.0)
321
+ thread_safe (0.3.6)
322
+ thread_safe (0.3.6-java)
323
+ timecop (0.9.1)
324
+ travis (1.8.8)
320
325
  backports
321
326
  faraday (~> 0.9)
322
327
  faraday_middleware (~> 0.9, >= 0.9.1)
@@ -327,12 +332,12 @@ GEM
327
332
  typhoeus (~> 0.6, >= 0.6.8)
328
333
  typhoeus (0.8.0)
329
334
  ethon (>= 0.8.0)
330
- tzinfo (1.2.2)
335
+ tzinfo (1.2.4)
331
336
  thread_safe (~> 0.1)
332
- unicode-display_width (1.1.1)
333
- websocket (1.2.3)
337
+ unicode-display_width (1.3.0)
338
+ websocket (1.2.4)
334
339
  wwtd (0.9.1)
335
- yard (0.9.5)
340
+ yard (0.9.9)
336
341
 
337
342
  PLATFORMS
338
343
  java
@@ -289,7 +289,9 @@ module Cequel
289
289
  #
290
290
  def list_remove_at(column, *positions)
291
291
  options = positions.extract_options!
292
- deleter { list_remove_at(column, *positions) }.execute(options)
292
+ sorted_positions = positions.sort.reverse
293
+
294
+ deleter { list_remove_at(column, *sorted_positions) }.execute(options)
293
295
  end
294
296
 
295
297
  #
@@ -217,39 +217,32 @@ module Cequel
217
217
  # @param count [Integer] number of elements to replace
218
218
  # @param elements [Array] new elements to replace in this range
219
219
  #
220
- def []=(position, *args)
221
- if position.is_a?(Range)
222
- first, count = position.first, position.count
223
- else
224
- first, count = position, args[-2]
225
- end
220
+ def []=(*args)
221
+ if args[0].is_a?(Fixnum) && args.count == 2
222
+ # single element set/replace
223
+ elem = cast_element(args[1])
226
224
 
227
- element = args[-1] =
228
- if args[-1].is_a?(Array) then cast_collection(args[-1])
229
- else cast_element(args[-1])
225
+ to_update do
226
+ set_item(args[0], elem)
230
227
  end
228
+ to_modify { super(args[0], elem) }
231
229
 
232
- if first < 0
233
- fail ArgumentError,
234
- "Bad index #{position}: CQL lists do not support negative " \
235
- "indices"
236
- end
237
-
238
- to_update do
239
- if count.nil?
240
- updater.list_replace(column_name, first, element)
241
- else
242
- element = Array.wrap(element)
243
- count.times do |i|
244
- if i < element.length
245
- updater.list_replace(column_name, first+i, element[i])
246
- else
247
- deleter.list_remove_at(column_name, first+i)
248
- end
249
- end
230
+ else
231
+ # multi-element set/replace
232
+ range = if args[0].is_a?(Range)
233
+ args[0]
234
+ elsif args[0].is_a?(Fixnum) && args[1].is_a?(Fixnum)
235
+ args[0]..(args[0]+args[1]-1)
236
+ else
237
+ Kernel.raise ArgumentError, "[i]=elem or [i,count]=elems or [a..b]=elems"
238
+ end
239
+ elems = cast_collection(Array.wrap(args[-1]))
240
+
241
+ to_update do
242
+ set_range(range, elems, args[-1])
250
243
  end
244
+ to_modify { super(range, elems) }
251
245
  end
252
- to_modify { super }
253
246
  end
254
247
 
255
248
  #
@@ -337,6 +330,31 @@ module Cequel
337
330
  to_modify { super }
338
331
  end
339
332
  alias_method :prepend, :unshift
333
+
334
+ protected
335
+
336
+ def set_item(position, elem)
337
+ elem = cast_element(elem)
338
+
339
+ updater.list_replace(column_name, position, elem)
340
+ end
341
+
342
+ def set_range(range, elems, _raw_elems)
343
+ replace_range = if elems.count < range.count
344
+ range.begin..(range.begin+elems.count-1)
345
+ else
346
+ range
347
+ end
348
+ delete_range = (replace_range.end+1)..range.end
349
+
350
+ replace_range.zip(elems).each do |position, elem|
351
+ updater.list_replace(column_name, position, elem)
352
+ end
353
+
354
+ delete_range.to_a.reverse.each do |position|
355
+ deleter.list_remove_at(column_name, position)
356
+ end
357
+ end
340
358
  end
341
359
 
342
360
  #
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Cequel
3
3
  # The current version of the library
4
- VERSION = '3.0.0'
4
+ VERSION = '3.0.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cequel
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mat Brown
@@ -29,7 +29,7 @@ authors:
29
29
  autorequire:
30
30
  bindir: bin
31
31
  cert_chain: []
32
- date: 2017-03-15 00:00:00.000000000 Z
32
+ date: 2017-11-10 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: activemodel