lifeboat 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +18 -0
- data/Gemfile.lock +38 -0
- data/LICENSE.txt +20 -0
- data/README.md +109 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/config/aws.yml +3 -0
- data/config/database.yml +4 -0
- data/lib/lifeboat.rb +51 -0
- data/lifeboat.gemspec +73 -0
- data/spec/lifeboat_spec.rb +121 -0
- data/support/lifeboat.png +0 -0
- metadata +187 -0
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
#
|
9
|
+
gem 'right_aws', '1.10.0'
|
10
|
+
gem 'activerecord', '2.1.2'
|
11
|
+
|
12
|
+
group :development do
|
13
|
+
gem "rspec", "2.5.0"
|
14
|
+
gem "shoulda", ">= 0"
|
15
|
+
gem "bundler", "~> 1.0.0"
|
16
|
+
gem "jeweler", "~> 1.5.2"
|
17
|
+
gem "rcov", ">= 0"
|
18
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activerecord (2.1.2)
|
5
|
+
activesupport (= 2.1.2)
|
6
|
+
activesupport (2.1.2)
|
7
|
+
diff-lcs (1.1.2)
|
8
|
+
git (1.2.5)
|
9
|
+
jeweler (1.5.2)
|
10
|
+
bundler (~> 1.0.0)
|
11
|
+
git (>= 1.2.5)
|
12
|
+
rake
|
13
|
+
rake (0.8.7)
|
14
|
+
rcov (0.9.9)
|
15
|
+
right_aws (1.10.0)
|
16
|
+
right_http_connection (>= 1.2.4)
|
17
|
+
right_http_connection (1.3.0)
|
18
|
+
rspec (2.5.0)
|
19
|
+
rspec-core (~> 2.5.0)
|
20
|
+
rspec-expectations (~> 2.5.0)
|
21
|
+
rspec-mocks (~> 2.5.0)
|
22
|
+
rspec-core (2.5.1)
|
23
|
+
rspec-expectations (2.5.0)
|
24
|
+
diff-lcs (~> 1.1.2)
|
25
|
+
rspec-mocks (2.5.0)
|
26
|
+
shoulda (2.11.3)
|
27
|
+
|
28
|
+
PLATFORMS
|
29
|
+
ruby
|
30
|
+
|
31
|
+
DEPENDENCIES
|
32
|
+
activerecord (= 2.1.2)
|
33
|
+
bundler (~> 1.0.0)
|
34
|
+
jeweler (~> 1.5.2)
|
35
|
+
rcov
|
36
|
+
right_aws (= 1.10.0)
|
37
|
+
rspec (= 2.5.0)
|
38
|
+
shoulda
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Ivan Acosta-Rubio
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
Lifeboat
|
2
|
+
========
|
3
|
+
|
4
|
+
![LifeBoat](https://github.com/ivanacostarubio/lifeboat/raw/master/support/lifeboat.png)
|
5
|
+
|
6
|
+
Lifeboat is a drop in module for any Ruby Object that responds to 3 callbacks.
|
7
|
+
|
8
|
+
It monitors your models for create, update and delete events.
|
9
|
+
|
10
|
+
It sends a serialized copy of the model attributes to Amazon SQS when those events happen.
|
11
|
+
|
12
|
+
The serialized records are JSON.
|
13
|
+
|
14
|
+
|
15
|
+
WHY
|
16
|
+
---
|
17
|
+
|
18
|
+
If you're operating a web service and you're smart, then you make frequent
|
19
|
+
backups. But if you're operating a popular web service then no backup will
|
20
|
+
ever be fresh enough when you have a failure. A lot of people learned that
|
21
|
+
lesson the hard way during the Great Amazon EBS Meltdown of 2011. How do
|
22
|
+
you recover data that was created after your most-recent backup, but before
|
23
|
+
your database crashed? One way to do that is with database replication.
|
24
|
+
But not everybody has that option. Another way to do it is to send your data
|
25
|
+
to the lifeboats as soon as it's created, so that you can recover it after
|
26
|
+
a disaster.
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
Requirements
|
31
|
+
------------
|
32
|
+
* Amazon SQS
|
33
|
+
* right_aws gem
|
34
|
+
|
35
|
+
Installation
|
36
|
+
------------
|
37
|
+
|
38
|
+
Include the gem in your Gemfile:
|
39
|
+
|
40
|
+
gem "lifeboat"
|
41
|
+
|
42
|
+
Quick Start
|
43
|
+
-----------
|
44
|
+
|
45
|
+
class AnyObject < ActiveRecord::Base
|
46
|
+
include LifeBoat
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
** We will then automatically create queue messages each time any instance of the model class is created, updated, or deleted. **
|
51
|
+
|
52
|
+
How did we named the queues
|
53
|
+
---------------------------
|
54
|
+
|
55
|
+
** ction_model **
|
56
|
+
|
57
|
+
** Where: ** action can be: create, update and delete
|
58
|
+
** Where: ** model can be the name of any model we include lifeboat on.
|
59
|
+
|
60
|
+
|
61
|
+
ASSUMPTIONS
|
62
|
+
-----------
|
63
|
+
|
64
|
+
We Asume you have a file called aws.yml under you config directory with the aws key and secret
|
65
|
+
|
66
|
+
test:
|
67
|
+
:key 'you_key'
|
68
|
+
:secret 'your_secret'
|
69
|
+
|
70
|
+
|
71
|
+
Hot-Swap Slaves
|
72
|
+
---------------
|
73
|
+
|
74
|
+
The real purpose of data replication is to maintain hot-swappable backup servers. When your
|
75
|
+
production server goes down you can failover to one of your backups. If you're worried about
|
76
|
+
your entire cloud-based data center going down suddenly for days at a time (it happens!) then
|
77
|
+
you can run a hot-swap slave in a different data center, and periodically monitor the message
|
78
|
+
queues generated by Lifeboat in your production, using the Lifeboat rake task:
|
79
|
+
|
80
|
+
rake lifeboat:update
|
81
|
+
|
82
|
+
Lifeboat is configured exactly the same for the master and for the slaves, so you can use
|
83
|
+
the exact same code base in both locations. Lifeboat's update Rake task is idempotent,
|
84
|
+
so you can run it as frequently as you like. And Lifeboat slaves do not destroy records
|
85
|
+
from the message queues, so you can run as many different slave nodes as you like.
|
86
|
+
|
87
|
+
Contributing
|
88
|
+
------------
|
89
|
+
|
90
|
+
If you'd like to contribute a feature or bugfix: Thanks! To make sure your
|
91
|
+
fix/feature has a high chance of being included, please read the following
|
92
|
+
guidelines:
|
93
|
+
|
94
|
+
1. Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
95
|
+
2. Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
96
|
+
3. Fork the project
|
97
|
+
4. Start a feature/bugfix branch
|
98
|
+
5. Commit and push until you are happy with your contribution
|
99
|
+
6. Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
100
|
+
7. Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
101
|
+
|
102
|
+
Credits
|
103
|
+
-------
|
104
|
+
|
105
|
+
Buit by Ivan.
|
106
|
+
|
107
|
+
Designed by Ivan & Ryan.
|
108
|
+
|
109
|
+
Inspired by Amazon. (And not in a good way.)
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'rake'
|
11
|
+
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
+
gem.name = "lifeboat"
|
16
|
+
gem.homepage = "http://github.com/ivanacostarubio/lifeboat"
|
17
|
+
gem.license = "MIT"
|
18
|
+
gem.summary = %Q{sends messages to SQS}
|
19
|
+
gem.description = %Q{ }
|
20
|
+
gem.email = "ivan@bakedweb.net"
|
21
|
+
gem.authors = ["Ivan Acosta-Rubio"]
|
22
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
|
+
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
25
|
+
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
require 'rake/testtask'
|
30
|
+
Rake::TestTask.new(:test) do |test|
|
31
|
+
test.libs << 'lib' << 'test'
|
32
|
+
test.pattern = 'test/**/test_*.rb'
|
33
|
+
test.verbose = true
|
34
|
+
end
|
35
|
+
|
36
|
+
require 'rcov/rcovtask'
|
37
|
+
Rcov::RcovTask.new do |test|
|
38
|
+
test.libs << 'test'
|
39
|
+
test.pattern = 'test/**/test_*.rb'
|
40
|
+
test.verbose = true
|
41
|
+
end
|
42
|
+
|
43
|
+
task :default => :test
|
44
|
+
|
45
|
+
require 'rake/rdoctask'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
|
+
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = "lifeboat #{version}"
|
51
|
+
rdoc.rdoc_files.include('README*')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/config/aws.yml
ADDED
data/config/database.yml
ADDED
data/lib/lifeboat.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'right_aws'
|
3
|
+
require 'active_record'
|
4
|
+
require 'yaml'
|
5
|
+
|
6
|
+
|
7
|
+
class Credentials
|
8
|
+
def initialize
|
9
|
+
# TRIED USING THE INITIALIZE FOR THOSE YAML LOADING DOWN THERE
|
10
|
+
# BUT IT WAS GIVING ME CRAP AND HAD TO DUPLICATE THE LINE
|
11
|
+
# MY GUEST IS THAT IT IS B/C THEY ARE CLASS METHODS
|
12
|
+
# TODO: RESEARCH HOW TO REFACTOR OUT
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.key
|
16
|
+
Rails.root['test']['key']
|
17
|
+
end
|
18
|
+
def self.secret
|
19
|
+
Rails.root['test']['secret']
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
module LifeBoat
|
25
|
+
def self.included(base)
|
26
|
+
raise "Object Lacks Proper Callbacks" unless base.respond_to? :after_create
|
27
|
+
base.class_eval do
|
28
|
+
after_create :create_lifeboat
|
29
|
+
after_destroy :destroy_lifeboat
|
30
|
+
after_update :update_lifeboat
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.read_queue(name)
|
35
|
+
#TODO EXTRAT OUT THE @CUE INTO HIGHER LEVEL
|
36
|
+
@cue = RightAws::SqsGen2.new(Credentials.key, Credentials.secret)
|
37
|
+
return @cue.queue(name).receive_messages
|
38
|
+
end
|
39
|
+
|
40
|
+
def after_initialize
|
41
|
+
@cue = RightAws::SqsGen2.new(Credentials.key, Credentials.secret)
|
42
|
+
end
|
43
|
+
|
44
|
+
[:create, :update, :destroy ].each do |action|
|
45
|
+
define_method(action.to_s + "_lifeboat") do
|
46
|
+
q = RightAws::SqsGen2::Queue.create(@cue, action.to_s+"_"+ self.class.to_s.downcase, true)
|
47
|
+
q.send_message(self.attributes.to_json)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
data/lifeboat.gemspec
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{lifeboat}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Ivan Acosta-Rubio"]
|
12
|
+
s.date = %q{2011-04-27}
|
13
|
+
s.description = %q{ }
|
14
|
+
s.email = %q{ivan@bakedweb.net}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.md",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"config/aws.yml",
|
28
|
+
"config/database.yml",
|
29
|
+
"lib/lifeboat.rb",
|
30
|
+
"lifeboat.gemspec",
|
31
|
+
"spec/lifeboat_spec.rb",
|
32
|
+
"support/lifeboat.png"
|
33
|
+
]
|
34
|
+
s.homepage = %q{http://github.com/ivanacostarubio/lifeboat}
|
35
|
+
s.licenses = ["MIT"]
|
36
|
+
s.require_paths = ["lib"]
|
37
|
+
s.rubygems_version = %q{1.4.2}
|
38
|
+
s.summary = %q{sends messages to SQS}
|
39
|
+
s.test_files = [
|
40
|
+
"spec/lifeboat_spec.rb"
|
41
|
+
]
|
42
|
+
|
43
|
+
if s.respond_to? :specification_version then
|
44
|
+
s.specification_version = 3
|
45
|
+
|
46
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
47
|
+
s.add_runtime_dependency(%q<right_aws>, ["= 1.10.0"])
|
48
|
+
s.add_runtime_dependency(%q<activerecord>, ["= 2.1.2"])
|
49
|
+
s.add_development_dependency(%q<rspec>, ["= 2.5.0"])
|
50
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
51
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
52
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
53
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
54
|
+
else
|
55
|
+
s.add_dependency(%q<right_aws>, ["= 1.10.0"])
|
56
|
+
s.add_dependency(%q<activerecord>, ["= 2.1.2"])
|
57
|
+
s.add_dependency(%q<rspec>, ["= 2.5.0"])
|
58
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
59
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
60
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
61
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
62
|
+
end
|
63
|
+
else
|
64
|
+
s.add_dependency(%q<right_aws>, ["= 1.10.0"])
|
65
|
+
s.add_dependency(%q<activerecord>, ["= 2.1.2"])
|
66
|
+
s.add_dependency(%q<rspec>, ["= 2.5.0"])
|
67
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
68
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
69
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
70
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
@@ -0,0 +1,121 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rspec'
|
3
|
+
require 'lifeboat'
|
4
|
+
|
5
|
+
config = YAML::load(IO.read(File.dirname(__FILE__) + '/../config/database.yml'))
|
6
|
+
|
7
|
+
ActiveRecord::Base.logger =
|
8
|
+
ActiveSupport::BufferedLogger.new(File.dirname(__FILE__) + "/debug.log")
|
9
|
+
|
10
|
+
ActiveRecord::Base.establish_connection(config['test'])
|
11
|
+
|
12
|
+
def rebuild_model options = {}
|
13
|
+
ActiveRecord::Base.connection.create_table :fake_models, :force => true do |table|
|
14
|
+
table.column :name, :string
|
15
|
+
table.column :phone, :string
|
16
|
+
table.column :email, :string
|
17
|
+
end
|
18
|
+
ActiveRecord::Base.connection.create_table :fakes, :force => true do |table|
|
19
|
+
table.column :name, :string
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
rebuild_model
|
24
|
+
|
25
|
+
class FakeModel < ActiveRecord::Base
|
26
|
+
attr_accessor :name, :email, :phone
|
27
|
+
include LifeBoat
|
28
|
+
end
|
29
|
+
|
30
|
+
class Fake < ActiveRecord::Base
|
31
|
+
attr_accessor :name
|
32
|
+
include LifeBoat
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
class Helper
|
37
|
+
def self.clean_all_queues
|
38
|
+
@sqs = RightAws::SqsGen2.new(Credentials.key,Credentials.secret)
|
39
|
+
@sqs.queues.each do |queue|
|
40
|
+
@sqs.queue(queue.name.to_s).clear
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class Rails
|
46
|
+
def self.root
|
47
|
+
@credentials = YAML::load(IO.read(File.dirname(__FILE__) + '/../config/aws.yml'))
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
describe "An simple object " do
|
53
|
+
it "raises for not having callbacks" do
|
54
|
+
lambda{ class BadModel ; include LifeBoat ; end }.should raise_error
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe FakeModel, " We hook into callbacks to send the messages" do
|
59
|
+
|
60
|
+
it "does not raise when included in object with proper callbacks" do
|
61
|
+
lambda{ class FakeModel < ActiveRecord::Base ; include LifeBoat; end }.should_not raise_error
|
62
|
+
end
|
63
|
+
it "Fake Model responds to :after_create" do
|
64
|
+
after_create = FakeModel.respond_to? :after_create
|
65
|
+
after_create.should == true
|
66
|
+
end
|
67
|
+
|
68
|
+
it "Fake Model responds to :after_update" do
|
69
|
+
after_update = FakeModel.respond_to? :after_update
|
70
|
+
after_update.should == true
|
71
|
+
end
|
72
|
+
|
73
|
+
it "Fake Model Responds to :after_destroy" do
|
74
|
+
after_destroy = FakeModel.respond_to? :after_destroy
|
75
|
+
after_destroy.should == true
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe LifeBoat , " AWS Credentials"do
|
80
|
+
before(:each) do
|
81
|
+
Helper.clean_all_queues
|
82
|
+
end
|
83
|
+
|
84
|
+
it "Read the credentials from config/aws.yml" do
|
85
|
+
pending
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe LifeBoat do
|
90
|
+
|
91
|
+
after(:each) do
|
92
|
+
Helper.clean_all_queues
|
93
|
+
end
|
94
|
+
|
95
|
+
it "reads messages from a cue" do
|
96
|
+
Fake.create(:name => "ivan")
|
97
|
+
messages = LifeBoat.read_queue("create_fake")
|
98
|
+
messages.size.should == 1
|
99
|
+
end
|
100
|
+
|
101
|
+
it "the message it creates contains the attributes ob the object as json" do
|
102
|
+
f = Fake.create(:name => "ivan")
|
103
|
+
q = LifeBoat.read_queue("create_fake")
|
104
|
+
q[0].body.should == f.attributes.to_json
|
105
|
+
end
|
106
|
+
|
107
|
+
it "deletes SQS queue when parent is deleted" do
|
108
|
+
f = Fake.create(:name => "updated")
|
109
|
+
f.destroy
|
110
|
+
messages = LifeBoat.read_queue("destroy_fake")
|
111
|
+
messages.size.should == 1
|
112
|
+
end
|
113
|
+
|
114
|
+
it "updates SQS queue when parent is updated" do
|
115
|
+
f = Fake.create(:name => "Er Update")
|
116
|
+
f.name= "28347834" ; f.save
|
117
|
+
messages= LifeBoat.read_queue("update_fake")
|
118
|
+
messages.size.should == 1
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,187 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lifeboat
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Ivan Acosta-Rubio
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-04-27 00:00:00 -05:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
type: :runtime
|
23
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - "="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 63
|
29
|
+
segments:
|
30
|
+
- 1
|
31
|
+
- 10
|
32
|
+
- 0
|
33
|
+
version: 1.10.0
|
34
|
+
requirement: *id001
|
35
|
+
prerelease: false
|
36
|
+
name: right_aws
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
type: :runtime
|
39
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - "="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 15
|
45
|
+
segments:
|
46
|
+
- 2
|
47
|
+
- 1
|
48
|
+
- 2
|
49
|
+
version: 2.1.2
|
50
|
+
requirement: *id002
|
51
|
+
prerelease: false
|
52
|
+
name: activerecord
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
type: :development
|
55
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - "="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 27
|
61
|
+
segments:
|
62
|
+
- 2
|
63
|
+
- 5
|
64
|
+
- 0
|
65
|
+
version: 2.5.0
|
66
|
+
requirement: *id003
|
67
|
+
prerelease: false
|
68
|
+
name: rspec
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
type: :development
|
71
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 3
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
version: "0"
|
80
|
+
requirement: *id004
|
81
|
+
prerelease: false
|
82
|
+
name: shoulda
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
type: :development
|
85
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ~>
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
hash: 23
|
91
|
+
segments:
|
92
|
+
- 1
|
93
|
+
- 0
|
94
|
+
- 0
|
95
|
+
version: 1.0.0
|
96
|
+
requirement: *id005
|
97
|
+
prerelease: false
|
98
|
+
name: bundler
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
type: :development
|
101
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
103
|
+
requirements:
|
104
|
+
- - ~>
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
hash: 7
|
107
|
+
segments:
|
108
|
+
- 1
|
109
|
+
- 5
|
110
|
+
- 2
|
111
|
+
version: 1.5.2
|
112
|
+
requirement: *id006
|
113
|
+
prerelease: false
|
114
|
+
name: jeweler
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
type: :development
|
117
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
hash: 3
|
123
|
+
segments:
|
124
|
+
- 0
|
125
|
+
version: "0"
|
126
|
+
requirement: *id007
|
127
|
+
prerelease: false
|
128
|
+
name: rcov
|
129
|
+
description: " "
|
130
|
+
email: ivan@bakedweb.net
|
131
|
+
executables: []
|
132
|
+
|
133
|
+
extensions: []
|
134
|
+
|
135
|
+
extra_rdoc_files:
|
136
|
+
- LICENSE.txt
|
137
|
+
- README.md
|
138
|
+
files:
|
139
|
+
- .document
|
140
|
+
- Gemfile
|
141
|
+
- Gemfile.lock
|
142
|
+
- LICENSE.txt
|
143
|
+
- README.md
|
144
|
+
- Rakefile
|
145
|
+
- VERSION
|
146
|
+
- config/aws.yml
|
147
|
+
- config/database.yml
|
148
|
+
- lib/lifeboat.rb
|
149
|
+
- lifeboat.gemspec
|
150
|
+
- spec/lifeboat_spec.rb
|
151
|
+
- support/lifeboat.png
|
152
|
+
has_rdoc: true
|
153
|
+
homepage: http://github.com/ivanacostarubio/lifeboat
|
154
|
+
licenses:
|
155
|
+
- MIT
|
156
|
+
post_install_message:
|
157
|
+
rdoc_options: []
|
158
|
+
|
159
|
+
require_paths:
|
160
|
+
- lib
|
161
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
162
|
+
none: false
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
hash: 3
|
167
|
+
segments:
|
168
|
+
- 0
|
169
|
+
version: "0"
|
170
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
|
+
none: false
|
172
|
+
requirements:
|
173
|
+
- - ">="
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
hash: 3
|
176
|
+
segments:
|
177
|
+
- 0
|
178
|
+
version: "0"
|
179
|
+
requirements: []
|
180
|
+
|
181
|
+
rubyforge_project:
|
182
|
+
rubygems_version: 1.4.2
|
183
|
+
signing_key:
|
184
|
+
specification_version: 3
|
185
|
+
summary: sends messages to SQS
|
186
|
+
test_files:
|
187
|
+
- spec/lifeboat_spec.rb
|