riak-shim 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YzQxODU3YzQzMjJhOGQ0MTA1MDVlMzA5ZGU0M2U0MThmOTE3NmNhMA==
5
+ data.tar.gz: !binary |-
6
+ MWEzZjYyMjlkZjI0ZjE4YWUzYTM3YjhlN2QyMDJiNzY4YmViZDZhMA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ YzAwOWMyMWU0YTgyYTg1ZGIwNDFhYWI1N2Y0NWQ2ODA0ZTdkZjVkMzNiYjEz
10
+ NGM4YWUxNzNiMWJhNjU4YTUyYTQ4OTcxMGUxZGU3ZGQzNWQyMTc3NGJkYTMz
11
+ Y2FiNzFhZjMwYzFlMDU5MDEwY2IwM2U3OWQ2ZTU3YThmYzNjOTA=
12
+ data.tar.gz: !binary |-
13
+ M2UxMzhmNWEzYjdhNjU2N2YxMWFmNDYwODA1NmQyODk5ZmVmMWQ2ZGYzNjFm
14
+ MjRjZWZiNjE1ZGI0NTM3ZTc1NzZmNWU5MmZmMmUzOTE4MDQwNDVkYzBlYTYw
15
+ Yzk5MjcwMmE0Y2VkZWE2NWZkNmI5ZjM0Y2Q2YTBmZGU0NWNlOGM=
data/.travis.yml CHANGED
@@ -1,13 +1,11 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.8.7
4
3
  - 1.9.2
5
4
  - 1.9.3
6
5
  - 2.0.0
7
- - jruby-18mode
8
6
  - jruby-19mode
9
- - rbx-18mode
10
7
  - rbx-19mode
8
+ gemfile: Gemfile.ci
11
9
  script: bundle exec rake travis
12
10
  services: riak
13
11
 
data/Gemfile CHANGED
@@ -1,10 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
- platforms :jruby do
5
- gem 'jruby-openssl'
6
- end
7
-
8
4
  def darwin_only(require_as)
9
5
  RUBY_PLATFORM.include?('darwin') && require_as
10
6
  end
@@ -14,6 +10,9 @@ group :development do
14
10
  gem 'guard-yard'
15
11
  gem 'yard'
16
12
  gem 'redcarpet'
13
+ gem 'guard'
14
+ gem 'guard-rspec'
15
+ gem 'pry'
17
16
  end
18
17
  end
19
18
 
data/Gemfile.ci ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+
4
+ platforms :jruby do
5
+ gem 'jruby-openssl'
6
+ end
@@ -1,3 +1,4 @@
1
+ require 'riak-shim/secondary_index_query.rb'
1
2
 
2
3
  module Riak
3
4
  module Shim
@@ -100,6 +101,11 @@ module Riak
100
101
  end
101
102
  end
102
103
 
104
+ # @return [Riak::Shim::SeconardyIndexQuery] an interface to ducktype index lookups as hash lookups. i.e. Class['SECONDARY_INDEX']['KEY']
105
+ def [](val)
106
+ SecondaryIndexQuery.new(self, val)
107
+ end
108
+
103
109
  # @return [String] a UUID which we will use as our key
104
110
  def gen_key
105
111
  UUIDTools::UUID.random_create.to_s
@@ -0,0 +1,16 @@
1
+ module Riak
2
+ module Shim
3
+ module Persistable
4
+ class SecondaryIndexQuery
5
+ def initialize(obj, idx)
6
+ @obj = obj
7
+ @idx = idx =~ /_bin$/ ? idx : "#{idx}_bin"
8
+ end
9
+
10
+ def [](key)
11
+ @obj.for_index(@idx, key)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,5 +1,5 @@
1
1
  module Riak
2
2
  module Shim
3
- VERSION = "1.0.3"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
data/riak-shim.gemspec CHANGED
@@ -15,16 +15,12 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Riak::Shim::VERSION
17
17
 
18
- gem.add_dependency 'riak-client', '~>1.2.0'
19
- gem.add_dependency 'excon', '~>0.22.1'
18
+ gem.add_dependency 'riak-client', '~>1.4.2'
19
+ gem.add_dependency 'excon', '~>0.29.0'
20
20
  gem.add_dependency 'uuidtools', '~>2.1.4'
21
21
  gem.add_dependency 'json'
22
22
  gem.add_development_dependency 'rake'
23
23
  gem.add_development_dependency 'rspec'
24
24
  gem.add_development_dependency 'gem-release'
25
-
26
- gem.add_development_dependency 'guard'
27
- gem.add_development_dependency 'guard-rspec'
28
- gem.add_development_dependency 'pry'
29
25
  gem.add_development_dependency 'awesome_print'
30
26
  end
@@ -210,6 +210,31 @@ describe Riak::Shim::Persistable do
210
210
  end
211
211
  end
212
212
 
213
+ describe '#[]' do
214
+ before do
215
+ @indexed = []
216
+ 3.times do |i|
217
+ indexable = PersistableExampleWithIndex.new
218
+ indexable.foo = i
219
+ indexable.bar = 'wombat'
220
+ indexable.save
221
+ @indexed << indexable
222
+ end
223
+ end
224
+
225
+ after do
226
+ PersistableExampleWithIndex.delete_all
227
+ end
228
+
229
+ it 'returns all items which match indexed value' do
230
+ PersistableExampleWithIndex['bar_bin']['wombat'].should =~ @indexed
231
+ end
232
+
233
+ it 'returns an empty list when no matches are found' do
234
+ PersistableExampleWithIndex['bar_bin']['chew'].should be_empty
235
+ end
236
+ end
237
+
213
238
  describe '#gen_key' do
