gvarela-bluepill 0.0.27 → 0.0.28
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/bluepill +0 -1
- data/lib/bluepill.rb +12 -3
- data/lib/bluepill/process.rb +1 -3
- data/lib/example.rb +3 -2
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.28
|
data/bin/bluepill
CHANGED
data/lib/bluepill.rb
CHANGED
@@ -1,18 +1,27 @@
|
|
1
|
-
|
1
|
+
require 'rubygems'
|
2
2
|
require 'thread'
|
3
3
|
require 'monitor'
|
4
4
|
require 'syslog'
|
5
5
|
require 'timeout'
|
6
6
|
require 'logger'
|
7
7
|
|
8
|
+
require "state_machine"
|
9
|
+
require "state_machine/machine"
|
10
|
+
#suck it state_machine
|
11
|
+
Class.class_eval do
|
12
|
+
def state_machine(*args, &block)
|
13
|
+
StateMachine::Machine.find_or_create(self, *args, &block)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
require "daemons"
|
18
|
+
|
8
19
|
require 'active_support/inflector'
|
9
20
|
require 'active_support/core_ext/hash'
|
10
21
|
require 'active_support/core_ext/numeric'
|
11
22
|
require 'active_support/core_ext/object/misc'
|
12
23
|
require 'active_support/duration'
|
13
24
|
|
14
|
-
require 'state_machine'
|
15
|
-
|
16
25
|
require 'bluepill/application'
|
17
26
|
require 'bluepill/controller'
|
18
27
|
require 'bluepill/socket'
|
data/lib/bluepill/process.rb
CHANGED
data/lib/example.rb
CHANGED
@@ -3,6 +3,7 @@ require 'bluepill'
|
|
3
3
|
require 'logger'
|
4
4
|
|
5
5
|
ROOT_DIR = "/tmp/bp"
|
6
|
+
user = ENV['USER']
|
6
7
|
|
7
8
|
# Watch with
|
8
9
|
# watch -n0.2 'ps axu | egrep "(CPU|forking|bluepill|sleep)" | grep -v grep | sort'
|
@@ -14,7 +15,7 @@ Bluepill.application(:sample_app) do |app|
|
|
14
15
|
# I could not figure out a portable way to
|
15
16
|
# specify the path to the sample forking server across the diff developer laptops.
|
16
17
|
# Since this code is eval'ed we cannot reliably use __FILE__
|
17
|
-
process.start_command = "/Users/
|
18
|
+
process.start_command = "/Users/#{user}/work/gems/bluepill/bin/sample_forking_server #{4242 + i}"
|
18
19
|
process.stop_command = "kill -INT {{PID}}"
|
19
20
|
process.daemonize = true
|
20
21
|
|
@@ -22,7 +23,7 @@ Bluepill.application(:sample_app) do |app|
|
|
22
23
|
process.restart_grace_time = 7.seconds
|
23
24
|
process.stop_grace_time = 7.seconds
|
24
25
|
|
25
|
-
process.uid =
|
26
|
+
process.uid = user
|
26
27
|
process.gid = "staff"
|
27
28
|
|
28
29
|
# process.checks :cpu_usage, :every => 10, :below => 0.5, :times => [5, 5]
|