Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
efb6d2f11d | ||
|
|
ac528d3b50 | ||
|
|
cefd4e351e | ||
|
|
9849f4558a | ||
|
|
4b53b42be1 | ||
|
|
219acaf690 | ||
|
|
f8118d7b40 |
@@ -1,3 +1,12 @@
|
|||||||
|
## 0.48.0.pre2 (2012-06-17)
|
||||||
|
|
||||||
|
* 0.48.0.pre2 [David Dollar]
|
||||||
|
* allow color to be forced on [David Dollar]
|
||||||
|
* terminate gracefully if stdout goes away [David Dollar]
|
||||||
|
* always flush output [David Dollar]
|
||||||
|
* test on more things, but don't fail [David Dollar]
|
||||||
|
* changelog [David Dollar]
|
||||||
|
|
||||||
## 0.48.0.pre1 (2012-06-11)
|
## 0.48.0.pre1 (2012-06-11)
|
||||||
|
|
||||||
* Massive refactoring for programmatic control and stability [David Dollar]
|
* Massive refactoring for programmatic control and stability [David Dollar]
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
PATH
|
PATH
|
||||||
remote: .
|
remote: .
|
||||||
specs:
|
specs:
|
||||||
foreman (0.48.0)
|
foreman (0.50.0)
|
||||||
thor (>= 0.13.6)
|
thor (>= 0.13.6)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
@@ -39,7 +39,7 @@ GEM
|
|||||||
multi_json (~> 1.0.3)
|
multi_json (~> 1.0.3)
|
||||||
simplecov-html (~> 0.5.3)
|
simplecov-html (~> 0.5.3)
|
||||||
simplecov-html (0.5.3)
|
simplecov-html (0.5.3)
|
||||||
thor (0.15.3)
|
thor (0.15.4)
|
||||||
timecop (0.3.5)
|
timecop (0.3.5)
|
||||||
win32console (1.3.0-x86-mingw32)
|
win32console (1.3.0-x86-mingw32)
|
||||||
xml-simple (1.0.15)
|
xml-simple (1.0.15)
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ sigterm() {
|
|||||||
#trap sigterm SIGTERM
|
#trap sigterm SIGTERM
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
echo "$NAME: ping"
|
echo "$NAME: ping $$"
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ module Foreman
|
|||||||
defined?(RUBY_PLATFORM) and RUBY_PLATFORM == "java"
|
defined?(RUBY_PLATFORM) and RUBY_PLATFORM == "java"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.ruby_18?
|
||||||
|
defined?(RUBY_VERSION) and RUBY_VERSION =~ /^1\.8\.\d+/
|
||||||
|
end
|
||||||
|
|
||||||
def self.windows?
|
def self.windows?
|
||||||
defined?(RUBY_PLATFORM) and RUBY_PLATFORM =~ /(win|w)32$/
|
defined?(RUBY_PLATFORM) and RUBY_PLATFORM =~ /(win|w)32$/
|
||||||
end
|
end
|
||||||
|
|||||||
+18
-6
@@ -99,10 +99,17 @@ class Foreman::Engine
|
|||||||
# @param [String] signal The signal to send to each process
|
# @param [String] signal The signal to send to each process
|
||||||
#
|
#
|
||||||
def killall(signal="SIGTERM")
|
def killall(signal="SIGTERM")
|
||||||
@running.each do |pid, (process, index)|
|
if Foreman.windows?
|
||||||
system "sending #{signal} to #{name_for(pid)} at pid #{pid}"
|
@running.each do |pid, (process, index)|
|
||||||
|
system "sending #{signal} to #{name_for(pid)} at pid #{pid}"
|
||||||
|
begin
|
||||||
|
Process.kill(signal, pid)
|
||||||
|
rescue Errno::ESRCH, Errno::EPERM
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
begin
|
begin
|
||||||
Process.kill(signal, -1 * pid)
|
Process.kill "-#{signal}", Process.pid
|
||||||
rescue Errno::ESRCH, Errno::EPERM
|
rescue Errno::ESRCH, Errno::EPERM
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -266,7 +273,7 @@ private
|
|||||||
loop do
|
loop do
|
||||||
(IO.select(@readers.values).first || []).each do |reader|
|
(IO.select(@readers.values).first || []).each do |reader|
|
||||||
data = reader.gets
|
data = reader.gets
|
||||||
output_with_mutex name_for(@readers.key(reader)), data
|
output_with_mutex name_for(@readers.invert[reader]), data
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue Exception => ex
|
rescue Exception => ex
|
||||||
@@ -288,8 +295,13 @@ private
|
|||||||
def terminate_gracefully
|
def terminate_gracefully
|
||||||
return if @terminating
|
return if @terminating
|
||||||
@terminating = true
|
@terminating = true
|
||||||
system "sending SIGTERM to all processes"
|
if Foreman.windows?
|
||||||
killall "SIGTERM"
|
system "sending SIGKILL to all processes"
|
||||||
|
killall "SIGKILL"
|
||||||
|
else
|
||||||
|
system "sending SIGTERM to all processes"
|
||||||
|
killall "SIGTERM"
|
||||||
|
end
|
||||||
Timeout.timeout(5) do
|
Timeout.timeout(5) do
|
||||||
watch_for_termination while @running.length > 0
|
watch_for_termination while @running.length > 0
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class Foreman::Engine::CLI < Foreman::Engine
|
|||||||
|
|
||||||
def color?
|
def color?
|
||||||
return true if @@color_force
|
return true if @@color_force
|
||||||
|
return true if Foreman.windows?
|
||||||
return false unless self.respond_to?(:isatty)
|
return false unless self.respond_to?(:isatty)
|
||||||
self.isatty && ENV["TERM"]
|
self.isatty && ENV["TERM"]
|
||||||
end
|
end
|
||||||
@@ -49,11 +50,12 @@ class Foreman::Engine::CLI < Foreman::Engine
|
|||||||
def startup
|
def startup
|
||||||
@colors = map_colors
|
@colors = map_colors
|
||||||
proctitle "foreman: master"
|
proctitle "foreman: master"
|
||||||
|
require "win32console" if Foreman.windows?
|
||||||
|
Color.enable($stdout, options[:color]) unless $stdout.respond_to?(:color?)
|
||||||
end
|
end
|
||||||
|
|
||||||
def output(name, data)
|
def output(name, data)
|
||||||
data.to_s.chomp.split("\n").each do |message|
|
data.to_s.chomp.split("\n").each do |message|
|
||||||
Color.enable($stdout, options[:color]) unless $stdout.respond_to?(:color?)
|
|
||||||
output = ""
|
output = ""
|
||||||
output += $stdout.color(@colors[name.split(".").first].to_sym)
|
output += $stdout.color(@colors[name.split(".").first].to_sym)
|
||||||
output += "#{Time.now.strftime("%H:%M:%S")} #{pad_process_name(name)} | "
|
output += "#{Time.now.strftime("%H:%M:%S")} #{pad_process_name(name)} | "
|
||||||
|
|||||||
+21
-4
@@ -36,16 +36,29 @@ class Foreman::Process
|
|||||||
|
|
||||||
if Foreman.windows?
|
if Foreman.windows?
|
||||||
Dir.chdir(cwd) do
|
Dir.chdir(cwd) do
|
||||||
Process.spawn env, command, :out => output, :err => output, :new_pgroup => true
|
expanded_command = command.dup
|
||||||
|
env.each do |key, val|
|
||||||
|
expanded_command.gsub!("$#{key}", val)
|
||||||
|
end
|
||||||
|
Process.spawn env, expanded_command, :out => output, :err => output
|
||||||
end
|
end
|
||||||
elsif Foreman.jruby?
|
elsif Foreman.jruby?
|
||||||
Dir.chdir(cwd) do
|
Dir.chdir(cwd) do
|
||||||
require "posix/spawn"
|
require "posix/spawn"
|
||||||
POSIX::Spawn.spawn env, command, :out => output, :err => output, :pgroup => 0
|
POSIX::Spawn.spawn env, command, :out => output, :err => output
|
||||||
|
end
|
||||||
|
elsif Foreman.ruby_18?
|
||||||
|
Dir.chdir(cwd) do
|
||||||
|
fork do
|
||||||
|
$stdout.reopen output
|
||||||
|
$stderr.reopen output
|
||||||
|
env.each { |k,v| ENV[k] = v }
|
||||||
|
exec command
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Dir.chdir(cwd) do
|
Dir.chdir(cwd) do
|
||||||
Process.spawn env, command, :out => output, :err => output, :pgroup => 0
|
Process.spawn env, command, :out => output, :err => output
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -55,7 +68,11 @@ class Foreman::Process
|
|||||||
# @param [String] signal The signal to send
|
# @param [String] signal The signal to send
|
||||||
#
|
#
|
||||||
def kill(signal)
|
def kill(signal)
|
||||||
pid && Process.kill(signal, -1 * pid)
|
if Foreman.windows?
|
||||||
|
pid && Process.kill(signal, pid)
|
||||||
|
else
|
||||||
|
pid && Process.kill("-#{signal}", pid)
|
||||||
|
end
|
||||||
rescue Errno::ESRCH
|
rescue Errno::ESRCH
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
module Foreman
|
module Foreman
|
||||||
|
|
||||||
VERSION = "0.48.0"
|
VERSION = "0.50.0"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
.\" generated with Ronn/v0.7.3
|
.\" generated with Ronn/v0.7.3
|
||||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||||
.
|
.
|
||||||
.TH "FOREMAN" "1" "April 2012" "Foreman 0.46.0" "Foreman Manual"
|
.TH "FOREMAN" "1" "June 2012" "Foreman 0.49.0" "Foreman Manual"
|
||||||
.
|
.
|
||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
\fBforeman\fR \- manage Procfile\-based applications
|
\fBforeman\fR \- manage Procfile\-based applications
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ end
|
|||||||
|
|
||||||
desc "Cut a release"
|
desc "Cut a release"
|
||||||
task :release do
|
task :release do
|
||||||
Rake::Task["authors"].invoke
|
|
||||||
Rake::Task["changelog"].invoke
|
Rake::Task["changelog"].invoke
|
||||||
Rake::Task["pages"].invoke
|
Rake::Task["pages"].invoke
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user