sneakers 2.3.2 → 2.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/lib/sneakers/cli.rb +7 -3
- data/lib/sneakers/tasks.rb +6 -2
- data/lib/sneakers/version.rb +1 -1
- data/lib/sneakers/worker.rb +3 -0
- data/sneakers.gemspec +2 -2
- data/spec/sneakers/cli_spec.rb +18 -6
- data/spec/sneakers/integration_spec.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf343c0b9bfb23767116b7058d8ab1b2d7728a6e
|
4
|
+
data.tar.gz: ba83b4b09433f11f6c69ab9f15a8183819185e00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6041a2cc388192df6ede77ab82c3f05742e7c141d4f0708c083f67310aa763064f80be6a05f1e304dc6e238d158dd9a1052143c55452752e0d5fa4d5034db836
|
7
|
+
data.tar.gz: ee5e2c77fc8cdc354aac8846bb10066e5e039a328f283a8a3dd0511a533064d08dcae7fe8d97774583be5395270ae5a2c4c01a0f26acf6a5ec647261246bbe20
|
data/.travis.yml
CHANGED
data/lib/sneakers/cli.rb
CHANGED
@@ -28,7 +28,7 @@ module Sneakers
|
|
28
28
|
method_option :require
|
29
29
|
|
30
30
|
desc "work FirstWorker,SecondWorker ... ,NthWorker", "Run workers"
|
31
|
-
def work(workers)
|
31
|
+
def work(workers = "")
|
32
32
|
opts = {
|
33
33
|
:daemonize => !!options[:daemonize]
|
34
34
|
}
|
@@ -44,9 +44,13 @@ module Sneakers
|
|
44
44
|
|
45
45
|
require_boot File.expand_path(options[:require]) if options[:require]
|
46
46
|
|
47
|
-
workers
|
47
|
+
if workers.empty?
|
48
|
+
workers = Sneakers::Worker::Classes
|
49
|
+
else
|
50
|
+
workers, missing_workers = Sneakers::Utils.parse_workers(workers)
|
51
|
+
end
|
48
52
|
|
49
|
-
unless missing_workers.empty?
|
53
|
+
unless missing_workers.nil? || missing_workers.empty?
|
50
54
|
say "Missing workers: #{missing_workers.join(', ')}" if missing_workers
|
51
55
|
say "Did you `require` properly?"
|
52
56
|
return
|
data/lib/sneakers/tasks.rb
CHANGED
@@ -13,9 +13,13 @@ namespace :sneakers do
|
|
13
13
|
::Rails.application.eager_load!
|
14
14
|
end
|
15
15
|
|
16
|
-
|
16
|
+
if ENV["WORKERS"].nil?
|
17
|
+
workers = Sneakers::Workers::Classes
|
18
|
+
else
|
19
|
+
workers, missing_workers = Sneakers::Utils.parse_workers(ENV['WORKERS'])
|
20
|
+
end
|
17
21
|
|
18
|
-
unless missing_workers.empty?
|
22
|
+
unless missing_workers.nil? || missing_workers.empty?
|
19
23
|
puts "Missing workers: #{missing_workers.join(', ')}" if missing_workers
|
20
24
|
puts "Did you `require` properly?"
|
21
25
|
exit(1)
|
data/lib/sneakers/version.rb
CHANGED
data/lib/sneakers/worker.rb
CHANGED
data/sneakers.gemspec
CHANGED
@@ -10,14 +10,14 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.email = ['jondotan@gmail.com']
|
11
11
|
gem.description = %q( Fast background processing framework for Ruby and RabbitMQ )
|
12
12
|
gem.summary = %q( Fast background processing framework for Ruby and RabbitMQ )
|
13
|
-
gem.homepage = ''
|
13
|
+
gem.homepage = 'http://sneakers.io'
|
14
14
|
gem.required_ruby_version = Gem::Requirement.new(">= 2.0")
|
15
15
|
|
16
16
|
gem.files = `git ls-files`.split($/).reject { |f| f == 'Gemfile.lock' }
|
17
17
|
gem.executables = gem.files.grep(/^bin/).map { |f| File.basename(f) }
|
18
18
|
gem.test_files = gem.files.grep(/^(test|spec|features)\//)
|
19
19
|
gem.require_paths = ['lib']
|
20
|
-
gem.add_dependency 'serverengine', '~> 1.5.
|
20
|
+
gem.add_dependency 'serverengine', '~> 1.5.11'
|
21
21
|
gem.add_dependency 'bunny', '~> 2.2.0'
|
22
22
|
gem.add_dependency 'thread', '~> 0.1.7'
|
23
23
|
gem.add_dependency 'thor'
|
data/spec/sneakers/cli_spec.rb
CHANGED
@@ -11,12 +11,12 @@ describe Sneakers::CLI do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
14
|
+
after do
|
15
|
+
# require cleanup
|
16
|
+
Object.send(:remove_const, :TitleScraper) if Object.constants.include?(:TitleScraper)
|
17
|
+
end
|
19
18
|
|
19
|
+
describe 'with dirty class loading' do
|
20
20
|
it "should perform a run" do
|
21
21
|
any_instance_of(Sneakers::Runner) do |runner|
|
22
22
|
mock(runner).run{ true }
|
@@ -58,6 +58,18 @@ describe Sneakers::CLI do
|
|
58
58
|
out.must_match(/Missing workers: TitleScraper/)
|
59
59
|
end
|
60
60
|
|
61
|
+
it "should run all workers when run without specifying any" do
|
62
|
+
out = capture_io{ Sneakers::CLI.start [
|
63
|
+
"work",
|
64
|
+
"--require=#{File.expand_path("../fixtures/require_worker.rb", File.dirname(__FILE__))}"
|
65
|
+
]}.join ''
|
66
|
+
|
67
|
+
out.must_match(/Workers.*:.*TitleScraper.*/)
|
68
|
+
end
|
69
|
+
|
70
|
+
after do
|
71
|
+
# require cleanup
|
72
|
+
Object.send(:remove_const, :TitleScraper) if Object.constants.include?(:TitleScraper)
|
73
|
+
end
|
61
74
|
end
|
62
75
|
end
|
63
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sneakers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dotan Nahum
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: serverengine
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.5.
|
19
|
+
version: 1.5.11
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.5.
|
26
|
+
version: 1.5.11
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bunny
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -296,7 +296,7 @@ files:
|
|
296
296
|
- spec/sneakers/worker_handlers_spec.rb
|
297
297
|
- spec/sneakers/worker_spec.rb
|
298
298
|
- spec/spec_helper.rb
|
299
|
-
homepage:
|
299
|
+
homepage: http://sneakers.io
|
300
300
|
licenses: []
|
301
301
|
metadata: {}
|
302
302
|
post_install_message:
|