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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 733fe6cd472f61a3055431c5d17d1ca8ff14690a
4
- data.tar.gz: 523562a5e31f948814c2384a91151a2cd2df7a0d
3
+ metadata.gz: cf343c0b9bfb23767116b7058d8ab1b2d7728a6e
4
+ data.tar.gz: ba83b4b09433f11f6c69ab9f15a8183819185e00
5
5
  SHA512:
6
- metadata.gz: 07fbd52feddac85c3e29d6435b139d9e89d2853694e623dabe36a330dfbd082a2e219d3ce906d21038f1af37891d92012b95f7a0e6bc8fc30e9a88c5650babae
7
- data.tar.gz: ca949d95e442ef2b6f89f9c4506eceeaade78a5f9bcb1d1700a60419891bd34fe1ec66c8c1283cc7077302a8046cccf5df8580cfea207da22a1e4ea03d572fef
6
+ metadata.gz: 6041a2cc388192df6ede77ab82c3f05742e7c141d4f0708c083f67310aa763064f80be6a05f1e304dc6e238d158dd9a1052143c55452752e0d5fa4d5034db836
7
+ data.tar.gz: ee5e2c77fc8cdc354aac8846bb10066e5e039a328f283a8a3dd0511a533064d08dcae7fe8d97774583be5395270ae5a2c4c01a0f26acf6a5ec647261246bbe20
@@ -1,6 +1,8 @@
1
1
  services:
2
2
  - rabbitmq
3
3
  - redis-server
4
+ sudo: false
5
+ cache: bundler
4
6
  language: ruby
5
7
  rvm:
6
8
  - ruby-head
@@ -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, missing_workers = Sneakers::Utils.parse_workers(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
@@ -13,9 +13,13 @@ namespace :sneakers do
13
13
  ::Rails.application.eager_load!
14
14
  end
15
15
 
16
- workers, missing_workers = Sneakers::Utils.parse_workers(ENV['WORKERS'])
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)
@@ -1,3 +1,3 @@
1
1
  module Sneakers
2
- VERSION = "2.3.2"
2
+ VERSION = "2.3.4"
3
3
  end
@@ -123,8 +123,11 @@ module Sneakers
123
123
  logger.debug(log_msg(msg))
124
124
  end
125
125
 
126
+ Classes = []
127
+
126
128
  def self.included(base)
127
129
  base.extend ClassMethods
130
+ Classes << base if base.is_a? Class
128
131
  end
129
132
 
130
133
  module ClassMethods
@@ -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.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'
@@ -11,12 +11,12 @@ describe Sneakers::CLI do
11
11
  end
12
12
  end
13
13
 
14
- describe 'with dirty class loading' do
15
- after do
16
- # require cleanup
17
- Object.send(:remove_const, :TitleScraper)
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
-
@@ -34,7 +34,7 @@ describe "integration" do
34
34
  puts "Rabbitmq admin seems to not exist? you better be running this on Travis or Docker. proceeding.\n#{$!}"
35
35
  end
36
36
 
37
-
37
+ Sneakers.clear!
38
38
  Sneakers.configure
39
39
  Sneakers.logger.level = Logger::ERROR
40
40
 
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.2
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-08 00:00:00.000000000 Z
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.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.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: