cequel 1.2.4 → 1.2.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83c50053063595b07ec25edb5c847006eaa12ed8
4
- data.tar.gz: 574cce3d4c75fe7150bb647abdfc1baa2c68a666
3
+ metadata.gz: 37fbccb394100663a372dde3d9308a890091e36c
4
+ data.tar.gz: 2f594bf403ed6ba55ee54aa2c495c8c60fb6bb3a
5
5
  SHA512:
6
- metadata.gz: 5d45ddd9e7368275d347b8104849a41de8ad1db6ecd1e5811e1bb8ad88cbdd9fa19df92fcbe8bafed2cf46bc147d5981202eca0875423f6a753ac756d09c18f0
7
- data.tar.gz: 35a041419ee196ddb8c8acd06f523fa0b808c9ad109f99122792bcda0bea2ef76f65a3420b455327092f5c2a39e1029285ff066cd1a9e5f10b9aa99f8702e0cb
6
+ metadata.gz: 4f9d5c21fd006ce0e5021e3d6d3e144d5f27c075b56831fc0c766a9040a294e3c30dcf9e107fdb0f9b9f8677c490882a0bd6378a2af3d83a117e98e0fc39b098
7
+ data.tar.gz: 6c4122980edd642cefb3056c2f8fe3c236cf3bc89db38e1328c52ed4365b386fef83a799afc9d08e82c0b5d3b5f14e9f013008b22fb27a78e3d1e75ee822b099
@@ -1,3 +1,10 @@
1
+ ## 1.2.5
2
+
3
+ * Fix `puts` behavior when passed a Record instance
4
+ * Fix batch loading of record sets with bounds on first of multiple clustering
5
+ columns
6
+ * Fix load order of namespaced models for migrations
7
+
1
8
  ## 1.2.4
2
9
 
3
10
  * Apply empty attribute values when hydrating records
@@ -1,17 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cequel (1.2.4)
4
+ cequel (1.2.5)
5
5
  activemodel (>= 3.1, < 5.0)
6
6
  cql-rb (~> 1.2)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (4.1.0)
12
- activesupport (= 4.1.0)
11
+ activemodel (4.1.1)
12
+ activesupport (= 4.1.1)
13
13
  builder (~> 3.1)
14
- activesupport (4.1.0)
14
+ activesupport (4.1.1)
15
15
  i18n (~> 0.6, >= 0.6.9)
16
16
  json (~> 1.7, >= 1.7.7)
17
17
  minitest (~> 5.1)
@@ -20,20 +20,20 @@ GEM
20
20
  appraisal (0.5.2)
21
21
  bundler
22
22
  rake
23
- ast (1.1.0)
23
+ ast (2.0.0)
24
24
  builder (3.2.2)
25
25
  byebug (2.7.0)
26
26
  columnize (~> 0.3)
27
27
  debugger-linecache (~> 1.2)
28
28
  coderay (1.1.0)
29
- columnize (0.3.6)
29
+ columnize (0.8.9)
30
30
  cql-rb (1.2.1)
31
31
  debugger (1.6.6)
32
32
  columnize (>= 0.3.1)
33
33
  debugger-linecache (~> 1.2.0)
34
34
  debugger-ruby_core_source (~> 1.3.2)
35
35
  debugger-linecache (1.2.0)
36
- debugger-ruby_core_source (1.3.2)
36
+ debugger-ruby_core_source (1.3.4)
37
37
  diff-lcs (1.2.5)
38
38
  ffi (1.9.3-java)
39
39
  ffi2-generators (0.1.1)
@@ -41,9 +41,9 @@ GEM
41
41
  json (1.8.1)
42
42
  json (1.8.1-java)
43
43
  method_source (0.8.2)
44
- minitest (5.3.2)
45
- parser (2.1.7)
46
- ast (~> 1.1)
44
+ minitest (5.3.4)
45
+ parser (2.1.9)
46
+ ast (>= 1.1, < 3.0)
47
47
  slop (~> 3.4, >= 3.4.5)
48
48
  powerpack (0.0.9)
49
49
  pry (0.9.12.6)
@@ -58,7 +58,7 @@ GEM
58
58
  psych (2.0.5)
59
59
  racc (1.4.11)
60
60
  rainbow (2.0.0)
61
- rake (10.2.2)
61
+ rake (10.3.1)
62
62
  rspec (2.14.1)
63
63
  rspec-core (~> 2.14.0)
64
64
  rspec-expectations (~> 2.14.0)
@@ -73,7 +73,7 @@ GEM
73
73
  powerpack (~> 0.0.6)
74
74
  rainbow (>= 1.99.1, < 3.0)
75
75
  ruby-progressbar (~> 1.4)
76
- ruby-progressbar (1.4.2)
76
+ ruby-progressbar (1.5.1)
77
77
  rubysl (2.0.15)
78
78
  rubysl-abbrev (~> 2.0)
79
79
  rubysl-base64 (~> 2.0)
@@ -136,7 +136,7 @@ exec /opt/apache-cassandra-$1/bin/cassandra" > /etc/init/cassandra.conf
136
136
  service cassandra start
137
137
  SH
138
138
 
139
- versions = (0..6).map { |p| "2.0.#{p}" } + (0..15).map { |p| "1.2.#{p}" }
139
+ versions = (0..7).map { |p| "2.0.#{p}" } + (0..16).map { |p| "1.2.#{p}" }
140
140
  versions.each do |version|
