hookshot 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +0 -14
- data/lib/hookshot.rb +10 -1
- data/lib/hookshot/version.rb +1 -1
- metadata +2 -2
data/Rakefile
CHANGED
@@ -3,19 +3,5 @@ require "bundler/gem_tasks"
|
|
3
3
|
require 'fileutils'
|
4
4
|
require 'pathname'
|
5
5
|
|
6
|
-
ROOT_PATH = Pathname.new(File.expand_path("../../", __FILE__))
|
7
|
-
RUBYGEM_PATH = Pathname.new(File.expand_path("../", __FILE__))
|
8
|
-
|
9
|
-
task build: [:version]
|
10
6
|
task default: :build
|
11
7
|
|
12
|
-
task :version do
|
13
|
-
version = File.read('../VERSION').chomp
|
14
|
-
File.open('lib/hookshot/version.rb', 'w') { |f| f.puts <<END
|
15
|
-
class Hookshot
|
16
|
-
VERSION = "#{version}"
|
17
|
-
end
|
18
|
-
END
|
19
|
-
}
|
20
|
-
end
|
21
|
-
|
data/lib/hookshot.rb
CHANGED
@@ -9,6 +9,8 @@ class Hookshot
|
|
9
9
|
DELAYED_SET = "hookshot:delayed"
|
10
10
|
FAILURES_LIST = "hookshot:failures"
|
11
11
|
|
12
|
+
FINAL_FAILURE = -1
|
13
|
+
|
12
14
|
attr_reader :redis
|
13
15
|
def initialize(redis)
|
14
16
|
@redis = redis
|
@@ -38,7 +40,14 @@ class Hookshot
|
|
38
40
|
|
39
41
|
def get_next_failure
|
40
42
|
# block indefinitely waiting for the next failure.
|
41
|
-
redis.blpop(FAILURES_LIST, 0)
|
43
|
+
line = redis.blpop(FAILURES_LIST, 0)
|
44
|
+
nfailures, failed_id = line.split('|', 2)
|
45
|
+
|
46
|
+
if nfailures.to_i == 0 || failed_id.empty?
|
47
|
+
raise "Invalid line from hookshot: #{line}"
|
48
|
+
end
|
49
|
+
|
50
|
+
[nfailures.to_i, failed_id]
|
42
51
|
end
|
43
52
|
|
44
53
|
private
|
data/lib/hookshot/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hookshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-27 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Hookshot client library for ruby
|
15
15
|
email:
|