214
239
  before do
215
240
  @keys = []
data/spec/spec_helper.rb CHANGED
@@ -1,8 +1,12 @@
1
1
  $: << './lib'
2
2
  require 'riak-shim'
3
- require 'pry'
4
3
  require 'awesome_print'
5
4
 
5
+ begin
6
+ require 'pry'
7
+ rescue LoadError
8
+ end
9
+
6
10
  ENV['RACK_ENV'] = 'test' unless ENV['RACK_ENV']
7
11
  DB_CONFIG = { 'development' => { 'bucket_prefix' => 'dev_', 'host' => "localhost", 'http_port' => 8098},
8
12
  'test' => {'bucket_prefix' => 'test_', 'host' => "localhost", 'http_port' => 8098 }}
metadata CHANGED
@@ -1,52 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riak-shim
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
5
- prerelease:
4
+ version: 1.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Michael Brodhead, Shai Rosenfeld, and Larry Diehl
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-24 00:00:00.000000000 Z
11
+ date: 2013-11-19 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: riak-client
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: 1.2.0
19
+ version: 1.4.2
22
20
  type: :runtime
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
- version: 1.2.0
26
+ version: 1.4.2
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: excon
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
37
- version: 0.22.1
33
+ version: 0.29.0
38
34
  type: :runtime
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
- version: 0.22.1
40
+ version: 0.29.0
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: uuidtools
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
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
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: json
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :runtime
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
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rake
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ! '>='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
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
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: rspec
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ! '>='
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
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
@@ -110,7 +97,6 @@ dependencies:
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: gem-release
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
101
  - - ! '>='
116
102
  - !ruby/object:Gem::Version
@@ -118,55 +104,6 @@ dependencies:
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: '0'
126
- - !ruby/object:Gem::Dependency
127
- name: guard
128
- requirement: !ruby/object:Gem::Requirement
129
- none: false
130
- requirements:
131
- - - ! '>='
132
- - !ruby/object:Gem::Version
133
- version: '0'
134
- type: :development
135
- prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
- requirements:
139
- - - ! '>='
140
- - !ruby/object:Gem::Version
141
- version: '0'
142
- - !ruby/object:Gem::Dependency
143
- name: guard-rspec
144
- requirement: !ruby/object:Gem::Requirement
145
- none: false
146
- requirements:
147
- - - ! '>='
148
- - !ruby/object:Gem::Version
149
- version: '0'
150
- type: :development
151
- prerelease: false
152
- version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
- requirements:
155
- - - ! '>='
156
- - !ruby/object:Gem::Version
157
- version: '0'
158
- - !ruby/object:Gem::Dependency
159
- name: pry
160
- requirement: !ruby/object:Gem::Requirement
161
- none: false
162
- requirements:
163
- - - ! '>='
164
- - !ruby/object:Gem::Version
165
- version: '0'
166
- type: :development
167
- prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
107
  requirements:
171
108
  - - ! '>='
172
109
  - !ruby/object:Gem::Version
@@ -174,7 +111,6 @@ dependencies:
174
111
  - !ruby/object:Gem::Dependency
175
112
  name: awesome_print
176
113
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
114
  requirements:
179
115
  - - ! '>='
180
116
  - !ruby/object:Gem::Version
@@ -182,7 +118,6 @@ dependencies:
182
118
  type: :development
183
119
  prerelease: false
184
120
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
121
  requirements:
187
122
  - - ! '>='
188
123
  - !ruby/object:Gem::Version
@@ -198,6 +133,7 @@ files:
198
133
  - .travis.yml
199
134
  - FUTURE_WORK.md
200
135
  - Gemfile
136
+ - Gemfile.ci
201
137
  - Guardfile
202
138
  - Guardfile-yard
203
139
  - LICENSE
@@ -205,6 +141,7 @@ files:
205
141
  - Rakefile
206
142
  - lib/riak-shim.rb
207
143
  - lib/riak-shim/persistable.rb
144
+ - lib/riak-shim/secondary_index_query.rb
208
145
  - lib/riak-shim/store.rb
209
146
  - lib/riak-shim/version.rb
210
147
  - riak-shim.gemspec
@@ -215,27 +152,26 @@ files:
215
152
  - spec/support/database.yml
216
153
  homepage: https://github.com/mkb/riak-shim
217
154
  licenses: []
155
+ metadata: {}
218
156
  post_install_message:
219
157
  rdoc_options: []
220
158
  require_paths:
221
159
  - lib
222
160
  required_ruby_version: !ruby/object:Gem::Requirement
223
- none: false
224
161
  requirements:
225
162
  - - ! '>='
226
163
  - !ruby/object:Gem::Version
227
164
  version: '0'
228
165
  required_rubygems_version: !ruby/object:Gem::Requirement
229
- none: false
230
166
  requirements:
231
167
  - - ! '>='
232
168
  - !ruby/object:Gem::Version
233
169
  version: '0'
234
170
  requirements: []
235
171
  rubyforge_project:
236
- rubygems_version: 1.8.25
172
+ rubygems_version: 2.1.11
237
173
  signing_key:
238
- specification_version: 3
174
+ specification_version: 4
239
175
  summary: A tiny shim between you and riak-client. Reads config/database.yml and generates
240
176
  sensible bucket names.
241
177
  test_files: