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
+9
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) ## 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]
+1 -1
View File
@@ -1,7 +1,7 @@
PATH PATH
remote: . remote: .
specs: specs:
foreman (0.49.0) foreman (0.50.0)
thor (>= 0.13.6) thor (>= 0.13.6)
GEM GEM
+21 -3
View File
@@ -99,7 +99,20 @@ 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")
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 end
# Get the process formation # Get the process formation
@@ -282,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
+3 -1
View File
@@ -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)} | "
+10 -2
View File
@@ -36,7 +36,11 @@ 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 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
@@ -64,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}", 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 -1
View File
@@ -1,5 +1,5 @@
module Foreman module Foreman
VERSION = "0.49.0" VERSION = "0.50.0"
end end
+1 -1
View File
@@ -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
-1
View File
@@ -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