jobby 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/jobby +1 -1
- data/lib/runner.rb +9 -1
- data/lib/server.rb +1 -1
- data/spec/server_spec.rb +1 -1
- metadata +2 -2
data/bin/jobby
CHANGED
data/lib/runner.rb
CHANGED
@@ -32,6 +32,14 @@ module Jobby
|
|
32
32
|
message "--input not supplied, reading from STDIN (use ctrl-d to end input)"
|
33
33
|
@options[:input] = $stdin.read
|
34
34
|
end
|
35
|
+
create_prerun_proc
|
36
|
+
end
|
37
|
+
|
38
|
+
# Makes a Proc that loads the given filepath, passing in the logger object.
|
39
|
+
def create_prerun_proc
|
40
|
+
if @options[:prerun]
|
41
|
+
@options[:prerun_proc] = Proc.new { |logger| load File.expand_path(@options[:prerun]) }
|
42
|
+
end
|
35
43
|
end
|
36
44
|
|
37
45
|
# Tries to connect a client to the server. If there isn't a server detected on
|
@@ -66,7 +74,7 @@ module Jobby
|
|
66
74
|
exit if @options[:flush] or @options[:wipe]
|
67
75
|
fork do
|
68
76
|
begin
|
69
|
-
Jobby::Server.new(@options[:socket], @options[:max_child_processes], @options[:log], @options[:
|
77
|
+
Jobby::Server.new(@options[:socket], @options[:max_child_processes], @options[:log], @options[:prerun_proc]).run(&get_proc_from_options)
|
70
78
|
rescue Exception => exception
|
71
79
|
return error(exception.message)
|
72
80
|
end
|
data/lib/server.rb
CHANGED
data/spec/server_spec.rb
CHANGED
@@ -179,7 +179,7 @@ describe Jobby::Server do
|
|
179
179
|
|
180
180
|
it "should be able to run a Ruby file before any forking" do
|
181
181
|
terminate_server
|
182
|
-
run_server(@socket, 1, @log_filepath, "spec/file_for_prerunning.rb") do
|
182
|
+
run_server(@socket, 1, @log_filepath, Proc.new { |logger| load "spec/file_for_prerunning.rb" }) do
|
183
183
|
sleep 2
|
184
184
|
if defined?(Preran)
|
185
185
|
File.open(@child_filepath, "a+") do |file|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jobby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Somerville
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-07-
|
12
|
+
date: 2008-07-09 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|