kahuna 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 +19 -0
- data/.travis.yml +11 -0
- data/Gemfile +4 -0
- data/Guardfile +11 -0
- data/LICENSE.txt +22 -0
- data/README.md +73 -0
- data/Rakefile +1 -0
- data/bin/.gitkeep +0 -0
- data/kahuna.gemspec +30 -0
- data/lib/kahuna.rb +4 -0
- data/lib/kahuna/event.rb +14 -0
- data/lib/kahuna/handler.rb +21 -0
- data/lib/kahuna/member.rb +18 -0
- data/lib/kahuna/member_collection.rb +48 -0
- data/lib/kahuna/version.rb +3 -0
- data/spec/event_spec.rb +80 -0
- data/spec/factories/member_factory.rb +8 -0
- data/spec/handler_spec.rb +33 -0
- data/spec/member_collection_spec.rb +88 -0
- data/spec/member_spec.rb +35 -0
- data/spec/spec_helper.rb +14 -0
- metadata +198 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c355732e13b809973f1ddc8d2bdb7403ca75fc1e
|
4
|
+
data.tar.gz: 24d1fdab1d19802706d18f0514b3950d2b8725d9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 67a22090953f3de8ab57c011e4758e9fc88c547c8e94d732192fb64f947eb6d8572f2134b2a98d05811ce966d645fc08083a5be3ed833add6c40727bf974ad10
|
7
|
+
data.tar.gz: 6087d68f1a831c4bf6391d34ef6a113231693b432d64bfc2dfd68a7c1b24cb2f229566d6a6f206cf68a8abc599ce60cb997fc3af5448f6a5a1759e8754fa93e1
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard :rspec do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
watch(%r{^spec/factories/(.+)\.rb$}) { "spec" }
|
9
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
10
|
+
end
|
11
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Brandon Dennis
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# Kahuna
|
2
|
+
|
3
|
+
A gem for handling [Serf](serfdom.io) events.
|
4
|
+
|
5
|
+
_(ka-hoo-na) Hawaiian tern for a man that surfs usually with a degree of skill.
|
6
|
+
[from rippinh2o.com](http://rippinh2o.com/dropzone/surflingo.shtml#k)_
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
gem 'kahuna'
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install kahuna
|
21
|
+
|
22
|
+
## Example Usage
|
23
|
+
|
24
|
+
Create a file named ```handler``` like the file below.
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
#!/usr/bin/env ruby
|
28
|
+
|
29
|
+
require 'kahuna'
|
30
|
+
|
31
|
+
data = ''
|
32
|
+
while line = Readline.readline('', true)
|
33
|
+
data += line
|
34
|
+
end
|
35
|
+
|
36
|
+
Kahuna::Handler.new(data) do |event, members|
|
37
|
+
# Code to execute in response to event
|
38
|
+
end.execute
|
39
|
+
|
40
|
+
exit 0
|
41
|
+
```
|
42
|
+
|
43
|
+
Make the file executable
|
44
|
+
|
45
|
+
```bash
|
46
|
+
$ chmod +x handler
|
47
|
+
```
|
48
|
+
|
49
|
+
Then pass the file to serf as a handler.
|
50
|
+
|
51
|
+
```bash
|
52
|
+
serf agent -event-handler ./handler
|
53
|
+
```
|
54
|
+
|
55
|
+
## Event and Members
|
56
|
+
|
57
|
+
[Kahuna::Handler](lib/kahuna/handler.rb) yields [Kahuna::Event](lib/kahuna/event.rb) and [Kahuna::MemberCollection](lib/kahuna/member_collection.rb) objects to the block passed to new. The Event object contains all the information about the event parsed from the data sent from Serf and the ENV vars set by Serf.
|
58
|
+
|
59
|
+
Serf _membership_ events contain information about the members that participated in the Serf event. This information is the payload for the Serf event, but for Serf _user_ events, the payload is arbitrary. In the case of user events, the current implementation yields ```nil``` for the members variable.
|
60
|
+
|
61
|
+
You can always get to the raw data sent from Serf through the event object, regardless of whether it is a user event or a membership event.
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
event.raw_data #=> "deploy all the things!"
|
65
|
+
```
|
66
|
+
|
67
|
+
## Contributing
|
68
|
+
|
69
|
+
1. Fork it
|
70
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
71
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
72
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
73
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/.gitkeep
ADDED
File without changes
|
data/kahuna.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'kahuna/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "kahuna"
|
8
|
+
spec.version = Kahuna::VERSION
|
9
|
+
spec.authors = ["Brandon Dennis"]
|
10
|
+
spec.email = ["toady00@gmail.com"]
|
11
|
+
spec.description = %q{Handlers for Serf "http://serfdom.io"}
|
12
|
+
spec.summary = %q{Kahuna provides some nice classes for handling events fired from Serf}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec", "~> 2.14"
|
24
|
+
spec.add_development_dependency "cucumber"
|
25
|
+
spec.add_development_dependency "aruba"
|
26
|
+
spec.add_development_dependency "guard"
|
27
|
+
spec.add_development_dependency "guard-rspec"
|
28
|
+
spec.add_development_dependency "pry"
|
29
|
+
spec.add_development_dependency "factory_girl", "~> 4.3.0"
|
30
|
+
end
|
data/lib/kahuna.rb
ADDED
data/lib/kahuna/event.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
module Kahuna
|
2
|
+
class Event
|
3
|
+
attr_reader :raw_data, :type, :name, :role, :user_event, :user_ltime
|
4
|
+
|
5
|
+
def initialize(data)
|
6
|
+
@raw_data = data
|
7
|
+
@type = ENV['SERF_EVENT']
|
8
|
+
@name = ENV['SERF_SELF_NAME']
|
9
|
+
@role = ENV['SERF_SELF_ROLE']
|
10
|
+
@user_event = ENV['SERF_USER_EVENT']
|
11
|
+
@user_ltime = ENV['SERF_USER_LTIME']
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'kahuna/event'
|
2
|
+
require 'kahuna/member_collection'
|
3
|
+
|
4
|
+
module Kahuna
|
5
|
+
class Handler
|
6
|
+
attr_reader :event, :members
|
7
|
+
|
8
|
+
def initialize(data, &block)
|
9
|
+
@event = Event.new data
|
10
|
+
unless event.type == 'user'
|
11
|
+
@members = MemberCollection.new data
|
12
|
+
end
|
13
|
+
@action = block_given? ? block : ->(event, members) {}
|
14
|
+
end
|
15
|
+
|
16
|
+
def execute &block
|
17
|
+
block_to_call = block_given? ? block : @action
|
18
|
+
block_to_call.call(event, members)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
3
|
+
module Kahuna
|
4
|
+
class Member
|
5
|
+
attr_reader :name, :address, :role, :raw_data
|
6
|
+
REGEX = /^([\w\.\-]+)\s+([\w\.\-]+)(?:\s+([\w\.\-]+))?$/
|
7
|
+
|
8
|
+
def initialize(data)
|
9
|
+
@raw_data = data
|
10
|
+
@name, @address, @role = process_data
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
def process_data
|
15
|
+
@raw_data.match(REGEX).captures
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'kahuna/member'
|
2
|
+
|
3
|
+
module Kahuna
|
4
|
+
class MemberCollection
|
5
|
+
include Enumerable
|
6
|
+
|
7
|
+
EVENTS = %w(member-join member-leave member-failed)
|
8
|
+
|
9
|
+
attr_reader :raw_data
|
10
|
+
|
11
|
+
def initialize(data)
|
12
|
+
@raw_data = data
|
13
|
+
members_from_data raw_data
|
14
|
+
end
|
15
|
+
|
16
|
+
def each(&block)
|
17
|
+
members.each do |member|
|
18
|
+
block.call member
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def empty?
|
23
|
+
length == 0
|
24
|
+
end
|
25
|
+
|
26
|
+
def length
|
27
|
+
members.length
|
28
|
+
end
|
29
|
+
|
30
|
+
define_method("<<") do |member|
|
31
|
+
raise "Not a kind of Kahuna::Member" unless member.kind_of? Member
|
32
|
+
members << member
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
def members
|
37
|
+
@members ||= []
|
38
|
+
end
|
39
|
+
|
40
|
+
def members_from_data(raw_data)
|
41
|
+
member_data = raw_data.split("\n").map { |data| data.strip }
|
42
|
+
member_data.each do |data|
|
43
|
+
member = Member.new data
|
44
|
+
self << member
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/spec/event_spec.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'kahuna/event'
|
2
|
+
|
3
|
+
describe Kahuna::Event do
|
4
|
+
env_map = {
|
5
|
+
type: 'SERF_EVENT',
|
6
|
+
name: 'SERF_SELF_NAME',
|
7
|
+
role: 'SERF_SELF_ROLE',
|
8
|
+
user_event: 'SERF_USER_EVENT',
|
9
|
+
user_ltime: 'SERF_USER_LTIME'
|
10
|
+
}
|
11
|
+
|
12
|
+
let(:data) { "Some Data" }
|
13
|
+
let(:event) { Kahuna::Event.new data }
|
14
|
+
|
15
|
+
subject { event }
|
16
|
+
|
17
|
+
it { should respond_to :raw_data }
|
18
|
+
it { should respond_to :type }
|
19
|
+
it { should respond_to :name }
|
20
|
+
it { should respond_to :role }
|
21
|
+
it { should respond_to :user_event }
|
22
|
+
it { should respond_to :user_ltime }
|
23
|
+
|
24
|
+
describe "membership events" do
|
25
|
+
let(:name) { "brandon.local" }
|
26
|
+
let(:address) { "127.0.0.1" }
|
27
|
+
let(:role) { "web" }
|
28
|
+
let(:data) { "#{name} #{address} #{role}" }
|
29
|
+
|
30
|
+
before(:each) do
|
31
|
+
ENV['SERF_EVENT'] = "member-join"
|
32
|
+
ENV['SERF_SELF_NAME'] = name
|
33
|
+
ENV['SERF_SELF_ROLE'] = role
|
34
|
+
ENV.delete 'SERF_USER_EVENT'
|
35
|
+
ENV.delete 'SERF_USER_LTIME'
|
36
|
+
@event = Kahuna::Event.new data
|
37
|
+
end
|
38
|
+
|
39
|
+
# TODO: Pull out into shared context
|
40
|
+
env_map.each do |attribute, env_var_name|
|
41
|
+
it "should set #{attribute} from ENV[#{env_var_name}" do
|
42
|
+
expect(@event.send attribute).to eq(ENV[env_var_name])
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'does not set user_event' do
|
47
|
+
@event.user_event.should be_nil
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'does not set the user_ltime' do
|
51
|
+
@event.user_ltime.should be_nil
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe 'user event' do
|
56
|
+
let(:data) { "Kahuna Test Payload" }
|
57
|
+
|
58
|
+
before(:each) do
|
59
|
+
ENV['SERF_EVENT'] = "user"
|
60
|
+
ENV['SERF_USER_EVENT'] = "kahuna_test"
|
61
|
+
ENV['SERF_USER_LTIME'] = Time.now.utc.to_s
|
62
|
+
@event = Kahuna::Event.new data
|
63
|
+
end
|
64
|
+
|
65
|
+
# TODO: Pull out into shared context
|
66
|
+
env_map.each do |attribute, env_var_name|
|
67
|
+
it "should set #{attribute} from ENV[#{env_var_name}" do
|
68
|
+
expect(@event.send attribute).to eq(ENV[env_var_name])
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'does set the user_event' do
|
73
|
+
@event.user_event.should eq(ENV['SERF_USER_EVENT'])
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'does set the user_ltime' do
|
77
|
+
@event.user_ltime.should eq(ENV['SERF_USER_LTIME'])
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :member, :class => Kahuna::Member do
|
3
|
+
role { %w(web lb ns db es proxy).sample }
|
4
|
+
sequence(:name) { |n| "#{role}#{n}.example.com" }
|
5
|
+
sequence(:address) { |n| "10.10.10.#{n}" }
|
6
|
+
initialize_with { new("#{name} #{address} #{role}")}
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'kahuna/handler'
|
2
|
+
|
3
|
+
describe Kahuna::Handler do
|
4
|
+
|
5
|
+
describe 'instance' do
|
6
|
+
let(:name) { "brandon.local" }
|
7
|
+
let(:address) { "127.0.0.1" }
|
8
|
+
let(:role) { "web" }
|
9
|
+
let(:data) { "#{name} #{address} #{role}" }
|
10
|
+
let(:handler) { Kahuna::Handler.new data }
|
11
|
+
|
12
|
+
subject { handler }
|
13
|
+
|
14
|
+
it { should respond_to :event }
|
15
|
+
it { should respond_to :members }
|
16
|
+
it { should respond_to :execute }
|
17
|
+
|
18
|
+
describe '#execute' do
|
19
|
+
let(:block) { ->(event, members) { true } }
|
20
|
+
|
21
|
+
it 'calls the action' do
|
22
|
+
Proc.any_instance.should_receive(:call).with(handler.event, handler.members)
|
23
|
+
handler.execute
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'allows arbitary blocks to be passed in' do
|
27
|
+
handler = Kahuna::Handler.new data, &block
|
28
|
+
Proc.any_instance.should_receive(:call).with(handler.event, handler.members)
|
29
|
+
handler.execute
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'kahuna/member_collection'
|
2
|
+
require 'kahuna/member'
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Kahuna::MemberCollection do
|
6
|
+
subject { Kahuna::MemberCollection }
|
7
|
+
it { should include(Enumerable) }
|
8
|
+
|
9
|
+
describe 'instance' do
|
10
|
+
let(:member_data) { "brandon.local 127.0.0.1 web" }
|
11
|
+
let(:member) { build :member }
|
12
|
+
let(:member2) { build :member }
|
13
|
+
let(:member3) { build :member }
|
14
|
+
let(:data) { '' }
|
15
|
+
let(:mcollection) { Kahuna::MemberCollection.new data }
|
16
|
+
|
17
|
+
subject { mcollection }
|
18
|
+
|
19
|
+
it { should respond_to :raw_data }
|
20
|
+
it { should respond_to :empty? }
|
21
|
+
|
22
|
+
describe '#new' do
|
23
|
+
let(:data) {
|
24
|
+
<<-EOL
|
25
|
+
#{member.raw_data}
|
26
|
+
#{member2.raw_data}
|
27
|
+
#{member3.raw_data}
|
28
|
+
EOL
|
29
|
+
}
|
30
|
+
|
31
|
+
it 'creates members from data' do
|
32
|
+
mcollection.length.should eq 3
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe '#each' do
|
37
|
+
|
38
|
+
it 'yields each member if members are present' do
|
39
|
+
[member, member2, member3].each { |m| mcollection << m }
|
40
|
+
expect { |b| mcollection.each(&b) } .to yield_successive_args(member, member2, member3)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'does not yield if no members are present' do
|
44
|
+
expect { |b| mcollection.each(&b) } .not_to yield_control
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '#length' do
|
49
|
+
it 'should return 0 if there are no members' do
|
50
|
+
mcollection.length.should eq 0
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should return the correct number of members in the collection' do
|
54
|
+
1.upto(10) do |n|
|
55
|
+
mcollection << member
|
56
|
+
mcollection.length.should eq n
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '#empty?' do
|
62
|
+
it 'returns true if there are no members' do
|
63
|
+
mcollection.should be_empty
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'returns false if these are members in the collection' do
|
67
|
+
mcollection << member
|
68
|
+
mcollection.should_not be_empty
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "#<<" do
|
73
|
+
|
74
|
+
before :each do
|
75
|
+
mcollection << member
|
76
|
+
end
|
77
|
+
|
78
|
+
it "adds a new member to the collection" do
|
79
|
+
mcollection.to_a.should eq [member]
|
80
|
+
end
|
81
|
+
|
82
|
+
# this is a member collection after all
|
83
|
+
it "throws an exception if arguement is not a kind of Member" do
|
84
|
+
expect {mcollection << ''} .to raise_error RuntimeError
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
data/spec/member_spec.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'kahuna/member'
|
2
|
+
|
3
|
+
describe Kahuna::Member do
|
4
|
+
let(:name) { "brandon.local" }
|
5
|
+
let(:address) { "127.0.0.1" }
|
6
|
+
let(:role) { "web" }
|
7
|
+
let(:data) { "#{name} #{address} #{role}" }
|
8
|
+
let(:member) { Kahuna::Member.new data }
|
9
|
+
|
10
|
+
subject { member }
|
11
|
+
|
12
|
+
it { should respond_to :name }
|
13
|
+
it { should respond_to :address }
|
14
|
+
it { should respond_to :role }
|
15
|
+
it { should respond_to :raw_data }
|
16
|
+
|
17
|
+
it 'should assign the correct values' do
|
18
|
+
member.name.should eq(name)
|
19
|
+
member.address.should eq(address)
|
20
|
+
member.role.should eq(role)
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'data without role information' do
|
24
|
+
let(:data) { "#{name} #{address}"}
|
25
|
+
|
26
|
+
it 'does not assign a role' do
|
27
|
+
member.role.should be_nil
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'still assigns the name and address' do
|
31
|
+
member.name.should eq(name)
|
32
|
+
member.address.should eq(address)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
GEM_ROOT = File.expand_path("../../", __FILE__)
|
2
|
+
$:.unshift File.join(GEM_ROOT, "lib")
|
3
|
+
|
4
|
+
require 'rspec'
|
5
|
+
require 'factory_girl'
|
6
|
+
require 'kahuna'
|
7
|
+
|
8
|
+
Dir[File.join(GEM_ROOT, "spec", "support", "**/*.rb")].each { |f| require f }
|
9
|
+
Dir[File.join(GEM_ROOT, "spec/factories/**/*.rb")].each {|f| require f}
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.order = "random"
|
13
|
+
config.include FactoryGirl::Syntax::Methods
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,198 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kahuna
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brandon Dennis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
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: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.14'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.14'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: cucumber
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
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: aruba
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard-rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pry
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: factory_girl
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ~>
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 4.3.0
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ~>
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 4.3.0
|
139
|
+
description: Handlers for Serf "http://serfdom.io"
|
140
|
+
email:
|
141
|
+
- toady00@gmail.com
|
142
|
+
executables:
|
143
|
+
- .gitkeep
|
144
|
+
extensions: []
|
145
|
+
extra_rdoc_files: []
|
146
|
+
files:
|
147
|
+
- .gitignore
|
148
|
+
- .travis.yml
|
149
|
+
- Gemfile
|
150
|
+
- Guardfile
|
151
|
+
- LICENSE.txt
|
152
|
+
- README.md
|
153
|
+
- Rakefile
|
154
|
+
- bin/.gitkeep
|
155
|
+
- kahuna.gemspec
|
156
|
+
- lib/kahuna.rb
|
157
|
+
- lib/kahuna/event.rb
|
158
|
+
- lib/kahuna/handler.rb
|
159
|
+
- lib/kahuna/member.rb
|
160
|
+
- lib/kahuna/member_collection.rb
|
161
|
+
- lib/kahuna/version.rb
|
162
|
+
- spec/event_spec.rb
|
163
|
+
- spec/factories/member_factory.rb
|
164
|
+
- spec/handler_spec.rb
|
165
|
+
- spec/member_collection_spec.rb
|
166
|
+
- spec/member_spec.rb
|
167
|
+
- spec/spec_helper.rb
|
168
|
+
homepage: ''
|
169
|
+
licenses:
|
170
|
+
- MIT
|
171
|
+
metadata: {}
|
172
|
+
post_install_message:
|
173
|
+
rdoc_options: []
|
174
|
+
require_paths:
|
175
|
+
- lib
|
176
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - '>='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - '>='
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '0'
|
186
|
+
requirements: []
|
187
|
+
rubyforge_project:
|
188
|
+
rubygems_version: 2.1.11
|
189
|
+
signing_key:
|
190
|
+
specification_version: 4
|
191
|
+
summary: Kahuna provides some nice classes for handling events fired from Serf
|
192
|
+
test_files:
|
193
|
+
- spec/event_spec.rb
|
194
|
+
- spec/factories/member_factory.rb
|
195
|
+
- spec/handler_spec.rb
|
196
|
+
- spec/member_collection_spec.rb
|
197
|
+
- spec/member_spec.rb
|
198
|
+
- spec/spec_helper.rb
|