foreman 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/foreman.rb +1 -1
- data/lib/foreman/engine.rb +22 -4
- metadata +3 -3
data/lib/foreman.rb
CHANGED
data/lib/foreman/engine.rb
CHANGED
@@ -77,10 +77,14 @@ private ######################################################################
|
|
77
77
|
FileUtils.mkdir_p "log"
|
78
78
|
command = process.command
|
79
79
|
|
80
|
-
|
81
|
-
|
82
|
-
|
80
|
+
begin
|
81
|
+
PTY.spawn("#{process.command} 2>&1") do |stdin, stdout, pid|
|
82
|
+
until stdin.eof?
|
83
|
+
info stdin.gets, process
|
84
|
+
end
|
83
85
|
end
|
86
|
+
rescue PTY::ChildExited
|
87
|
+
# exited
|
84
88
|
end
|
85
89
|
end
|
86
90
|
end
|
@@ -96,11 +100,25 @@ private ######################################################################
|
|
96
100
|
|
97
101
|
def info(message, process=nil)
|
98
102
|
print process.color if process
|
99
|
-
print "
|
103
|
+
print "#{Time.now.strftime("%H:%M:%S")} #{pad_process_name(process)} | "
|
100
104
|
print Term::ANSIColor.reset
|
105
|
+
print message.chomp
|
101
106
|
puts
|
102
107
|
end
|
103
108
|
|
109
|
+
def longest_process_name
|
110
|
+
@longest_process_name ||= begin
|
111
|
+
longest = processes.keys.map { |name| name.length }.sort.last
|
112
|
+
longest = 6 if longest < 6 # system
|
113
|
+
longest
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def pad_process_name(process)
|
118
|
+
name = process ? process.name : "system"
|
119
|
+
name.ljust(longest_process_name)
|
120
|
+
end
|
121
|
+
|
104
122
|
def print_info
|
105
123
|
info "currently running processes:"
|
106
124
|
running_processes.each do |pid, process|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- David Dollar
|