karousel 0.9.12 → 0.9.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +1 -0
- data/Gemfile +4 -4
- data/Gemfile.lock +62 -30
- data/VERSION +1 -1
- data/bin/autospec +16 -0
- data/bin/cucumber +16 -0
- data/bin/htmldiff +16 -0
- data/bin/jeweler +16 -0
- data/bin/ldiff +16 -0
- data/bin/nokogiri +16 -0
- data/bin/rackup +16 -0
- data/bin/rake +16 -0
- data/bin/rdebug +16 -0
- data/bin/ri +16 -0
- data/bin/rspec +16 -0
- data/karousel.gemspec +29 -16
- data/lib/karousel.rb +5 -6
- data/lib/karousel/job.rb +11 -11
- data/spec/karousel_spec.rb +2 -8
- data/spec/spec_helper.rb +1 -0
- data/spec/support/client_job_dummy.rb +1 -1
- metadata +47 -37
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ef18213079b6107700ded2ee615b158c67bf25f1
|
4
|
+
data.tar.gz: d2cf60a1dd89e6f2a6084c4c4c8ab7439b78a4c4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4682cd248ab139cea564a88d3d55d6cf609e19d50f738c701379386944b90dee7a7afb941418fa7d95ac1dde5fac7d50775af4bfffe377572408d6bf62017541
|
7
|
+
data.tar.gz: ce54f921aa5862c3941c8159b56b90ed2263ec5dc252daa60df4c38ad4a85013dd1a7fae60bf27bc60f2b0abdcf25e826afe4372dc1bb28c542b015e6e31ba66
|
data/CHANGELOG
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.9.13 -- major bug fixes
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,47 +1,79 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
4
|
+
addressable (2.3.5)
|
5
|
+
builder (3.2.2)
|
5
6
|
columnize (0.3.6)
|
6
|
-
cucumber (1.
|
7
|
+
cucumber (1.3.8)
|
7
8
|
builder (>= 2.1.2)
|
8
9
|
diff-lcs (>= 1.1.3)
|
9
|
-
gherkin (~> 2.
|
10
|
-
|
11
|
-
|
10
|
+
gherkin (~> 2.12.1)
|
11
|
+
multi_json (>= 1.7.5, < 2.0)
|
12
|
+
multi_test (>= 0.0.2)
|
13
|
+
debugger (1.6.1)
|
12
14
|
columnize (>= 0.3.1)
|
13
|
-
debugger-linecache (~> 1.
|
14
|
-
debugger-ruby_core_source (~> 1.
|
15
|
-
debugger-linecache (1.
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
15
|
+
debugger-linecache (~> 1.2.0)
|
16
|
+
debugger-ruby_core_source (~> 1.2.3)
|
17
|
+
debugger-linecache (1.2.0)
|
18
|
+
debugger-ruby_core_source (1.2.3)
|
19
|
+
diff-lcs (1.2.4)
|
20
|
+
faraday (0.8.8)
|
21
|
+
multipart-post (~> 1.2.0)
|
22
|
+
gherkin (2.12.1)
|
23
|
+
multi_json (~> 1.3)
|
24
|
+
git (1.2.6)
|
25
|
+
github_api (0.10.1)
|
26
|
+
addressable
|
27
|
+
faraday (~> 0.8.1)
|
28
|
+
hashie (>= 1.2)
|
29
|
+
multi_json (~> 1.4)
|
30
|
+
nokogiri (~> 1.5.2)
|
31
|
+
oauth2
|
32
|
+
hashie (2.0.5)
|
33
|
+
highline (1.6.19)
|
34
|
+
httpauth (0.2.0)
|
35
|
+
jeweler (1.8.7)
|
36
|
+
builder
|
23
37
|
bundler (~> 1.0)
|
24
38
|
git (>= 1.2.5)
|
39
|
+
github_api (= 0.10.1)
|
40
|
+
highline (>= 1.6.15)
|
41
|
+
nokogiri (= 1.5.10)
|
25
42
|
rake
|
26
43
|
rdoc
|
27
|
-
json (1.
|
28
|
-
|
29
|
-
|
44
|
+
json (1.8.0)
|
45
|
+
jwt (0.1.8)
|
46
|
+
multi_json (>= 1.5)
|
47
|
+
multi_json (1.8.0)
|
48
|
+
multi_test (0.0.2)
|
49
|
+
multi_xml (0.5.5)
|
50
|
+
multipart-post (1.2.0)
|
51
|
+
nokogiri (1.5.10)
|
52
|
+
oauth2 (0.9.2)
|
53
|
+
faraday (~> 0.8)
|
54
|
+
httpauth (~> 0.2)
|
55
|
+
jwt (~> 0.1.4)
|
56
|
+
multi_json (~> 1.0)
|
57
|
+
multi_xml (~> 0.5)
|
58
|
+
rack (~> 1.2)
|
59
|
+
rack (1.5.2)
|
60
|
+
rake (10.1.0)
|
61
|
+
rdoc (4.0.1)
|
30
62
|
json (~> 1.4)
|
31
|
-
rspec (2.
|
32
|
-
rspec-core (~> 2.
|
33
|
-
rspec-expectations (~> 2.
|
34
|
-
rspec-mocks (~> 2.
|
35
|
-
rspec-core (2.
|
36
|
-
rspec-expectations (2.
|
37
|
-
diff-lcs (
|
38
|
-
rspec-mocks (2.
|
63
|
+
rspec (2.14.1)
|
64
|
+
rspec-core (~> 2.14.0)
|
65
|
+
rspec-expectations (~> 2.14.0)
|
66
|
+
rspec-mocks (~> 2.14.0)
|
67
|
+
rspec-core (2.14.5)
|
68
|
+
rspec-expectations (2.14.2)
|
69
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
70
|
+
rspec-mocks (2.14.3)
|
39
71
|
|
40
72
|
PLATFORMS
|
41
73
|
ruby
|
42
74
|
|
43
75
|
DEPENDENCIES
|
44
|
-
cucumber
|
45
|
-
debugger
|
46
|
-
jeweler
|
47
|
-
rspec
|
76
|
+
cucumber (~> 1.3)
|
77
|
+
debugger (~> 1.6)
|
78
|
+
jeweler (~> 1.8)
|
79
|
+
rspec (~> 2.14)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.13
|
data/bin/autospec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'autospec' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('rspec-core', 'autospec')
|
data/bin/cucumber
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'cucumber' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('cucumber', 'cucumber')
|
data/bin/htmldiff
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'htmldiff' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('diff-lcs', 'htmldiff')
|
data/bin/jeweler
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'jeweler' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('jeweler', 'jeweler')
|
data/bin/ldiff
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'ldiff' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('diff-lcs', 'ldiff')
|
data/bin/nokogiri
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'nokogiri' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('nokogiri', 'nokogiri')
|
data/bin/rackup
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rackup' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('rack', 'rackup')
|
data/bin/rake
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rake' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('rake', 'rake')
|
data/bin/rdebug
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rdebug' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('debugger', 'rdebug')
|
data/bin/ri
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'ri' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('rdoc', 'ri')
|
data/bin/rspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rspec' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('rspec-core', 'rspec')
|
data/karousel.gemspec
CHANGED
@@ -5,13 +5,14 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "karousel"
|
8
|
-
s.version = "0.9.
|
8
|
+
s.version = "0.9.13"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dmitry Mozzherin", "David Shorthouse"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2013-09-18"
|
13
13
|
s.description = "Use it if you have waaay too many items in your workers' queue"
|
14
14
|
s.email = "dmozzherin@gmail.com"
|
15
|
+
s.executables = ["autospec", "cucumber", "htmldiff", "jeweler", "ldiff", "nokogiri", "rackup", "rake", "rdebug", "ri", "rspec"]
|
15
16
|
s.extra_rdoc_files = [
|
16
17
|
"LICENSE.txt",
|
17
18
|
"README.rdoc"
|
@@ -21,12 +22,24 @@ Gem::Specification.new do |s|
|
|
21
22
|
".rspec",
|
22
23
|
".rvmrc",
|
23
24
|
".travis.yml",
|
25
|
+
"CHANGELOG",
|
24
26
|
"Gemfile",
|
25
27
|
"Gemfile.lock",
|
26
28
|
"LICENSE.txt",
|
27
29
|
"README.rdoc",
|
28
30
|
"Rakefile",
|
29
31
|
"VERSION",
|
32
|
+
"bin/autospec",
|
33
|
+
"bin/cucumber",
|
34
|
+
"bin/htmldiff",
|
35
|
+
"bin/jeweler",
|
36
|
+
"bin/ldiff",
|
37
|
+
"bin/nokogiri",
|
38
|
+
"bin/rackup",
|
39
|
+
"bin/rake",
|
40
|
+
"bin/rdebug",
|
41
|
+
"bin/ri",
|
42
|
+
"bin/rspec",
|
30
43
|
"features/karousel.feature",
|
31
44
|
"features/step_definitions/karousel_steps.rb",
|
32
45
|
"features/support/env.rb",
|
@@ -44,28 +57,28 @@ Gem::Specification.new do |s|
|
|
44
57
|
s.homepage = "http://github.com/GlobalNamesArchitecture/karousel"
|
45
58
|
s.licenses = ["MIT"]
|
46
59
|
s.require_paths = ["lib"]
|
47
|
-
s.rubygems_version = "
|
60
|
+
s.rubygems_version = "2.0.3"
|
48
61
|
s.summary = "Job dispenser for parallel workers"
|
49
62
|
|
50
63
|
if s.respond_to? :specification_version then
|
51
|
-
s.specification_version =
|
64
|
+
s.specification_version = 4
|
52
65
|
|
53
66
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
54
|
-
s.add_runtime_dependency(%q<jeweler>, ["
|
55
|
-
s.add_development_dependency(%q<cucumber>, ["
|
56
|
-
s.add_development_dependency(%q<rspec>, ["
|
57
|
-
s.add_development_dependency(%q<debugger>, ["
|
67
|
+
s.add_runtime_dependency(%q<jeweler>, ["~> 1.8"])
|
68
|
+
s.add_development_dependency(%q<cucumber>, ["~> 1.3"])
|
69
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.14"])
|
70
|
+
s.add_development_dependency(%q<debugger>, ["~> 1.6"])
|
58
71
|
else
|
59
|
-
s.add_dependency(%q<jeweler>, ["
|
60
|
-
s.add_dependency(%q<cucumber>, ["
|
61
|
-
s.add_dependency(%q<rspec>, ["
|
62
|
-
s.add_dependency(%q<debugger>, ["
|
72
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8"])
|
73
|
+
s.add_dependency(%q<cucumber>, ["~> 1.3"])
|
74
|
+
s.add_dependency(%q<rspec>, ["~> 2.14"])
|
75
|
+
s.add_dependency(%q<debugger>, ["~> 1.6"])
|
63
76
|
end
|
64
77
|
else
|
65
|
-
s.add_dependency(%q<jeweler>, ["
|
66
|
-
s.add_dependency(%q<cucumber>, ["
|
67
|
-
s.add_dependency(%q<rspec>, ["
|
68
|
-
s.add_dependency(%q<debugger>, ["
|
78
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8"])
|
79
|
+
s.add_dependency(%q<cucumber>, ["~> 1.3"])
|
80
|
+
s.add_dependency(%q<rspec>, ["~> 2.14"])
|
81
|
+
s.add_dependency(%q<debugger>, ["~> 1.6"])
|
69
82
|
end
|
70
83
|
end
|
71
84
|
|
data/lib/karousel.rb
CHANGED
@@ -2,14 +2,14 @@ Dir[File.join(File.dirname(__FILE__), "karousel", "*.rb")].each {|f| require f}
|
|
2
2
|
|
3
3
|
|
4
4
|
class Karousel
|
5
|
-
attr_reader :size, :seats, :time_interval
|
5
|
+
attr_reader :size, :seats, :time_interval
|
6
|
+
STATUS = { init: 1, sent: 2, success: 3, failure: 4 }
|
6
7
|
|
7
8
|
def initialize(klass, size=10, time_interval = 0)
|
8
9
|
@klass = klass
|
9
10
|
@size = size
|
10
11
|
@time_interval = time_interval
|
11
12
|
@seats = []
|
12
|
-
@cycle_data = []
|
13
13
|
end
|
14
14
|
|
15
15
|
def populate
|
@@ -36,7 +36,7 @@ class Karousel
|
|
36
36
|
def send_request
|
37
37
|
@cursor = 0
|
38
38
|
@seats.each_with_index do |job, index|
|
39
|
-
if job.status == :sent
|
39
|
+
if job.status == STATUS[:sent]
|
40
40
|
@cursor = index
|
41
41
|
break
|
42
42
|
end
|
@@ -45,12 +45,11 @@ class Karousel
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def check_response
|
48
|
-
@cycle_data = []
|
49
48
|
@seats = @seats[@cursor..-1] + @seats[0...@cursor] if @cursor != 0
|
50
49
|
@seats.size.times do
|
51
50
|
job = @seats.shift
|
52
|
-
|
53
|
-
|
51
|
+
(job.status != :failure && job.finished?) ? job.process :
|
52
|
+
@seats.push(job)
|
54
53
|
end
|
55
54
|
@cursor = 0
|
56
55
|
end
|
data/lib/karousel/job.rb
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
class Karousel
|
2
2
|
class Job
|
3
|
-
STATUS = { 1 => :init, 2 => :sent, 3 => :success, 4 => :failure }
|
4
3
|
attr_reader :client_job
|
4
|
+
STATUS = { init: 1, sent: 2, success: 3, failure: 4 }
|
5
5
|
|
6
6
|
def initialize(client_job)
|
7
7
|
raise TypeError.new("Unknown client job type") unless client_job.is_a?(Karousel::ClientJob)
|
8
8
|
@client_job = client_job
|
9
|
-
@invert_status = STATUS.invert
|
10
9
|
end
|
11
10
|
|
12
11
|
def status
|
13
|
-
@status =
|
14
|
-
|
12
|
+
@status = @client_job.status
|
13
|
+
unless [1,2,3,4].include?(@status)
|
14
|
+
raise TypeError.new('Status must be an integer between 1 and 4')
|
15
|
+
end
|
15
16
|
@status
|
16
17
|
end
|
17
18
|
|
18
19
|
def status= (new_status)
|
19
|
-
|
20
|
-
|
20
|
+
unless [1,2,3,4].include?(new_status)
|
21
|
+
raise TypeError.new('Status must be an integer between 1 and 4')
|
22
|
+
end
|
21
23
|
@client_job.status = new_status
|
22
24
|
end
|
23
25
|
|
24
26
|
def send
|
25
27
|
is_ok = @client_job.send
|
26
|
-
self.status = is_ok ? :sent : :failure
|
28
|
+
self.status = (is_ok ? STATUS[:sent] : STATUS[:failure])
|
27
29
|
is_ok
|
28
30
|
end
|
29
31
|
|
30
32
|
def finished?
|
31
|
-
|
32
|
-
self.status = is_ok ? :success : :failure
|
33
|
-
is_ok
|
33
|
+
@client_job.finished?
|
34
34
|
end
|
35
35
|
|
36
36
|
def process
|
37
37
|
is_ok = @client_job.process
|
38
|
-
self.status = is_ok ? :success : :failure
|
38
|
+
self.status = (is_ok ? STATUS[:success] : STATUS[:failure])
|
39
39
|
is_ok
|
40
40
|
end
|
41
41
|
|
data/spec/karousel_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative 'spec_helper'
|
2
2
|
|
3
3
|
describe "Karousel" do
|
4
4
|
before(:all) do
|
@@ -22,12 +22,6 @@ describe "Karousel" do
|
|
22
22
|
|
23
23
|
it "should run with block" do
|
24
24
|
karousel = Karousel.new(ClientJobDummy, 20, 0)
|
25
|
-
karousel.run do
|
26
|
-
karousel.cycle_data.size.should > 0
|
27
|
-
statuses = karousel.cycle_data.map {|c| c.status}
|
28
|
-
statuses.uniq!
|
29
|
-
[:failure, :success].should == statuses.sort! if statuses.size > 1
|
30
|
-
end
|
31
25
|
end
|
32
26
|
|
33
27
|
it "should be able to get loaded with jobs" do
|
@@ -35,7 +29,7 @@ describe "Karousel" do
|
|
35
29
|
@karousel.populate
|
36
30
|
@karousel.seats.size.should == 20
|
37
31
|
@karousel.seats[0].class == Karousel::Job
|
38
|
-
@karousel.seats[0].status.should == :init
|
32
|
+
@karousel.seats[0].status.should == Karousel::STATUS[:init]
|
39
33
|
end
|
40
34
|
|
41
35
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,6 +2,7 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
2
2
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
3
|
require 'rspec'
|
4
4
|
require 'karousel'
|
5
|
+
require_relative 'support/client_job_dummy'
|
5
6
|
|
6
7
|
# Requires supporting files with custom matchers and macros, etc,
|
7
8
|
# in ./support/ and its subdirectories.
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: karousel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
5
|
-
prerelease:
|
4
|
+
version: 0.9.13
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Dmitry Mozzherin
|
@@ -10,75 +9,78 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2013-09-18 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: jeweler
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - ~>
|
21
19
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
20
|
+
version: '1.8'
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - ~>
|
29
26
|
- !ruby/object:Gem::Version
|
30
|
-
version: '
|
27
|
+
version: '1.8'
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: cucumber
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
|
-
- -
|
32
|
+
- - ~>
|
37
33
|
- !ruby/object:Gem::Version
|
38
|
-
version: '
|
34
|
+
version: '1.3'
|
39
35
|
type: :development
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
|
-
- -
|
39
|
+
- - ~>
|
45
40
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
41
|
+
version: '1.3'
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
43
|
name: rspec
|
49
44
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
45
|
requirements:
|
52
|
-
- -
|
46
|
+
- - ~>
|
53
47
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
48
|
+
version: '2.14'
|
55
49
|
type: :development
|
56
50
|
prerelease: false
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
52
|
requirements:
|
60
|
-
- -
|
53
|
+
- - ~>
|
61
54
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
55
|
+
version: '2.14'
|
63
56
|
- !ruby/object:Gem::Dependency
|
64
57
|
name: debugger
|
65
58
|
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
59
|
requirements:
|
68
|
-
- -
|
60
|
+
- - ~>
|
69
61
|
- !ruby/object:Gem::Version
|
70
|
-
version: '
|
62
|
+
version: '1.6'
|
71
63
|
type: :development
|
72
64
|
prerelease: false
|
73
65
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
66
|
requirements:
|
76
|
-
- -
|
67
|
+
- - ~>
|
77
68
|
- !ruby/object:Gem::Version
|
78
|
-
version: '
|
69
|
+
version: '1.6'
|
79
70
|
description: Use it if you have waaay too many items in your workers' queue
|
80
71
|
email: dmozzherin@gmail.com
|
81
|
-
executables:
|
72
|
+
executables:
|
73
|
+
- autospec
|
74
|
+
- cucumber
|
75
|
+
- htmldiff
|
76
|
+
- jeweler
|
77
|
+
- ldiff
|
78
|
+
- nokogiri
|
79
|
+
- rackup
|
80
|
+
- rake
|
81
|
+
- rdebug
|
82
|
+
- ri
|
83
|
+
- rspec
|
82
84
|
extensions: []
|
83
85
|
extra_rdoc_files:
|
84
86
|
- LICENSE.txt
|
@@ -88,12 +90,24 @@ files:
|
|
88
90
|
- .rspec
|
89
91
|
- .rvmrc
|
90
92
|
- .travis.yml
|
93
|
+
- CHANGELOG
|
91
94
|
- Gemfile
|
92
95
|
- Gemfile.lock
|
93
96
|
- LICENSE.txt
|
94
97
|
- README.rdoc
|
95
98
|
- Rakefile
|
96
99
|
- VERSION
|
100
|
+
- bin/autospec
|
101
|
+
- bin/cucumber
|
102
|
+
- bin/htmldiff
|
103
|
+
- bin/jeweler
|
104
|
+
- bin/ldiff
|
105
|
+
- bin/nokogiri
|
106
|
+
- bin/rackup
|
107
|
+
- bin/rake
|
108
|
+
- bin/rdebug
|
109
|
+
- bin/ri
|
110
|
+
- bin/rspec
|
97
111
|
- features/karousel.feature
|
98
112
|
- features/step_definitions/karousel_steps.rb
|
99
113
|
- features/support/env.rb
|
@@ -110,29 +124,25 @@ files:
|
|
110
124
|
homepage: http://github.com/GlobalNamesArchitecture/karousel
|
111
125
|
licenses:
|
112
126
|
- MIT
|
127
|
+
metadata: {}
|
113
128
|
post_install_message:
|
114
129
|
rdoc_options: []
|
115
130
|
require_paths:
|
116
131
|
- lib
|
117
132
|
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
-
none: false
|
119
133
|
requirements:
|
120
|
-
- -
|
134
|
+
- - '>='
|
121
135
|
- !ruby/object:Gem::Version
|
122
136
|
version: '0'
|
123
|
-
segments:
|
124
|
-
- 0
|
125
|
-
hash: -3048407349789202224
|
126
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
-
none: false
|
128
138
|
requirements:
|
129
|
-
- -
|
139
|
+
- - '>='
|
130
140
|
- !ruby/object:Gem::Version
|
131
141
|
version: '0'
|
132
142
|
requirements: []
|
133
143
|
rubyforge_project:
|
134
|
-
rubygems_version:
|
144
|
+
rubygems_version: 2.0.3
|
135
145
|
signing_key:
|
136
|
-
specification_version:
|
146
|
+
specification_version: 4
|
137
147
|
summary: Job dispenser for parallel workers
|
138
148
|
test_files: []
|