Compare commits

..

3 Commits

Author SHA1 Message Date
David Dollar
efb6d2f11d 0.50.0 2012-07-11 16:07:52 -04:00
David Dollar
ac528d3b50 update docs 2012-07-11 16:07:03 -04:00
David Dollar
cefd4e351e handle windows 2012-07-11 16:02:07 -04:00
8 changed files with 46 additions and 10 deletions

View File

@@ -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)
* Massive refactoring for programmatic control and stability [David Dollar]

View File

@@ -1,7 +1,7 @@
PATH
remote: .
specs:
foreman (0.49.0)
foreman (0.50.0)
thor (>= 0.13.6)
GEM

View File

@@ -99,7 +99,20 @@ class Foreman::Engine
# @param [String] signal The signal to send to each process
#
def killall(signal="SIGTERM")
Process.kill "-#{signal}", Process.pid
if Foreman.windows?
@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
Process.kill "-#{signal}", Process.pid
rescue Errno::ESRCH, Errno::EPERM
end
end
end
# Get the process formation
@@ -282,8 +295,13 @@ private
def terminate_gracefully
return if @terminating
@terminating = true
system "sending SIGTERM to all processes"
killall "SIGTERM"
if Foreman.windows?
system "sending SIGKILL to all processes"
killall "SIGKILL"
else
system "sending SIGTERM to all processes"
killall "SIGTERM"
end
Timeout.timeout(5) do
watch_for_termination while @running.length > 0
end

View File

@@ -31,6 +31,7 @@ class Foreman::Engine::CLI < Foreman::Engine
def color?
return true if @@color_force
return true if Foreman.windows?
return false unless self.respond_to?(:isatty)
self.isatty && ENV["TERM"]
end
@@ -49,11 +50,12 @@ class Foreman::Engine::CLI < Foreman::Engine
def startup
@colors = map_colors
proctitle "foreman: master"
require "win32console" if Foreman.windows?
Color.enable($stdout, options[:color]) unless $stdout.respond_to?(:color?)
end
def output(name, data)
data.to_s.chomp.split("\n").each do |message|
Color.enable($stdout, options[:color]) unless $stdout.respond_to?(:color?)
output = ""
output += $stdout.color(@colors[name.split(".").first].to_sym)
output += "#{Time.now.strftime("%H:%M:%S")} #{pad_process_name(name)} | "

View File

@@ -36,7 +36,11 @@ class Foreman::Process
if Foreman.windows?
Dir.chdir(cwd) do
Process.spawn env, command, :out => output, :err => output
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
elsif Foreman.jruby?
Dir.chdir(cwd) do
@@ -64,7 +68,11 @@ class Foreman::Process
# @param [String] signal The signal to send
#
def kill(signal)
pid && Process.kill("-#{signal}", pid)
if Foreman.windows?
pid && Process.kill(signal, pid)
else
pid && Process.kill("-#{signal}", pid)
end
rescue Errno::ESRCH
false
end

View File

@@ -1,5 +1,5 @@
module Foreman
VERSION = "0.49.0"
VERSION = "0.50.0"
end

View File

@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.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"
\fBforeman\fR \- manage Procfile\-based applications

View File

@@ -60,7 +60,6 @@ end
desc "Cut a release"
task :release do
Rake::Task["authors"].invoke
Rake::Task["changelog"].invoke
Rake::Task["pages"].invoke
end