rrrspec-client 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e29d68ed0c54b2cb4c4417d62f515f09f657bcc
4
- data.tar.gz: 34a655fdacca55bb7f43725a82da62d8da9b4308
3
+ metadata.gz: 9fb74dbf9aa3e2b12c2d51c63e46632d6d2b992a
4
+ data.tar.gz: 80cec3673033f7a65805551e7abece532e879f6f
5
5
  SHA512:
6
- metadata.gz: 7647cb60a2238e446825b32fcd388e0240418a751dfd9ef8ce65ccc34a59630f12b890e289777fbbe3c108fb78faa7b0bb42a0c2d20faba3621703728841e7f7
7
- data.tar.gz: 0b8c083325761f23abc9d3d4778d2a75bc772aee29d6379477d638b9df649642ff247416ec7bfa9d62092336ff8f09489b0a16bdc4bc07f00b275c657911cfe2
6
+ metadata.gz: b68cb648b7a1d79a36e771780341cff32d3a118cde5b7419486c1cfa23b5625bf301e577069ad37b9ecbeea9342fbf90421bf749519807fbe27b76c533b865f9
7
+ data.tar.gz: 4c7c3eac4c52f74156fe76723d7ae6c97ff15bef513a75d5ee3105e25a3a397586b84598db6c022bdb042521f7b7700d4d6a5c147096e63318ebd14a53f580c1
data/lib/rrrspec.rb CHANGED
@@ -1,4 +1,7 @@
1
1
  require 'redis'
2
+ # XXX: With activesupport 4.1, we cannot require active_support/core_ext due to
3
+ # "uninitialized constant ActiveSupport::Autoload (NameError)".
4
+ require 'active_support/dependencies/autoload'
2
5
  require 'active_support/core_ext'
3
6
  require 'active_support/time'
4
7
  require 'socket'
@@ -1,5 +1,5 @@
1
1
  module RRRSpec
2
2
  module Client
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
@@ -87,6 +87,30 @@ module RRRSpec
87
87
  end
88
88
  end
89
89
 
90
+ module StatisticsUpdaterQueue
91
+ STATISTICS_UPDATER_QUEUE_KEY = 'rrrspec:statistics_updater_queue'
92
+
93
+ module_function
94
+
95
+ # Public: Request the taskset to be added to statistics.
96
+ def enqueue(taskset, recalculate = false)
97
+ RRRSpec.redis.rpush(STATISTICS_UPDATER_QUEUE_KEY,
98
+ {taskset: taskset.key, recalculate: recalculate}.to_json)
99
+ end
100
+
101
+ # Public: Wait for the update request.
102
+ def dequeue
103
+ _, line = RRRSpec.redis.blpop(STATISTICS_UPDATER_QUEUE_KEY, 0)
104
+ request = JSON.parse(line)
105
+
106
+ [Taskset.new(request['taskset']), request['recalculate']]
107
+ end
108
+
109
+ def empty?
110
+ RRRSpec.redis.llen(STATISTICS_UPDATER_QUEUE_KEY) == 0
111
+ end
112
+ end
113
+
90
114
  module ActiveTaskset
91
115
  ACTIVE_TASKSET_KEY = 'rrrspec:active_taskset'
92
116
 
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.add_dependency "extreme_timeout"
30
30
  spec.add_dependency "launchy"
31
31
  spec.add_dependency "redis"
32
- spec.add_dependency "rspec", ">= 2.14.1"
32
+ spec.add_dependency "rspec", ">= 2.14.1", "< 3"
33
33
  spec.add_dependency "thor"
34
34
  spec.add_dependency "uuidtools"
35
35
  spec.add_dependency "tzinfo"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rrrspec-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaya Suzuki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-22 00:00:00.000000000 Z
11
+ date: 2014-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -101,6 +101,9 @@ dependencies:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: 2.14.1
104
+ - - "<"
105
+ - !ruby/object:Gem::Version
106
+ version: '3'
104
107
  type: :runtime
105
108
  prerelease: false
106
109
  version_requirements: !ruby/object:Gem::Requirement
@@ -108,6 +111,9 @@ dependencies:
108
111
  - - ">="
109
112
  - !ruby/object:Gem::Version
110
113
  version: 2.14.1
114
+ - - "<"
115
+ - !ruby/object:Gem::Version
116
+ version: '3'
111
117
  - !ruby/object:Gem::Dependency
112
118
  name: thor
113
119
  requirement: !ruby/object:Gem::Requirement