proletariat 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'proletariat/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'proletariat'
7
+ s.version = Proletariat::VERSION
8
+ s.authors = ['Sebastian Edwards']
9
+ s.email = ['me@sebastianedwards.co.nz']
10
+ s.homepage = 'https://github.com/SebastianEdwards/proletariat'
11
+ s.summary = %q{Lightweight background processing powered by RabbitMQ}
12
+ s.description = s.summary
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.require_paths = ['lib']
18
+
19
+ s.add_development_dependency 'rspec', '3.0.0.beta1'
20
+ s.add_development_dependency 'rubocop'
21
+
22
+ s.add_runtime_dependency 'concurrent-ruby', '~> 0.4.0'
23
+ s.add_runtime_dependency 'bunny', '~> 1.1.0'
24
+ end
@@ -0,0 +1,57 @@
1
+ require 'proletariat'
2
+
3
+ # Public: Test fixture
4
+ class PingWorker < Proletariat::Worker
5
+ listen_on :ping
6
+
7
+ class << self
8
+ attr_accessor :pinged
9
+ end
10
+
11
+ def work(message)
12
+ self.class.pinged = true
13
+
14
+ log 'PING'
15
+ sleep 0.5
16
+ publish 'pong'
17
+
18
+ :ok
19
+ end
20
+ end
21
+
22
+ # Public: Test fixture
23
+ class PongWorker < Proletariat::Worker
24
+ listen_on :pong
25
+
26
+ class << self
27
+ attr_accessor :ponged
28
+ end
29
+
30
+ def work(message)
31
+ self.class.ponged = true
32
+
33
+ log 'PONG'
34
+ sleep 0.5
35
+ publish 'ping'
36
+
37
+ :ok
38
+ end
39
+ end
40
+
41
+ describe Proletariat do
42
+ it 'should roughly work' do
43
+ Proletariat.configure(
44
+ logger: Logger.new('/dev/null'),
45
+ worker_classes: [PingWorker, PongWorker]
46
+ )
47
+ Proletariat.run!
48
+ sleep 2
49
+ Proletariat.publish 'ping', ''
50
+ sleep 3
51
+ Proletariat.stop
52
+ Proletariat.purge
53
+
54
+ expect(PingWorker.pinged).to be_truthy
55
+ expect(PongWorker.ponged).to be_truthy
56
+ end
57
+ end
metadata ADDED
@@ -0,0 +1,121 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: proletariat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Sebastian Edwards
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 3.0.0.beta1
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 3.0.0.beta1
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubocop
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: concurrent-ruby
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.4.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.4.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: bunny
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.1.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.1.0
69
+ description: Lightweight background processing powered by RabbitMQ
70
+ email:
71
+ - me@sebastianedwards.co.nz
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - Gemfile
79
+ - README.md
80
+ - Rakefile
81
+ - lib/proletariat.rb
82
+ - lib/proletariat/concerns/logging.rb
83
+ - lib/proletariat/cucumber.rb
84
+ - lib/proletariat/manager.rb
85
+ - lib/proletariat/publisher.rb
86
+ - lib/proletariat/queue_config.rb
87
+ - lib/proletariat/runner.rb
88
+ - lib/proletariat/subscriber.rb
89
+ - lib/proletariat/testing.rb
90
+ - lib/proletariat/testing/expectation.rb
91
+ - lib/proletariat/testing/expectation_guarantor.rb
92
+ - lib/proletariat/testing/fixnum_extension.rb
93
+ - lib/proletariat/version.rb
94
+ - lib/proletariat/worker.rb
95
+ - proletariat.gemspec
96
+ - spec/lib/proletariat_spec.rb
97
+ homepage: https://github.com/SebastianEdwards/proletariat
98
+ licenses: []
99
+ metadata: {}
100
+ post_install_message:
101
+ rdoc_options: []
102
+ require_paths:
103
+ - lib
104
+ required_ruby_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ required_rubygems_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ requirements: []
115
+ rubyforge_project:
116
+ rubygems_version: 2.2.0
117
+ signing_key:
118
+ specification_version: 4
119
+ summary: Lightweight background processing powered by RabbitMQ
120
+ test_files:
121
+ - spec/lib/proletariat_spec.rb