ruby-druid 0.1.9 → 0.9.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.
@@ -7,8 +7,8 @@ module ZK
7
7
  include RSpec::Matchers
8
8
 
9
9
  def initialize(uri, opts)
10
- uri.should == 'test-uri'
11
- opts.should == { :chroot => :check }
10
+ expect(uri).to eq('test-uri')
11
+ expect(opts).to eq({ :chroot => :check })
12
12
  @registrations = {}
13
13
  @paths = {
14
14
  '/disco' => ['a', 'b'],
@@ -19,8 +19,8 @@ module ZK
19
19
  end
20
20
 
21
21
  def register(path, opts, &block)
22
- opts.should == { :only => :child }
23
- @registrations[path].should == nil
22
+ expect(opts).to eq({ :only => :child })
23
+ expect(@registrations[path]).to eq(nil)
24
24
 
25
25
  zk = self
26
26
  block.define_singleton_method :unregister do
@@ -37,7 +37,7 @@ module ZK
37
37
  end
38
38
 
39
39
  def children(path, opts)
40
- @registrations[path].should be_a(Proc)
40
+ expect(@registrations[path]).to be_a(Proc)
41
41
 
42
42
  value = @paths[path]
43
43
  throw "no mock code for #{path}" unless value
@@ -47,30 +47,15 @@ module ZK
47
47
  def get(path)
48
48
  case path
49
49
  when '/disco/a/b1'
50
- [{
51
- :address => 'b1_address',
52
- :port => 80
53
- }.to_json]
50
+ [{ :address => 'b1_address', :port => 80 }.to_json]
54
51
  when '/disco/a/m1'
55
- [{
56
- :address => 'm1_address',
57
- :port => 81
58
- }.to_json]
52
+ [{ :address => 'm1_address', :port => 81 }.to_json]
59
53
  when '/disco/b/b2'
60
- [{
61
- :address => 'b2_address',
62
- :port => 90
63
- }.to_json]
54
+ [{ :address => 'b2_address', :port => 90 }.to_json]
64
55
  when '/disco/b/m2'
65
- [{
66
- :address => 'm2_address',
67
- :port => 85
68
- }.to_json]
56
+ [{ :address => 'm2_address', :port => 85 }.to_json]
69
57
  when '/disco/a/b3'
70
- [{
71
- :address => 'b3_address',
72
- :port => 83
73
- }.to_json]
58
+ [{ :address => 'b3_address', :port => 83 }.to_json]
74
59
  else
75
60
  throw "no mock code for #{path}"
76
61
  end
@@ -101,98 +86,98 @@ class RestClientResponseMock
101
86
  end
102
87
  end
103
88
 
104
- describe Druid::ZooHandler do
89
+ describe Druid::ZK do
105
90
  it 'reports services and data sources correctly' do
106
91
  calls = []
107
- RestClient::Request.stub(:execute) do |opts|
108
- uri_match = opts[:url].match /^http:\/\/(.+)_address:(.+)\/druid\/v2\/datasources\/$/
92
+ expect(RestClient::Request).to receive(:execute).at_least(:once) do |opts|
93
+ uri_match = opts[:url].match(/^http:\/\/(.+)_address:(.+)\/druid\/v2\/datasources\/$/)
109
94
 
110
95
  host = uri_match[1]
111
96
  port = uri_match[2].to_i
112
97
 
113
- calls.push [host, port]
98
+ calls.push([host, port])
114
99
 
115
100
  case host
116
101
  when 'b1'
117
- RestClientResponseMock.new(200, ['s1','s2'].to_json)
102
+ RestClientResponseMock.new(200, ['s1', 's2'].to_json)
118
103
  when 'b2'
119
- RestClientResponseMock.new(200, ['s3','s4'].to_json)
104
+ RestClientResponseMock.new(200, ['s3', 's4'].to_json)
120
105
  when 'b3'
121
- RestClientResponseMock.new(200, ['s5','s6'].to_json)
106
+ RestClientResponseMock.new(200, ['s5', 's6'].to_json)
122
107
  else
123
108
  RestClientResponseMock.new(404, nil)
124
109
  end
125
110
  end
126
111
 
127
- zk = Druid::ZooHandler.new 'test-uri', :discovery_path => '/disco'
112
+ zk = Druid::ZK.new('test-uri', :discovery_path => '/disco')
128
113
 
129
- calls.should == [
114
+ expect(calls).to eq([
130
115
  ['b1', 80],
131
116
  ['m1', 81],
132
117
  ['b2', 90],
133
118
  ['m2', 85]
134
- ]
135
- zk.services.should == ['a', 'b']
136
- zk.data_sources.should == {
119
+ ])
120
+ expect(zk.services).to eq(['a', 'b'])
121
+ expect(zk.data_sources).to eq({
137
122
  'a/s1' => 'http://b1_address:80/druid/v2/',
138
123
  'a/s2' => 'http://b1_address:80/druid/v2/',
139
124
  'b/s3' => 'http://b2_address:90/druid/v2/',
140
125
  'b/s4' => 'http://b2_address:90/druid/v2/'
141
- }
126
+ })
142
127
 
143
128
  calls = []
144
129
  mock = zk.instance_variable_get('@zk')
145
- mock.unregistrations.should == []
130
+ expect(mock.unregistrations).to eq([])
146
131
 
147
132
  # unregister a whole service
148
133
  mock.change '/disco', ['a']
149
- calls.should == []
150
- zk.services.should == ['a']
151
- zk.data_sources.should == {
134
+ expect(calls).to eq([])
135
+ expect(zk.services).to eq(['a'])
136
+ expect(zk.data_sources).to eq({
152
137
  'a/s1' => 'http://b1_address:80/druid/v2/',
153
138
  'a/s2' => 'http://b1_address:80/druid/v2/'
154
- }
155
- mock.unregistrations.should == ['/disco/b']
139
+ })
140
+ expect(mock.unregistrations).to eq(['/disco/b'])
156
141
  # register it again
157
142
  mock.change '/disco', ['a', 'b']
158
- calls.should == [
143
+ expect(calls).to eq([
159
144
  ['b2', 90],
160
145
  ['m2', 85]
161
- ]
162
- zk.services.should == ['a', 'b']
163
- zk.data_sources.should == {
146
+ ])
147
+ expect(zk.services).to eq(['a', 'b'])
148
+ expect(zk.data_sources).to eq({
164
149
  'a/s1' => 'http://b1_address:80/druid/v2/',
165
150
  'a/s2' => 'http://b1_address:80/druid/v2/',
166
151
  'b/s3' => 'http://b2_address:90/druid/v2/',
167
152
  'b/s4' => 'http://b2_address:90/druid/v2/'
168
- }
169
- mock.unregistrations.should == []
153
+ })
154
+ expect(mock.unregistrations).to eq([])
170
155
 
171
156
  #register a new broker
172
157
  calls = []
173
158
  mock.change '/disco/a', ['b1', 'b3']
174
- calls.should == [['b3', 83]]
175
- zk.services.should == ['a', 'b']
176
- zk.data_sources.should == {
177
- "a/s1" => "http://b1_address:80/druid/v2/",
178
- "a/s2" => "http://b1_address:80/druid/v2/",
179
- "b/s3" => "http://b2_address:90/druid/v2/",
180
- "b/s4" => "http://b2_address:90/druid/v2/",
181
- "a/s5" => "http://b3_address:83/druid/v2/",
182
- "a/s6" => "http://b3_address:83/druid/v2/"
183
- }
184
- mock.unregistrations.should == ['/disco/a']
159
+ expect(calls).to eq([['b3', 83]])
160
+ expect(zk.services).to eq(['a', 'b'])
161
+ expect(zk.data_sources).to eq({
162
+ 'a/s1' => 'http://b1_address:80/druid/v2/',
163
+ 'a/s2' => 'http://b1_address:80/druid/v2/',
164
+ 'b/s3' => 'http://b2_address:90/druid/v2/',
165
+ 'b/s4' => 'http://b2_address:90/druid/v2/',
166
+ 'a/s5' => 'http://b3_address:83/druid/v2/',
167
+ 'a/s6' => 'http://b3_address:83/druid/v2/'
168
+ })
169
+ expect(mock.unregistrations).to eq(['/disco/a'])
185
170
  # unregister it
186
171
  calls = []
187
172
  mock.change '/disco/a', ['b1']
188
- calls.should == []
189
- zk.services.should == ['a', 'b']
190
- zk.data_sources.should == {
173
+ expect(calls).to eq([])
174
+ expect(zk.services).to eq(['a', 'b'])
175
+ expect(zk.data_sources).to eq({
191
176
  'a/s1' => 'http://b1_address:80/druid/v2/',
192
177
  'a/s2' => 'http://b1_address:80/druid/v2/',
193
178
  'b/s3' => 'http://b2_address:90/druid/v2/',
194
179
  'b/s4' => 'http://b2_address:90/druid/v2/'
195
- }
196
- mock.unregistrations.should == ['/disco/a']
180
+ })
181
+ expect(mock.unregistrations).to eq(['/disco/a'])
197
182
  end
198
183
  end
metadata CHANGED
@@ -1,76 +1,184 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-druid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
- - LiquidM, Inc.
7
+ - Ruby Druid Community
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-30 00:00:00.000000000 Z
11
+ date: 2016-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: zk
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activemodel
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
- - - ">="
31
+ - - "~>"
18
32
  - !ruby/object:Gem::Version
19
- version: '0'
33
+ version: '4.2'
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
- - - ">="
38
+ - - "~>"
25
39
  - !ruby/object:Gem::Version
26
- version: '0'
40
+ version: '4.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: iso8601
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.9'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.9'
55
+ - !ruby/object:Gem::Dependency
56
+ name: multi_json
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.12'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.12'
27
69
  - !ruby/object:Gem::Dependency
28
70
  name: rest-client
29
71
  requirement: !ruby/object:Gem::Requirement
30
72
  requirements:
31
- - - ">="
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: zk
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
32
88
  - !ruby/object:Gem::Version
33
- version: '0'
89
+ version: '1.9'
34
90
  type: :runtime
35
91
  prerelease: false
36
92
  version_requirements: !ruby/object:Gem::Requirement
37
93
  requirements:
38
- - - ">="
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.9'
97
+ - !ruby/object:Gem::Dependency
98
+ name: bundler
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.12'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.12'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rake
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '11.2'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '11.2'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '3.4'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '3.4'
139
+ - !ruby/object:Gem::Dependency
140
+ name: webmock
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '2.1'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
39
151
  - !ruby/object:Gem::Version
40
- version: '0'
41
- description: Ruby client for metamx druid
42
- email:
43
- - opensource@liquidm.com
44
- executables:
45
- - dripl
152
+ version: '2.1'
153
+ description: |2
154
+ ruby-druid is a Ruby client for Druid. It includes a Squeel-like query DSL
155
+ and generates a JSON query that can be sent to Druid directly.
156
+ email:
157
+ executables: []
46
158
  extensions: []
47
159
  extra_rdoc_files: []
48
160
  files:
49
- - ".gitignore"
50
- - ".rspec"
51
- - ".travis.yml"
52
- - Gemfile
53
161
  - LICENSE
54
162
  - README.md
55
- - Rakefile
56
- - bin/dripl
57
- - dot_driplrc_example
58
163
  - lib/druid.rb
164
+ - lib/druid/aggregation.rb
59
165
  - lib/druid/client.rb
60
- - lib/druid/console.rb
166
+ - lib/druid/context.rb
167
+ - lib/druid/data_source.rb
61
168
  - lib/druid/filter.rb
169
+ - lib/druid/granularity.rb
62
170
  - lib/druid/having.rb
63
171
  - lib/druid/post_aggregation.rb
64
172
  - lib/druid/query.rb
65
- - lib/druid/response_row.rb
66
- - lib/druid/serializable.rb
67
- - lib/druid/zoo_handler.rb
173
+ - lib/druid/version.rb
174
+ - lib/druid/zk.rb
68
175
  - ruby-druid.gemspec
69
176
  - spec/lib/client_spec.rb
177
+ - spec/lib/data_source_spec.rb
70
178
  - spec/lib/query_spec.rb
71
- - spec/lib/zoo_handler_spec.rb
179
+ - spec/lib/zk_spec.rb
72
180
  - spec/spec_helper.rb
73
- homepage: https://github.com/liquidm/ruby-druid
181
+ homepage: https://github.com/ruby-druid/ruby-druid
74
182
  licenses:
75
183
  - MIT
76
184
  metadata: {}
@@ -90,13 +198,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
198
  version: '0'
91
199
  requirements: []
92
200
  rubyforge_project:
93
- rubygems_version: 2.1.11
201
+ rubygems_version: 2.5.1
94
202
  signing_key:
95
203
  specification_version: 4
96
- summary: Ruby client for metamx druid
204
+ summary: A Ruby client for Druid
97
205
  test_files:
98
206
  - spec/lib/client_spec.rb
207
+ - spec/lib/data_source_spec.rb
99
208
  - spec/lib/query_spec.rb
100
- - spec/lib/zoo_handler_spec.rb
209
+ - spec/lib/zk_spec.rb
101
210
  - spec/spec_helper.rb
102
- has_rdoc:
data/.gitignore DELETED
@@ -1,6 +0,0 @@
1
- Gemfile.lock
2
- .driplrc
3
- ruby-druid-0.0.1.gem
4
- spec/test.json
5
- tmp/rspec_guard_result
6
- pkg/
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --colour
2
- --require spec_helper
@@ -1,9 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - jruby
4
- - 2.0.0
5
- - 1.9.3
6
- script:
7
- - bundle exec rspec --format documentation
8
- notifications:
9
- email: false