serfx 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/download_serf +2 -2
- data/lib/serfx/commands.rb +8 -0
- data/lib/serfx/connection.rb +2 -1
- data/lib/serfx/utils/handler.rb +1 -1
- data/lib/serfx/version.rb +1 -1
- data/spec/serfx/client_spec.rb +4 -4
- data/spec/serfx/handler_spec.rb +19 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 683dd4d08bf7bae9fe1bbe8eb3be76bb374597b3
|
4
|
+
data.tar.gz: 86923b12a193f8ab737e714265d8880670d1f766
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe3a1c28e9036b08f59f75a092b71a067bca78a8f4f76c6dd852f2ae6df269b716ca99b275f942125ba071bfbb5d660e1bced14dd26d70b6cf1dec22d20aa8f4
|
7
|
+
data.tar.gz: 8272fad66e719ae2d779a4b1045275f118d4c8ea110b071e96cd855bc19231e33796ab9afb5fd3eb15ef305ae9fc4a595ee39d4edda0cfd0901948afef4e9af2
|
data/.travis.yml
CHANGED
data/download_serf
CHANGED
data/lib/serfx/commands.rb
CHANGED
@@ -205,5 +205,13 @@ module Serfx
|
|
205
205
|
def stats
|
206
206
|
request(:stats)
|
207
207
|
end
|
208
|
+
|
209
|
+
# obtain network coordinate of a node
|
210
|
+
#
|
211
|
+
# @param node [String] Name of the node
|
212
|
+
# @return [Response]
|
213
|
+
def get_coordinate
|
214
|
+
request(:get_coordinate, 'Node' => node)
|
215
|
+
end
|
208
216
|
end
|
209
217
|
end
|
data/lib/serfx/connection.rb
CHANGED
data/lib/serfx/utils/handler.rb
CHANGED
data/lib/serfx/version.rb
CHANGED
data/spec/serfx/client_spec.rb
CHANGED
@@ -133,16 +133,16 @@ describe Serfx do
|
|
133
133
|
keys = @conn.list_keys.body['Keys'].keys
|
134
134
|
expect(keys).to include('QHOYjmYlxSCBhdfiolhtDQ==')
|
135
135
|
@conn.install_key('Ih6cZqutM33tMdoFo1iNyw==')
|
136
|
-
sleep
|
136
|
+
sleep 5
|
137
137
|
keys = @conn.list_keys.body['Keys'].keys
|
138
138
|
expect(keys).to include('Ih6cZqutM33tMdoFo1iNyw==')
|
139
|
-
sleep
|
139
|
+
sleep 5
|
140
140
|
@conn.use_key('Ih6cZqutM33tMdoFo1iNyw==')
|
141
141
|
new_keys = @conn.list_keys.body['Keys'].keys
|
142
|
-
sleep
|
142
|
+
sleep 5
|
143
143
|
expect(new_keys.first).to eq('Ih6cZqutM33tMdoFo1iNyw==')
|
144
144
|
@conn.remove_key('QHOYjmYlxSCBhdfiolhtDQ==')
|
145
|
-
sleep
|
145
|
+
sleep 5
|
146
146
|
final_keys = @conn.list_keys.body['Keys'].keys
|
147
147
|
expect(final_keys.first).to_not include('QHOYjmYlxSCBhdfiolhtDQ==')
|
148
148
|
end
|
data/spec/serfx/handler_spec.rb
CHANGED
@@ -15,7 +15,25 @@ describe Serfx::Utils::Handler do
|
|
15
15
|
end
|
16
16
|
ENV['SERF_EVENT'] = 'query'
|
17
17
|
ENV['SERF_QUERY_NAME'] = 'foo'
|
18
|
-
STDIN.
|
18
|
+
expect(STDIN).to receive(:read_nonblock).and_return('yeah')
|
19
|
+
CustomHandler.run
|
20
|
+
expect(CustomHandler.state[:payload]).to eq('yeah')
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'accepts event payload as regex' do
|
24
|
+
class CustomHandler
|
25
|
+
extend Serfx::Utils::Handler
|
26
|
+
@@state = {}
|
27
|
+
def self.state
|
28
|
+
@@state
|
29
|
+
end
|
30
|
+
on :query, /foo:\w+/ do |event|
|
31
|
+
@@state[:payload] = event.payload
|
32
|
+
end
|
33
|
+
end
|
34
|
+
ENV['SERF_EVENT'] = 'query'
|
35
|
+
ENV['SERF_QUERY_NAME'] = 'foo:bar'
|
36
|
+
expect(STDIN).to receive(:read_nonblock).and_return('yeah')
|
19
37
|
CustomHandler.run
|
20
38
|
expect(CustomHandler.state[:payload]).to eq('yeah')
|
21
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serfx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rnjib Dey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
191
|
version: '0'
|
192
192
|
requirements: []
|
193
193
|
rubyforge_project:
|
194
|
-
rubygems_version: 2.
|
194
|
+
rubygems_version: 2.4.5.1
|
195
195
|
signing_key:
|
196
196
|
specification_version: 4
|
197
197
|
summary: A barebone ruby client for serf
|