gorgon 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gorgon (0.4.1)
4
+ gorgon (0.4.3)
5
5
  amqp (~> 0.9.7)
6
6
  awesome_print
7
7
  bunny (~> 0.8.0)
@@ -14,12 +14,12 @@ PATH
14
14
  GEM
15
15
  remote: http://rubygems.org/
16
16
  specs:
17
- amq-client (0.9.5)
18
- amq-protocol (>= 0.9.4)
17
+ amq-client (0.9.11)
18
+ amq-protocol (>= 1.0.1)
19
19
  eventmachine
20
- amq-protocol (0.9.5)
21
- amqp (0.9.7)
22
- amq-client (~> 0.9.4)
20
+ amq-protocol (1.1.0)
21
+ amqp (0.9.8)
22
+ amq-client (~> 0.9.5)
23
23
  amq-protocol (>= 0.9.4)
24
24
  eventmachine
25
25
  awesome_print (1.1.0)
@@ -37,7 +37,7 @@ GEM
37
37
  rspec-expectations (2.11.3)
38
38
  diff-lcs (~> 1.1.3)
39
39
  rspec-mocks (2.11.3)
40
- ruby-progressbar (1.0.1)
40
+ ruby-progressbar (1.0.2)
41
41
  test-unit (2.5.2)
42
42
  uuidtools (2.1.3)
43
43
  yajl-ruby (1.1.0)
data/README.md CHANGED
@@ -23,7 +23,7 @@ remote_test: &remote_test
23
23
  min_messages: warning
24
24
  ```
25
25
 
26
- Where `<<: *defaults` are the default values used in _database.yml_, like for example, adapter, username, password, and host. Replace <my-app> with a name to identify this application's dbs
26
+ Where `<<: *defaults` are the default values used in _database.yml_, like for example, adapter, username, password, and host. Replace `<my-app>` with a name to identify this application's dbs
27
27
 
28
28
  Installing listener as a Daemon process (Ubuntu 9.10 or later)
29
29
  ----------------------------------------------------------------
@@ -40,6 +40,7 @@ Also note that these steps are **not** meant to work on every project, they will
40
40
  * gorgon.json
41
41
  * test/gorgon_callbacks/after\_sync.rb
42
42
  * test/gorgon_callbacks/before\_creating\_workers.rb
43
+ * test/gorgon_callbacks/after\_creating\_workers.rb
43
44
  * test/gorgon_callbacks/before\_start.rb
44
45
  * test/gorgon_callbacks/after\_complete.rb
45
46
  * ~/.gorgon/gorgon_listener.json
@@ -94,4 +95,4 @@ Gorgon is maintained by:
94
95
  * Victor Savkin
95
96
 
96
97
  Gorgon is funded by [Nulogy Corp](http://www.nulogy.com/).
97
- Thank you to all the [contributors](/Fitzsimmons/Gorgon/graphs/contributors).
98
+ Thank you to all the [contributors](/Fitzsimmons/Gorgon/graphs/contributors).
@@ -18,4 +18,8 @@ class CallbackHandler
18
18
  def after_sync
19
19
  load(@config[:after_sync]) if @config[:after_sync]
20
20
  end
21
+
22
+ def after_creating_workers
23
+ load(@config[:after_creating_workers]) if @config[:after_creating_workers]
24
+ end
21
25
  end
@@ -18,6 +18,8 @@ module Settings
18
18
  content: after_sync_content},
19
19
  {name: :before_creating_workers, file_name: "before_creating_workers.rb",
20
20
  content: before_creating_workers_content},
21
+ {name: :after_creating_workers, file_name: "after_creating_workers.rb",
22
+ content: after_creating_workers_content},
21
23
  {name: :before_start, file_name: "before_start.rb",
22
24
  content: before_start_content},
23
25
  {name: :after_complete, file_name: "after_complete.rb",
@@ -56,10 +58,23 @@ CONTENT
56
58
  end
57
59
 
58
60
  def before_creating_workers_content
59
- content = ""
60
- content << "require './test/test_helper'\n" if File.exist?("test/test_helper.rb")
61
- content << "require './spec/spec_helper'\n" if File.exist?("spec/spec_helper.rb")
62
- content
61
+ <<-CONTENT
62
+ ENV["TEST_ENV_NUMBER"] = Process.pid.to_s
63
+ ENV["RAILS_ENV"] = 'remote_test'
64
+
65
+ pid, stdin, stdout, stderr = Open4::popen4 "TEST_ENV_NUMBER=#{Process.pid.to_s} RAILS_ENV='remote_test' bundle exec rake db:setup"
66
+ ignore, status = Process.waitpid2 pid
67
+
68
+ if status.exitstatus != 0
69
+ raise "ERROR: 'rake db:setup' failed.\n#{stderr.read}\n#{stdout.read}"
70
+ end
71
+
72
+ require File.expand_path('../../test_helper', __FILE__)
73
+ CONTENT
74
+ end
75
+
76
+ def after_creating_workers_content
77
+ after_complete_content
63
78
  end
64
79
 
65
80
  def before_start_content
@@ -1,3 +1,3 @@
1
1
  module Gorgon
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
@@ -77,6 +77,7 @@ class WorkerManager
77
77
 
78
78
  subscribe_to_originator_queue
79
79
  end
80
+ @callback_handler.after_creating_workers
80
81
  end
81
82
 
82
83
  def fork_a_worker
@@ -7,7 +7,8 @@ describe CallbackHandler do
7
7
  :before_start => "some/file.rb",
8
8
  :after_complete => "some/other/file.rb",
9
9
  :before_creating_workers => "callbacks/before_creating_workers_file.rb",
10
- :after_sync => "callbacks/after_sync_file.rb"
10
+ :after_sync => "callbacks/after_sync_file.rb",
11
+ :after_creating_workers => "callbacks/after_creating_workers.rb"
11
12
  }
12
13
  }
13
14
 
@@ -74,4 +75,20 @@ describe CallbackHandler do
74
75
 
75
76
  handler.after_sync
76
77
  end
78
+
79
+ it "calls the after creating workers hook" do
80
+ handler = CallbackHandler.new(config)
81
+
82
+ handler.should_receive(:load).with("callbacks/after_creating_workers.rb")
83
+
84
+ handler.after_creating_workers
85
+ end
86
+
87
+ it "does not attempt to load the after creating workers hook when after_creating_workers is not defined" do
88
+ handler = CallbackHandler.new({})
89
+
90
+ handler.should_not_receive(:load)
91
+
92
+ handler.after_creating_workers
93
+ end
77
94
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gorgon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2012-12-31 00:00:00.000000000 Z
16
+ date: 2013-02-08 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: rake
@@ -281,12 +281,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
281
281
  - - ! '>='
282
282
  - !ruby/object:Gem::Version
283
283
  version: '0'
284
+ segments:
285
+ - 0
286
+ hash: 266955656043169930
284
287
  required_rubygems_version: !ruby/object:Gem::Requirement
285
288
  none: false
286
289
  requirements:
287
290
  - - ! '>='
288
291
  - !ruby/object:Gem::Version
289
292
  version: '0'
293
+ segments:
294
+ - 0
295
+ hash: 266955656043169930
290
296
  requirements: []
291
297
  rubyforge_project: gorgon
292
298
  rubygems_version: 1.8.24