lifeboat 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +11 -2
- data/VERSION +1 -1
- data/lib/lifeboat.rb +2 -1
- data/lifeboat.gemspec +2 -2
- data/spec/lifeboat_spec.rb +12 -5
- metadata +4 -4
data/README.md
CHANGED
@@ -50,9 +50,18 @@ Include Lifeboat in your model class:
|
|
50
50
|
|
51
51
|
Provide your AWS credentials in config/aws.yml
|
52
52
|
|
53
|
-
access_key_id: YOURSECRETACCESSID
|
54
|
-
secret_access_key: YOUR-secRE/TACCe\ssKEy
|
55
53
|
|
54
|
+
test:
|
55
|
+
key: ......
|
56
|
+
secret: .......
|
57
|
+
|
58
|
+
development:
|
59
|
+
key: ........
|
60
|
+
secret: .......
|
61
|
+
|
62
|
+
production:
|
63
|
+
key: .......
|
64
|
+
secret: ......
|
56
65
|
|
57
66
|
** We will then automatically create queue messages each time any instance of the model class is created, updated, or deleted. **
|
58
67
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
data/lib/lifeboat.rb
CHANGED
@@ -67,7 +67,8 @@ module LifeBoat
|
|
67
67
|
[:create, :update, :destroy ].each do |action|
|
68
68
|
define_method(action.to_s + "_lifeboat") do
|
69
69
|
begin
|
70
|
-
|
70
|
+
queue_name = action.to_s+"_"+ self.class.to_s.downcase + "_" + RAILS_ENV
|
71
|
+
q = RightAws::SqsGen2::Queue.create(@cue, queue_name, true)
|
71
72
|
q.send_message(self.attributes.to_json)
|
72
73
|
rescue RightAws::AwsError => e
|
73
74
|
puts "LifeBoat RightAws::AwsError TIMEOUT"
|
data/lifeboat.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{lifeboat}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ivan Acosta-Rubio"]
|
12
|
-
s.date = %q{2011-05-
|
12
|
+
s.date = %q{2011-05-05}
|
13
13
|
s.description = %q{ }
|
14
14
|
s.email = %q{ivan@bakedweb.net}
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/lifeboat_spec.rb
CHANGED
@@ -10,6 +10,8 @@ ActiveRecord::Base.logger =
|
|
10
10
|
ActiveRecord::Base.establish_connection(config['test'])
|
11
11
|
|
12
12
|
def rebuild_model options = {}
|
13
|
+
# ActiveRecord::Base.connection.create_database('lifeboat_test')
|
14
|
+
|
13
15
|
ActiveRecord::Base.connection.create_table :fake_models, :force => true do |table|
|
14
16
|
table.column :name, :string
|
15
17
|
table.column :phone, :string
|
@@ -32,6 +34,7 @@ class Fake < ActiveRecord::Base
|
|
32
34
|
include LifeBoat
|
33
35
|
end
|
34
36
|
|
37
|
+
RAILS_ENV = "test"
|
35
38
|
|
36
39
|
class Helper
|
37
40
|
def self.clean_all_queues
|
@@ -44,7 +47,11 @@ end
|
|
44
47
|
|
45
48
|
class Rails
|
46
49
|
def self.root
|
47
|
-
|
50
|
+
Dir.pwd
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.version
|
54
|
+
'2.1.2'
|
48
55
|
end
|
49
56
|
end
|
50
57
|
|
@@ -93,27 +100,27 @@ describe LifeBoat do
|
|
93
100
|
|
94
101
|
it "reads messages from a cue" do
|
95
102
|
Fake.create(:name => "ivan")
|
96
|
-
messages = LifeBoat.read_queue("
|
103
|
+
messages = LifeBoat.read_queue("create_fake_test")
|
97
104
|
messages.size.should == 1
|
98
105
|
end
|
99
106
|
|
100
107
|
it "the message it creates contains the attributes ob the object as json" do
|
101
108
|
f = Fake.create(:name => "ivan")
|
102
|
-
q = LifeBoat.read_queue("
|
109
|
+
q = LifeBoat.read_queue("create_fake_test")
|
103
110
|
q[0].body.should == f.attributes.to_json
|
104
111
|
end
|
105
112
|
|
106
113
|
it "deletes SQS queue when parent is deleted" do
|
107
114
|
f = Fake.create(:name => "updated")
|
108
115
|
f.destroy
|
109
|
-
messages = LifeBoat.read_queue("
|
116
|
+
messages = LifeBoat.read_queue("destroy_fake_test")
|
110
117
|
messages.size.should == 1
|
111
118
|
end
|
112
119
|
|
113
120
|
it "updates SQS queue when parent is updated" do
|
114
121
|
f = Fake.create(:name => "Er Update")
|
115
122
|
f.name= "28347834" ; f.save
|
116
|
-
messages= LifeBoat.read_queue("
|
123
|
+
messages= LifeBoat.read_queue("update_fake_test")
|
117
124
|
messages.size.should == 1
|
118
125
|
end
|
119
126
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lifeboat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 4
|
10
|
+
version: 0.2.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ivan Acosta-Rubio
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-05-
|
18
|
+
date: 2011-05-05 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|