job_boss 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Brian Underwood
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/bin/job_boss CHANGED
@@ -15,6 +15,8 @@ daemons_options = {
15
15
  Daemons.run_proc('job_boss', daemons_options) do
16
16
  Dir.chdir(working_dir)
17
17
 
18
+ require 'config/environment' if File.exist?('config/environment.rb')
19
+
18
20
  $: << File.expand_path('../../lib', __FILE__)
19
21
  require 'job_boss/boss'
20
22
 
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'job_boss'
data/job_boss.gemspec CHANGED
@@ -4,7 +4,7 @@ $:.unshift lib unless $:.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "job_boss"
7
- s.version = '0.4.2'
7
+ s.version = '0.4.3'
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Brian Underwood"]
10
10
  s.email = ["ml+job_boss@semi-sentient.com"]
data/lib/job_boss/boss.rb CHANGED
@@ -146,6 +146,7 @@ private
146
146
 
147
147
  config = YAML.load(File.read(@@config.database_yaml_path))
148
148
 
149
+ ActiveRecord::Base.remove_connection
149
150
  ActiveRecord::Base.establish_connection(config[@@config.environment])
150
151
  end
151
152
 
data/lib/job_boss/job.rb CHANGED
@@ -17,6 +17,7 @@ module JobBoss
17
17
  Boss.logger.info "Dispatching Job ##{self.id}"
18
18
 
19
19
  pid = fork do
20
+ ActiveRecord::Base.connection.reconnect!
20
21
  $0 = "[job_boss] employee (job ##{self.id})"
21
22
  Process.setpriority(Process::PRIO_PROCESS, 0, 19)
22
23
 
@@ -38,8 +39,8 @@ module JobBoss
38
39
  Kernel.exit
39
40
  end
40
41
  end
41
-
42
42
  Process.detach(pid)
43
+ ActiveRecord::Base.connection.reconnect!
43
44
  end
44
45
 
45
46
  # Store result as first and only value of an array so that the value always gets serialized
data/lib/job_boss.rb ADDED
@@ -0,0 +1,7 @@
1
+ require 'job_boss/job'
2
+ require 'job_boss/boss'
3
+
4
+ module JobBoss
5
+ autoload :Boss, 'job_boss/boss'
6
+ autoload :Job, 'job_boss/job'
7
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: job_boss
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 2
10
- version: 0.4.2
9
+ - 3
10
+ version: 0.4.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brian Underwood
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-02 00:00:00 -05:00
18
+ date: 2010-12-03 00:00:00 -05:00
19
19
  default_executable: job_boss
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -71,6 +71,7 @@ extra_rdoc_files: []
71
71
 
72
72
  files:
73
73
  - Gemfile
74
+ - MIT-LICENSE
74
75
  - README.markdown
75
76
  - Rakefile
76
77
  - bin/job_boss
@@ -103,7 +104,9 @@ files:
103
104
  - doc/test/test_helper_rb.html
104
105
  - doc/test/unit/daemon_test_rb.html
105
106
  - doc/test/unit/job_test_rb.html
107
+ - init.rb
106
108
  - job_boss.gemspec
109
+ - lib/job_boss.rb
107
110
  - lib/job_boss/boss.rb
108
111
  - lib/job_boss/capistrano.rb
109
112
  - lib/job_boss/config.rb