Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f7eec061d | ||
|
|
27e53eb916 | ||
|
|
b123e6b3c5 | ||
|
|
c2000484bb |
+1
-1
@@ -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
@@ -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
@@ -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|
|
||||||
|
|||||||
Reference in New Issue
Block a user