Compare commits

...
4 Commits
Author SHA1 Message Date
David Dollar 0f7eec061d Regenerated gemspec for version 0.3.2 2010-06-22 17:20:21 -04:00
David Dollar 27e53eb916 0.3.2 2010-06-22 17:20:15 -04:00
David Dollar b123e6b3c5 change the output format 2010-06-22 17:20:01 -04:00
David Dollar c2000484bb capture PTY::ChildExited 2010-06-22 17:19:47 -04:00
3 changed files with 24 additions and 6 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = %q{foreman} s.name = %q{foreman}
s.version = "0.3.1" s.version = "0.3.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["David Dollar"] s.authors = ["David Dollar"]
+1 -1
View File
@@ -1,6 +1,6 @@
module Foreman module Foreman
VERSION = "0.3.1" VERSION = "0.3.2"
class AppDoesNotExist < Exception; end class AppDoesNotExist < Exception; end
+22 -4
View File
@@ -77,10 +77,14 @@ private ######################################################################
FileUtils.mkdir_p "log" FileUtils.mkdir_p "log"
command = process.command command = process.command
PTY.spawn("#{process.command} 2>&1") do |stdin, stdout, pid| begin
until stdin.eof? PTY.spawn("#{process.command} 2>&1") do |stdin, stdout, pid|
info stdin.gets, process until stdin.eof?
info stdin.gets, process
end
end end
rescue PTY::ChildExited
# exited
end end
end end
end end
@@ -96,11 +100,25 @@ private ######################################################################
def info(message, process=nil) def info(message, process=nil)
print process.color if process print process.color if process
print "[#{Time.now.strftime("%H:%M:%S")}] [#{process ? process.name : "system"}] #{message.chomp}" print "#{Time.now.strftime("%H:%M:%S")} #{pad_process_name(process)} | "
print Term::ANSIColor.reset print Term::ANSIColor.reset
print message.chomp
puts puts
end end
def longest_process_name
@longest_process_name ||= begin
longest = processes.keys.map { |name| name.length }.sort.last
longest = 6 if longest < 6 # system
longest
end
end
def pad_process_name(process)
name = process ? process.name : "system"
name.ljust(longest_process_name)
end
def print_info def print_info
info "currently running processes:" info "currently running processes:"
running_processes.each do |pid, process| running_processes.each do |pid, process|