lifeboat 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.6.0
data/lib/lifeboat.rb CHANGED
@@ -15,10 +15,10 @@ end
15
15
 
16
16
  class Credentials
17
17
  def initialize
18
- # TRIED USING THE INITIALIZE FOR THOSE YAML LOADING DOWN THERE
19
- # BUT IT WAS GIVING ME CRAP AND HAD TO DUPLICATE THE LINE
20
- # MY GUEST IS THAT IT IS B/C THEY ARE CLASS METHODS
21
- # TODO: RESEARCH HOW TO REFACTOR OUT
18
+ # TRIED USING THE INITIALIZE FOR THOSE YAML LOADING DOWN THERE
19
+ # BUT IT WAS GIVING ME CRAP AND HAD TO DUPLICATE THE LINE
20
+ # MY GUEST IS THAT IT IS B/C THEY ARE CLASS METHODS
21
+ # TODO: RESEARCH HOW TO REFACTOR OUT
22
22
  end
23
23
 
24
24
  begin
@@ -34,6 +34,17 @@ class Credentials
34
34
  end
35
35
 
36
36
 
37
+ class RescateLifeBoat
38
+
39
+ @queue = :lifeboats
40
+
41
+ def self.perform(action, klass, id)
42
+ record = klass.camelize.constantize.find(id)
43
+ record.send(action)
44
+ end
45
+ end
46
+
47
+
37
48
  module LifeBoat
38
49
 
39
50
  def self.read_queue(name)
@@ -42,12 +53,39 @@ module LifeBoat
42
53
  return @cue.queue(name).receive_messages
43
54
  end
44
55
 
56
+ module ResqueCallbacks
57
+ def create_resque_lifeboat
58
+ if RAILS_ENV == "testing"
59
+ self.create_lifeboat
60
+ else
61
+ Resque.enqueue(RescateLifeBoat, :create_lifeboat ,self.class.name, self.id)
62
+ end
63
+ end
64
+
65
+ def destroy_resque_lifeboat
66
+ if RAILS_ENV == "testing"
67
+ self.destroy_lifeboat
68
+ else
69
+ Resque.enqueue(RescateLifeBoat, :destroy_lifeboat, self.class.name, self.id)
70
+ end
71
+ end
72
+
73
+ def update_resque_lifeboat
74
+ if RAILS_ENV == "testing"
75
+ self.update_lifeboat
76
+ else
77
+ Resque.enqueue(RescateLifeBoat, :update_lifeboat ,self.class.name, self.id)
78
+ end
79
+ end
80
+ end
81
+
82
+
45
83
  module ActiveRecord
84
+
85
+
46
86
  def has_lifeboat(options={})
47
87
  include LifeBoat::Queues
48
88
 
49
-
50
-
51
89
  if options[:format] == :xml
52
90
  format = :to_xml
53
91
  else
@@ -74,9 +112,9 @@ module LifeBoat
74
112
  def self.included(base)
75
113
  raise "Object Lacks Proper Callbacks" unless base.respond_to? :after_create
76
114
  base.class_eval do
77
- after_create :create_lifeboat
78
- after_destroy :destroy_lifeboat
79
- after_update :update_lifeboat
115
+ after_create :create_resque_lifeboat
116
+ after_destroy :destroy_resque_lifeboat
117
+ after_update :update_resque_lifeboat
80
118
  end
81
119
  end
82
120
  end
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.5.0"
8
+ s.version = "0.6.0"
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-06-10}
12
+ s.date = %q{2011-11-15}
13
13
  s.description = %q{ }
14
14
  s.email = %q{ivan@bakedweb.net}
