rabbit-hat 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +65 -0
- data/Rakefile +4 -0
- data/bin/console +14 -0
- data/bin/hat +6 -0
- data/bin/setup +7 -0
- data/examples/durable.rb +15 -0
- data/examples/subscriber.rb +13 -0
- data/examples/topic.rb +16 -0
- data/lib/hat.rb +11 -0
- data/lib/hat/cli.rb +74 -0
- data/lib/hat/configurable.rb +44 -0
- data/lib/hat/features/durable.rb +11 -0
- data/lib/hat/middleware.rb +14 -0
- data/lib/hat/middlewares/publisher/json.rb +14 -0
- data/lib/hat/middlewares/worker/json.rb +17 -0
- data/lib/hat/patterns/topic.rb +25 -0
- data/lib/hat/publisher.rb +46 -0
- data/lib/hat/runner.rb +17 -0
- data/lib/hat/version.rb +4 -0
- data/lib/hat/worker.rb +57 -0
- data/lib/hat/wrapper.rb +24 -0
- data/lib/tasks/example_tasks.rake +12 -0
- data/log/.gitkeep +0 -0
- data/rabbit-hat.gemspec +29 -0
- metadata +163 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 83d3a2366ac6bd1552faa74a6c4eaab15c97800f
|
4
|
+
data.tar.gz: 8189f9a00d36cd0350833655d16b82da2f5918d2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9a83fe223fbe3d1a60cbc5d58cb59593f96df5c282c54b4469fa9e0ad7492ae853e7605ad49d06d2786a35902e77f3d881fe7d535cca6308475eec72e31fbf69
|
7
|
+
data.tar.gz: fc173b679a9cfa9ad370b5acd1a806353e803985c6c7321bdd3c61d4481b9bfb692727449d83ba68495f8c46cfdfb26c3a8790f0812b2fc77f81d5c4593d8ea7
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 fugufish
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# Hat, lightweight workers for your Rabbit
|
2
|
+
|
3
|
+
Hat is a light weight distributed worker framework backed by RabbitMQ built on top of Celluloid and Bunny with the goal
|
4
|
+
of providing the developer the ability to easily the most powerful features of Rabbit while remaining simple to
|
5
|
+
understand and flexible to use.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'rabbit-hat'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install rabbit-hat
|
22
|
+
|
23
|
+
## Basic Usage
|
24
|
+
|
25
|
+
### A simple worker
|
26
|
+
|
27
|
+
Hat workers are designed to follow similar patterns to that of other background task frameworks such as Resque or
|
28
|
+
Sidekiq. At a minimum the worker needs to inherit from the `Hat::Worker` class and have a `#perform` instance method.
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
class SimpleWorker < Hat::Worker
|
32
|
+
|
33
|
+
def perform(message)
|
34
|
+
# ... process all the things ...
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
The worker can then be run using the `hat` command:
|
41
|
+
|
42
|
+
```bash
|
43
|
+
hat start simple_worker.rb
|
44
|
+
```
|
45
|
+
|
46
|
+
#### A note on worker file naming
|
47
|
+
|
48
|
+
Similar to Rails, hat assumes that a standard file naming convention is being used. Example:
|
49
|
+
|
50
|
+
* ```simple_worker.rb``` becomes ```SimpleWorker```
|
51
|
+
* ```examples/subscriber.rb``` becomes ```Examples::Subscriber```
|
52
|
+
|
53
|
+
## Development
|
54
|
+
|
55
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
56
|
+
|
57
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
58
|
+
|
59
|
+
## Contributing
|
60
|
+
|
61
|
+
1. Fork it ( https://github.com/[my-github-username]/rabbit-hat/fork )
|
62
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
63
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
64
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
65
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require 'hat'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/hat
ADDED
data/bin/setup
ADDED
data/examples/durable.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'hat/middlewares/json'
|
2
|
+
require 'hat/features/durable'
|
3
|
+
module Examples
|
4
|
+
class Durable < Hat::Worker
|
5
|
+
include Hat::Middlewares::Worker::JSON
|
6
|
+
include Hat::Features::Durable
|
7
|
+
|
8
|
+
queue 'hat.direct.durable'
|
9
|
+
|
10
|
+
def perform(_, _, payload)
|
11
|
+
puts payload
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'hat/middlewares/worker/json'
|
2
|
+
module Examples
|
3
|
+
class Subscriber < Hat::Worker
|
4
|
+
include Hat::Middlewares::Worker::JSON
|
5
|
+
|
6
|
+
queue 'hat.examples.subscriber'
|
7
|
+
|
8
|
+
def perform(delivery_info, properties, payload)
|
9
|
+
logger.info payload
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
data/examples/topic.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'hat/middlewares/json'
|
2
|
+
require 'hat/patterns/topic'
|
3
|
+
module Examples
|
4
|
+
class Topic < Hat::Worker
|
5
|
+
include Hat::Middlewares::Worker::JSON
|
6
|
+
include Hat::Patterns::Topic
|
7
|
+
|
8
|
+
queue 'hat.topic.worker'
|
9
|
+
listen 'hat.topic.*'
|
10
|
+
|
11
|
+
def perform(delivery_info, properties, payload)
|
12
|
+
puts payload
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
data/lib/hat.rb
ADDED
data/lib/hat/cli.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
require 'thor'
|
3
|
+
|
4
|
+
module Hat
|
5
|
+
class CLI < Thor
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
desc 'start WORKER [OPTIONS]', 'starts the named workers, or all of the workers in the default or provided' +
|
9
|
+
'worker directory'
|
10
|
+
method_option :dir, default: Dir.getwd, desc: 'sets the root directory'
|
11
|
+
method_option :daemonize, default: false, desc: 'starts the worker as a daemon', aliases: '-D',
|
12
|
+
type: :boolean
|
13
|
+
method_option :workers, default: 1, desc: 'sets the number of processes to run', aliases: '-w',
|
14
|
+
type: :numeric
|
15
|
+
method_option :log, desc: 'sets the location of the log file', aliases: '-l'
|
16
|
+
def start(worker)
|
17
|
+
worker_name = clean_worker_name(worker, options[:dir])
|
18
|
+
say_status(:info, "starting '#{worker_name}'", :yellow)
|
19
|
+
full_path = (Pathname.new(worker).absolute?) ? worker : File.expand_path(File.join(Dir.getwd, worker))
|
20
|
+
raise Thor::Error.new("Unable to locate worker in path: '#{full_path}'") unless File.exists?(full_path)
|
21
|
+
daemon_options = {
|
22
|
+
workers: options[:workers],
|
23
|
+
daemonize: options[:daemonize]
|
24
|
+
}
|
25
|
+
daemon_options[:pid_path] = options[:pid_path] || File.join(options[:dir], 'tmp', 'pids',
|
26
|
+
clean_worker_name(worker, options[:dir]).gsub('/', '-') + '.pid')
|
27
|
+
say_status(:info, "PID path set to '#{daemon_options[:pid_path]}'", :yellow)
|
28
|
+
if daemon_options[:daemonize]
|
29
|
+
daemon_options[:log] = options[:log] || File.join(options[:dir], 'log',
|
30
|
+
clean_worker_name(worker, options[:dir]).gsub('/', '-') + '.log')
|
31
|
+
end
|
32
|
+
say_status(:info, "log path set to '#{daemon_options[:log_path]}'", :yellow)
|
33
|
+
say_status(:info, "running #{daemon_options[:workers]} worker(s)", :yellow)
|
34
|
+
require 'hat'
|
35
|
+
require full_path
|
36
|
+
|
37
|
+
# test that worker class is correctly defined
|
38
|
+
begin
|
39
|
+
worker = Object.const_get(classify_path(worker_name)).new(options)
|
40
|
+
rescue NameError
|
41
|
+
raise Thor::Error.new("Expected file '#{worker_name}' to define '#{classify_path(worker_name)}'")
|
42
|
+
end
|
43
|
+
require 'hat/runner'
|
44
|
+
Hat::Runner.start!(daemon_options.merge(worker: worker))
|
45
|
+
end
|
46
|
+
|
47
|
+
desc 'stop WORKER', 'gracefully stops the named worker'
|
48
|
+
method_option :dir, default: Dir.getwd, desc: 'sets the root directory'
|
49
|
+
def stop(worker)
|
50
|
+
worker_name = clean_worker_name(worker, options[:dir])
|
51
|
+
say_status(:info, "stopping '#{worker_name}'", :yellow)
|
52
|
+
pid_path ||= File.join(options[:dir], 'tmp', 'pids',
|
53
|
+
clean_worker_name(worker, options[:dir]).gsub('/', '-') + '.pid')
|
54
|
+
begin
|
55
|
+
Process.kill(:TERM, File.read(pid_path).to_i)
|
56
|
+
rescue Errno::ESRCH
|
57
|
+
say_status(:fail, "process for '#{worker_name}' in pid file '#{pid_path}' was not found", :red)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def clean_worker_name(string, dir)
|
65
|
+
string.gsub(dir + '/','').gsub('.rb', '')
|
66
|
+
end
|
67
|
+
|
68
|
+
def classify_path(string)
|
69
|
+
string.split('/').collect(&:capitalize).join('::')
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Hat
|
2
|
+
|
3
|
+
def self.config
|
4
|
+
@config ||= Hashie::Mash.new
|
5
|
+
end
|
6
|
+
|
7
|
+
module Configurable
|
8
|
+
|
9
|
+
def self.included(base)
|
10
|
+
base.extend ClassMethods
|
11
|
+
end
|
12
|
+
|
13
|
+
module ClassMethods
|
14
|
+
|
15
|
+
def has_configuration(name, default={})
|
16
|
+
Hat.config[name] = Hashie::Mash.new(default)
|
17
|
+
end
|
18
|
+
|
19
|
+
def config
|
20
|
+
Hat.config
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
def config
|
26
|
+
Hat.config
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
include Configurable
|
32
|
+
|
33
|
+
has_configuration :connection, {
|
34
|
+
host: 'localhost',
|
35
|
+
port: 5672
|
36
|
+
}
|
37
|
+
has_configuration :exchange, {
|
38
|
+
durable: false,
|
39
|
+
exclusive: false
|
40
|
+
}
|
41
|
+
has_configuration :queue, {}
|
42
|
+
|
43
|
+
|
44
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'hat/middleware'
|
2
|
+
require 'json'
|
3
|
+
module Hat
|
4
|
+
module Middlewares
|
5
|
+
module Worker
|
6
|
+
module JSON
|
7
|
+
include Hat::Middleware
|
8
|
+
|
9
|
+
def call(delivery_info, properties, payload)
|
10
|
+
payload = ::JSON.parse(payload)
|
11
|
+
[delivery_info, properties, payload]
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Hat
|
2
|
+
module Patterns
|
3
|
+
module Topic
|
4
|
+
|
5
|
+
module ClassMethods
|
6
|
+
|
7
|
+
def listen(key=nil)
|
8
|
+
self.bind_options[:routing_key] = key
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def exchange
|
16
|
+
@channel.topic('hat.topic')
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.included(base)
|
20
|
+
base.extend ClassMethods
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'hashie'
|
2
|
+
require 'bunny'
|
3
|
+
|
4
|
+
require 'hat/configurable'
|
5
|
+
module Hat
|
6
|
+
|
7
|
+
module Publisher
|
8
|
+
include Configurable
|
9
|
+
|
10
|
+
has_configuration :publisher,
|
11
|
+
{
|
12
|
+
middlewares: [],
|
13
|
+
options: {
|
14
|
+
persistent: false,
|
15
|
+
mandatory: false
|
16
|
+
},
|
17
|
+
default_direct_exchange: 'hat.direct',
|
18
|
+
default_topic_exchange: 'hat.topic'
|
19
|
+
}
|
20
|
+
|
21
|
+
def self.channel
|
22
|
+
unless @connection
|
23
|
+
@connection = Bunny.new
|
24
|
+
@connection.start
|
25
|
+
end
|
26
|
+
@channel ||= @connection.create_channel
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.publish(type, exchange, message, queue=nil, options={}, exchange_options={})
|
30
|
+
options.merge(routing_key: queue) if queue
|
31
|
+
config.publisher.middlewares.each { |m| message = m.call(message) }
|
32
|
+
channel.send(type, exchange, exchange_options.merge(config.exchange)).
|
33
|
+
publish(message, options.merge(config.publisher.options))
|
34
|
+
true
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.direct(queue, message, options={})
|
38
|
+
publish(:direct, (options.delete(:exchange) || config.publisher.default_direct_exchange), message, queue, options)
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.topic(queue, message, options={})
|
42
|
+
publish(:topic, (options.delete(:exchange) || config.publisher.default_topic_exchange), message, queue, options)
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
data/lib/hat/runner.rb
ADDED
data/lib/hat/version.rb
ADDED
data/lib/hat/worker.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
module Hat
|
2
|
+
class Worker
|
3
|
+
include Hat::Configurable
|
4
|
+
|
5
|
+
attr_accessor :id, :logger
|
6
|
+
|
7
|
+
has_configuration :worker, {
|
8
|
+
middlewares: [],
|
9
|
+
queue: {
|
10
|
+
name: 'hat.direct'
|
11
|
+
}.merge(config.queue)
|
12
|
+
}
|
13
|
+
|
14
|
+
class << self
|
15
|
+
|
16
|
+
def queue(name)
|
17
|
+
config.worker.queue.name = name
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
def initialize(options)
|
24
|
+
@options = options
|
25
|
+
@connection = Bunny.new
|
26
|
+
end
|
27
|
+
|
28
|
+
def stop
|
29
|
+
@stop = true
|
30
|
+
end
|
31
|
+
|
32
|
+
def run
|
33
|
+
logger.debug 'Starting rabbit connection'
|
34
|
+
@connection.start
|
35
|
+
logger.debug 'Creating channel'
|
36
|
+
@channel = @connection.create_channel
|
37
|
+
logger.info "Subscribing to #{config.worker.queue.name}"
|
38
|
+
queue.subscribe do |delivery_info, properties, payload|
|
39
|
+
perform(*call(delivery_info, properties, payload))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def call(delivery_info, properties, payload)
|
44
|
+
config.worker.middlwares.each { |m| delivery_info, properties, payload = m.call(delivery_info, properties, payload) }
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def exchange
|
50
|
+
@exchange ||= @channel.direct('hat.direct')
|
51
|
+
end
|
52
|
+
|
53
|
+
def queue
|
54
|
+
@queue ||= @channel.queue(config.worker.queue.name).bind(exchange, config.worker.queue.bind_options || {})
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/hat/wrapper.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
module Hat
|
2
|
+
module Wrapper
|
3
|
+
|
4
|
+
def initialize
|
5
|
+
logger.debug "Initializing wrapper for #{@worker_id}"
|
6
|
+
@stop_flag = ServerEngine::BlockingFlag.new
|
7
|
+
end
|
8
|
+
|
9
|
+
def run
|
10
|
+
logger.debug "Starting worker #{@worker_id}"
|
11
|
+
config[:worker].id = @worker_id
|
12
|
+
config[:worker].logger = logger
|
13
|
+
config[:worker].run
|
14
|
+
until @stop_flag.set? do
|
15
|
+
sleep 0.1
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def stop
|
20
|
+
@stop_flag.set!
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'hat/publisher'
|
2
|
+
namespace :hat do
|
3
|
+
namespace :examples do
|
4
|
+
|
5
|
+
task :seed_direct do
|
6
|
+
require 'hat/middlewares/publisher/json'
|
7
|
+
Hat.config.publisher.middlewares << Hat::Middlewares::Publisher::JSON
|
8
|
+
10000.times { Hat::Publisher.direct('hat.examples.topic', {foo: 'bar'}) }
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
data/log/.gitkeep
ADDED
File without changes
|
data/rabbit-hat.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'hat/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'rabbit-hat'
|
8
|
+
spec.version = Hat::VERSION
|
9
|
+
spec.authors = %w{fugufish}
|
10
|
+
spec.email = %w{jarod@solidalchemy.com}
|
11
|
+
|
12
|
+
spec.summary = %q{A lightweight RabbitMQ worker library.}
|
13
|
+
spec.description = %q{Hat is a light weight distributed worker framework backed by RabbitMQ built on top of Bunny}
|
14
|
+
spec.homepage = 'http://libfugu.so'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "bin"
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency 'thor', '~>0.19'
|
23
|
+
spec.add_dependency 'serverengine', '~>1.5'
|
24
|
+
spec.add_dependency 'bunny', '~>1.7'
|
25
|
+
spec.add_dependency 'hashie'
|
26
|
+
|
27
|
+
spec.add_development_dependency 'bundler', '~> 1.8'
|
28
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rabbit-hat
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- fugufish
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.19'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.19'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: serverengine
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.5'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bunny
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.7'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: hashie
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.8'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.8'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '10.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '10.0'
|
97
|
+
description: Hat is a light weight distributed worker framework backed by RabbitMQ
|
98
|
+
built on top of Bunny
|
99
|
+
email:
|
100
|
+
- jarod@solidalchemy.com
|
101
|
+
executables:
|
102
|
+
- console
|
103
|
+
- hat
|
104
|
+
- setup
|
105
|
+
extensions: []
|
106
|
+
extra_rdoc_files: []
|
107
|
+
files:
|
108
|
+
- ".gitignore"
|
109
|
+
- ".rspec"
|
110
|
+
- ".travis.yml"
|
111
|
+
- CODE_OF_CONDUCT.md
|
112
|
+
- Gemfile
|
113
|
+
- LICENSE.txt
|
114
|
+
- README.md
|
115
|
+
- Rakefile
|
116
|
+
- bin/console
|
117
|
+
- bin/hat
|
118
|
+
- bin/setup
|
119
|
+
- examples/durable.rb
|
120
|
+
- examples/subscriber.rb
|
121
|
+
- examples/topic.rb
|
122
|
+
- lib/hat.rb
|
123
|
+
- lib/hat/cli.rb
|
124
|
+
- lib/hat/configurable.rb
|
125
|
+
- lib/hat/features/durable.rb
|
126
|
+
- lib/hat/middleware.rb
|
127
|
+
- lib/hat/middlewares/publisher/json.rb
|
128
|
+
- lib/hat/middlewares/worker/json.rb
|
129
|
+
- lib/hat/patterns/topic.rb
|
130
|
+
- lib/hat/publisher.rb
|
131
|
+
- lib/hat/runner.rb
|
132
|
+
- lib/hat/version.rb
|
133
|
+
- lib/hat/worker.rb
|
134
|
+
- lib/hat/wrapper.rb
|
135
|
+
- lib/tasks/example_tasks.rake
|
136
|
+
- log/.gitkeep
|
137
|
+
- rabbit-hat.gemspec
|
138
|
+
- tmp/pids/.gitkeep
|
139
|
+
homepage: http://libfugu.so
|
140
|
+
licenses:
|
141
|
+
- MIT
|
142
|
+
metadata: {}
|
143
|
+
post_install_message:
|
144
|
+
rdoc_options: []
|
145
|
+
require_paths:
|
146
|
+
- lib
|
147
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
requirements: []
|
158
|
+
rubyforge_project:
|
159
|
+
rubygems_version: 2.4.6
|
160
|
+
signing_key:
|
161
|
+
specification_version: 4
|
162
|
+
summary: A lightweight RabbitMQ worker library.
|
163
|
+
test_files: []
|