141
141
  java_version = version =~ /^1/ ? '6' : '7'
142
142
  config.vm.define version do |machine|
@@ -660,10 +660,35 @@ module Cequel
660
660
  end
661
661
 
662
662
  def find_nested_batches_from(row, options, &block)
663
- if next_range_key_column
664
- at(row[range_key_name])
665
- .next_batch_from(row)
666
- .find_rows_in_batches(options, &block)
663
+ return unless next_range_key_column
664
+
665
+ without_bounds_on(range_key_column)[row[range_key_name]]
666
+ .next_batch_from(row)
667
+ .find_rows_in_batches(options, &block)
668
+ end
669
+
670
+ # @return [RecordSet] self but without any bounds conditions on
671
+ # the specified column.
672
+ #
673
+ # @private
674
+ def without_bounds_on(column)
675
+ without_lower_bound_on(column)
676
+ .without_upper_bound_on(column)
677
+ end
678
+
679
+ def without_lower_bound_on(column)
680
+ if lower_bound && lower_bound.column == column
681
+ scoped(lower_bound: nil)
682
+ else
683
+ self
684
+ end
685
+ end
686
+
687
+ def without_upper_bound_on(column)
688
+ if upper_bound && upper_bound.column == column
689
+ scoped(upper_bound: nil)
690
+ else
691
+ self
667
692
  end
668
693
  end
669
694
 
@@ -19,7 +19,8 @@ module Cequel
19
19
  def_delegators :current_scope,
20
20
  *(RecordSet.public_instance_methods(false) +
21
21
  BulkWrites.public_instance_methods -
22
- Object.instance_methods)
22
+ Object.instance_methods -
23
+ [:to_ary])
23
24
 
24
25
  # @private
25
26
  def current_scope
@@ -21,7 +21,8 @@ namespace :cequel do
21
21
 
22
22
  migration_table_names = Set[]
23
23
  models_dir_path = "#{Rails.root.join('app', 'models')}/"
24
- Dir.glob(Rails.root.join('app', 'models', '**', '*.rb')).each do |file|
24
+ model_files = Dir.glob(Rails.root.join('app', 'models', '**', '*.rb'))
25
+ model_files.sort.each do |file|
25
26
  watch_namespaces = ["Object"]
26
27
  model_file_name = file.sub(/^#{Regexp.escape(models_dir_path)}/, "")
27
28
  dirname = File.dirname(model_file_name)
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Cequel
3
3
  # The current version of the library
4
- VERSION = '1.2.4'
4
+ VERSION = '1.2.5'
5
5
  end
@@ -856,4 +856,48 @@ describe Cequel::Record::RecordSet do
856
856
  should == postgres_posts.drop(2).map(&:permalink)
857
857
  end
858
858
  end
859
+
860
+ context "table clustered on time and uuid" do
861
+ model(:BlogView) do
862
+ key :blog_subdomain, :ascii
863
+ key :view_time, :timestamp
864
+ key :sk, :uuid, auto: true
865
+ end
866
+
867
+ let!(:blog_1_views){
868
+ 4.times
869
+ .map{|i| BlogView.create!(blog_subdomain: "blog-1",
870
+ view_time: now - i.minutes) }
871
+ .sort_by(&:view_time)
872
+ }
873
+
874
+ it "can execute multi-batch queries with range on partial cluster key" do
875
+ expect{|blk| BlogView['blog-1']
876
+ .in( blog_1_views.first.view_time .. now )
877
+ .find_each(batch_size: 2, &blk)}
878
+ .to yield_successive_args *blog_1_views
879
+ end
880
+
881
+ it "can execute multi-batch queries with range on partial key excluding beginning of partition" do
882
+ expect{|blk| BlogView['blog-1']
883
+ .in( blog_1_views.second.view_time .. now )
884
+ .find_each(batch_size: 2, &blk)}
885
+ .to yield_successive_args *blog_1_views.drop(1)
886
+ end
887
+
888
+ it "can execute multi-batch queries with range on partial key excluding end of partition" do
889
+ expect{|blk| BlogView['blog-1']
890
+ .in( blog_1_views.first.view_time .. blog_1_views[-2].view_time )
891
+ .find_each(batch_size: 2, &blk)}
892
+ .to yield_successive_args *blog_1_views[0..-2]
893
+ end
894
+
895
+ it "can execute queries with range on partial cluster key" do
896
+ expect{|blk| BlogView['blog-1']
897
+ .in( blog_1_views.first.view_time .. now )
898
+ .find_each(&blk)}
899
+ .to yield_successive_args *blog_1_views
900
+ end
901
+ end
902
+
859
903
  end
@@ -11,4 +11,12 @@ describe Cequel::Record::Scoped do
11
11
  it 'should use current scoped key values to populate new record' do
12
12
  Post['bigdata'].new.blog_subdomain.should == 'bigdata'
13
13
  end
14
+
15
+ it "should not mess up class' #puts" do
16
+ StringIO.new.tap do |out|
17
+ out.puts Post
18
+ out.string.should == "Post\n"
19
+ end
20
+
21
+ end
14
22
  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: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mat Brown
@@ -18,7 +18,7 @@ authors:
18
18
  autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
- date: 2014-04-23 00:00:00.000000000 Z
21
+ date: 2014-05-16 00:00:00.000000000 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: activemodel