15
15
  s.extra_rdoc_files = [
@@ -35,16 +35,17 @@ Gem::Specification.new do |s|
35
35
  s.homepage = %q{http://github.com/ivanacostarubio/lifeboat}
36
36
  s.licenses = ["MIT"]
37
37
  s.require_paths = ["lib"]
38
- s.rubygems_version = %q{1.7.2}
38
+ s.rubygems_version = %q{1.3.6}
39
39
  s.summary = %q{sends messages to SQS}
40
40
  s.test_files = [
41
41
  "spec/lifeboat_spec.rb"
42
42
  ]
43
43
 
44
44
  if s.respond_to? :specification_version then
45
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
45
46
  s.specification_version = 3
46
47
 
47
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
48
49
  s.add_runtime_dependency(%q<right_aws>, [">= 1.10.0"])
49
50
  s.add_runtime_dependency(%q<activerecord>, [">= 2.1.2"])
50
51
  s.add_runtime_dependency(%q<mysql>, ["= 2.8.1"])
@@ -31,16 +31,19 @@ end
31
31
  rebuild_model
32
32
 
33
33
  class FakeModel < ActiveRecord::Base
34
+ include LifeBoat::ResqueCallbacks
34
35
  attr_accessor :name, :email, :phone
35
36
  has_lifeboat
36
37
  end
37
38
 
38
39
  class Fake < ActiveRecord::Base
40
+ include LifeBoat::ResqueCallbacks
39
41
  attr_accessor :name
40
42
  has_lifeboat
41
43
  end
42
44
 
43
45
  class XMLRecord < ActiveRecord::Base
46
+ include LifeBoat::ResqueCallbacks
44
47
  attr_accessor :name
45
48
  has_lifeboat :format => :xml
46
49
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lifeboat
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 0
8
- - 5
7
+ - 6
9
8
  - 0
10
- version: 0.5.0
9
+ version: 0.6.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Ivan Acosta-Rubio
@@ -15,146 +14,129 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-06-10 00:00:00 Z
17
+ date: 2011-11-15 00:00:00 -03:00
18
+ default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
+ type: :runtime
21
22
  version_requirements: &id001 !ruby/object:Gem::Requirement
22
- none: false
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- hash: 63
27
26
  segments:
28
27
  - 1
29
28
  - 10
30
29
  - 0
31
30
  version: 1.10.0
31
+ requirement: *id001
32
32
  name: right_aws
33
33
  prerelease: false
34
- type: :runtime
35
- requirement: *id001
36
34
  - !ruby/object:Gem::Dependency
35
+ type: :runtime
37
36
  version_requirements: &id002 !ruby/object:Gem::Requirement
38
- none: false
39
37
  requirements:
40
38
  - - ">="
41
39
  - !ruby/object:Gem::Version
42
- hash: 15
43
40
  segments:
44
41
  - 2
45
42
  - 1
46
43
  - 2
47
44
  version: 2.1.2
45
+ requirement: *id002
48
46
  name: activerecord
49
47
  prerelease: false
50
- type: :runtime
51
- requirement: *id002
52
48
  - !ruby/object:Gem::Dependency
49
+ type: :runtime
53
50
  version_requirements: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
51
  requirements:
56
52
  - - "="
57
53
  - !ruby/object:Gem::Version
58
- hash: 45
59
54
  segments:
60
55
  - 2
61
56
  - 8
62
57
  - 1
63
58
  version: 2.8.1
59
+ requirement: *id003
64
60
  name: mysql
65
61
  prerelease: false
66
- type: :runtime
67
- requirement: *id003
68
62
  - !ruby/object:Gem::Dependency
63
+ type: :development
69
64
  version_requirements: &id004 !ruby/object:Gem::Requirement
70
- none: false
71
65
  requirements:
72
66
  - - "="
73
67
  - !ruby/object:Gem::Version
74
- hash: 27
75
68
  segments:
76
69
  - 2
77
70
  - 5
78
71
  - 0
79
72
  version: 2.5.0
73
+ requirement: *id004
80
74
  name: rspec
81
75
  prerelease: false
82
- type: :development
83
- requirement: *id004
84
76
  - !ruby/object:Gem::Dependency
77
+ type: :development
85
78
  version_requirements: &id005 !ruby/object:Gem::Requirement
86
- none: false
87
79
  requirements:
88
80
  - - ">="
89
81
  - !ruby/object:Gem::Version
90
- hash: 3
91
82
  segments:
92
83
  - 0
93
84
  version: "0"
85
+ requirement: *id005
94
86
  name: shoulda
95
87
  prerelease: false
96
- type: :development
97
- requirement: *id005
98
88
  - !ruby/object:Gem::Dependency
89
+ type: :development
99
90
  version_requirements: &id006 !ruby/object:Gem::Requirement
100
- none: false
101
91
  requirements:
102
92
  - - ~>
103
93
  - !ruby/object:Gem::Version
104
- hash: 23
105
94
  segments:
106
95
  - 1
107
96
  - 0
108
97
  - 0
109
98
  version: 1.0.0
99
+ requirement: *id006
110
100
  name: bundler
111
101
  prerelease: false
112
- type: :development
113
- requirement: *id006
114
102
  - !ruby/object:Gem::Dependency
103
+ type: :development
115
104
  version_requirements: &id007 !ruby/object:Gem::Requirement
116
- none: false
117
105
  requirements:
118
106
  - - ~>
119
107
  - !ruby/object:Gem::Version
120
- hash: 7
121
108
  segments:
122
109
  - 1
123
110
  - 5
124
111
  - 2
125
112
  version: 1.5.2
113
+ requirement: *id007
126
114
  name: jeweler
127
115
  prerelease: false
128
- type: :development
129
- requirement: *id007
130
116
  - !ruby/object:Gem::Dependency
117
+ type: :development
131
118
  version_requirements: &id008 !ruby/object:Gem::Requirement
132
- none: false
133
119
  requirements:
134
120
  - - ">="
135
121
  - !ruby/object:Gem::Version
136
- hash: 3
137
122
  segments:
138
123
  - 0
139
124
  version: "0"
125
+ requirement: *id008
140
126
  name: rcov
141
127
  prerelease: false
142
- type: :development
143
- requirement: *id008
144
128
  - !ruby/object:Gem::Dependency
129
+ type: :development
145
130
  version_requirements: &id009 !ruby/object:Gem::Requirement
146
- none: false
147
131
  requirements:
148
132
  - - ">="
149
133
  - !ruby/object:Gem::Version
150
- hash: 3
151
134
  segments:
152
135
  - 0
153
136
  version: "0"
137
+ requirement: *id009
154
138
  name: autotest
155
139
  prerelease: false
156
- type: :development
157
- requirement: *id009
158
140
  description: " "
159
141
  email: ivan@bakedweb.net
160
142
  executables: []
@@ -179,6 +161,7 @@ files:
179
161
  - lifeboat.gemspec
180
162
  - spec/lifeboat_spec.rb
181
163
  - support/lifeboat.png
164
+ has_rdoc: true
182
165
  homepage: http://github.com/ivanacostarubio/lifeboat
183
166
  licenses:
184
167
  - MIT
@@ -188,27 +171,23 @@ rdoc_options: []
188
171
  require_paths:
189
172
  - lib
190
173
  required_ruby_version: !ruby/object:Gem::Requirement
191
- none: false
192
174
  requirements:
193
175
  - - ">="
194
176
  - !ruby/object:Gem::Version
195
- hash: 3
196
177
  segments:
197
178
  - 0
198
179
  version: "0"
199
180
  required_rubygems_version: !ruby/object:Gem::Requirement
200
- none: false
201
181
  requirements:
202
182
  - - ">="
203
183
  - !ruby/object:Gem::Version
204
- hash: 3
205
184
  segments:
206
185
  - 0
207
186
  version: "0"
208
187
  requirements: []
209
188
 
210
189
  rubyforge_project:
211
- rubygems_version: 1.7.2
190
+ rubygems_version: 1.3.6
212
191
  signing_key:
213
192
  specification_version: 3
214
193
  summary: sends messages to SQS