nimbu 0.13.0 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nimbu/command/server.rb +61 -20
- data/lib/nimbu/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcaf454345adbb424c6f94c09a304e98d8a3a76cf76ca2d9df76a9f991f867c1
|
4
|
+
data.tar.gz: 33ec694a0be3a929f9612629d43451389fee686a9789574356018da1ee536744
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe4bb037e2ea41168414108bb662618f942fb5d4507591bfe2c317725199772244434b1a5c2536f551e1d98c1fab0fa0bfb03870045f016a3e3014330805e3bb
|
7
|
+
data.tar.gz: a93d431f551918a465378f55b6a03e06389797bcfbad13dfedff952cc8679488707c6a19bcbb8126bf792810b63a0f7a18423ea7bf611815c297573a07e18ae7
|
data/lib/nimbu/command/server.rb
CHANGED
@@ -117,32 +117,42 @@ class Nimbu::Command::Server < Nimbu::Command::Base
|
|
117
117
|
}
|
118
118
|
server_options.merge!({:Host => options[:host]}) if options[:host]
|
119
119
|
Rack::Handler::Thin.run Nimbu::Server::Base, server_options do |server|
|
120
|
-
[:INT, :TERM].each
|
120
|
+
[:INT, :TERM].each do |sig|
|
121
|
+
trap(sig) do
|
122
|
+
server.respond_to?(:stop!) ? server.stop! : server.stop
|
123
|
+
exit(0)
|
124
|
+
end
|
125
|
+
end
|
121
126
|
end
|
122
127
|
end
|
123
128
|
|
124
129
|
haml_thread = Thread.new do
|
125
|
-
#
|
126
|
-
# compiler_read.close
|
130
|
+
Process.setproctitle("#{$0} => nimbu-toolbelt haml")
|
127
131
|
puts "Starting watcher..."
|
128
132
|
HamlWatcher.watch
|
129
133
|
end if @with_haml
|
130
134
|
|
131
|
-
if @with_compass
|
135
|
+
compass_pid = if @with_compass
|
136
|
+
Process.setproctitle("#{$0} => nimbu-toolbelt compass")
|
132
137
|
puts "Starting..."
|
133
138
|
cmd = "bundle exec nimbu server:compass"
|
134
|
-
|
139
|
+
Process.spawn(cmd, out: $stdout, err: [:child, :out])
|
135
140
|
end
|
136
141
|
|
137
142
|
server_thread.join
|
138
143
|
haml_thread.join if @with_haml
|
139
144
|
|
140
|
-
[:INT, :TERM].each do |sig|
|
145
|
+
[:HUP, :INT, :TERM].each do |sig|
|
141
146
|
trap(sig) do
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
147
|
+
should_wait = false
|
148
|
+
|
149
|
+
if compass_pid && running?(compass_pid)
|
150
|
+
should_wait = true
|
151
|
+
Process.kill('INT', compass_pid)
|
152
|
+
end
|
153
|
+
|
154
|
+
Process.waitall if should_wait
|
155
|
+
exit(0)
|
146
156
|
end
|
147
157
|
end
|
148
158
|
|
@@ -166,7 +176,14 @@ class Nimbu::Command::Server < Nimbu::Command::Base
|
|
166
176
|
}
|
167
177
|
server_options.merge!({:Host => options[:host]}) if options[:host]
|
168
178
|
Rack::Handler::Thin.run Nimbu::Server::Base, **server_options do |server|
|
169
|
-
|
179
|
+
Process.setproctitle("#{$0} => nimbu-toolbelt server")
|
180
|
+
|
181
|
+
[:INT, :TERM].each do |sig|
|
182
|
+
trap(sig) do
|
183
|
+
server.respond_to?(:stop!) ? server.stop! : server.stop
|
184
|
+
exit(0)
|
185
|
+
end
|
186
|
+
end
|
170
187
|
end
|
171
188
|
end
|
172
189
|
|
@@ -175,7 +192,8 @@ class Nimbu::Command::Server < Nimbu::Command::Base
|
|
175
192
|
haml_read.close
|
176
193
|
puts "Starting..."
|
177
194
|
haml_listener = HamlWatcher.watch
|
178
|
-
|
195
|
+
Process.setproctitle("#{$0} => nimbu-toolbelt haml")
|
196
|
+
[:HUP, :INT, :TERM].each do |sig|
|
179
197
|
Signal.trap(sig) do
|
180
198
|
puts green("== Stopping HAML watcher\n")
|
181
199
|
Thread.new { haml_listener.stop }
|
@@ -185,6 +203,7 @@ class Nimbu::Command::Server < Nimbu::Command::Base
|
|
185
203
|
end if @with_haml
|
186
204
|
|
187
205
|
compass_pid = Process.fork do
|
206
|
+
Process.setproctitle("#{$0} => nimbu-toolbelt compass")
|
188
207
|
$stdout.reopen(compass_write)
|
189
208
|
compass_read.close
|
190
209
|
puts "Starting..."
|
@@ -192,7 +211,10 @@ class Nimbu::Command::Server < Nimbu::Command::Base
|
|
192
211
|
end if @with_compass
|
193
212
|
|
194
213
|
watch_server_pid = Process.fork do
|
195
|
-
|
214
|
+
Process.setproctitle("#{$0} => nimbu-toolbelt server-watcher")
|
215
|
+
|
216
|
+
[:HUP, :INT, :TERM].each { |sig| trap(sig) { exit } }
|
217
|
+
|
196
218
|
server_write.close
|
197
219
|
server_read.each do |line|
|
198
220
|
print cyan("SERVER: ") + white(line) + ""
|
@@ -200,7 +222,9 @@ class Nimbu::Command::Server < Nimbu::Command::Base
|
|
200
222
|
end
|
201
223
|
|
202
224
|
watch_haml_pid = Process.fork do
|
203
|
-
|
225
|
+
Process.setproctitle("#{$0} => nimbu-toolbelt haml-watcher")
|
226
|
+
[:HUP, :INT, :TERM].each { |sig| trap(sig) { exit } }
|
227
|
+
|
204
228
|
haml_write.close
|
205
229
|
haml_read.each do |line|
|
206
230
|
print magenta("HAML: ") + white(line) + ""
|
@@ -208,22 +232,39 @@ class Nimbu::Command::Server < Nimbu::Command::Base
|
|
208
232
|
end if @with_haml
|
209
233
|
|
210
234
|
watch_compass_pid = Process.fork do
|
211
|
-
|
235
|
+
Process.setproctitle("#{$0} => nimbu-toolbelt haml-compass")
|
236
|
+
[:HUP, :INT, :TERM].each { |sig| trap(sig) { exit } }
|
237
|
+
|
212
238
|
compass_write.close
|
213
239
|
compass_read.each do |line|
|
214
240
|
print yellow("COMPASS: ") + white(line) + ""
|
215
241
|
end
|
216
242
|
end if @with_compass
|
217
243
|
|
218
|
-
[:INT, :TERM].each do |sig|
|
244
|
+
[:HUP, :INT, :TERM].each do |sig|
|
219
245
|
trap(sig) do
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
246
|
+
should_wait = false
|
247
|
+
@child_pids_running.each do |pid|
|
248
|
+
if running?(server_pid)
|
249
|
+
should_wait = true
|
250
|
+
Process.kill('INT', pid)
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
Process.waitall if should_wait
|
255
|
+
exit(0)
|
224
256
|
end
|
225
257
|
end
|
226
258
|
|
259
|
+
@child_pids_running = [
|
260
|
+
server_pid,
|
261
|
+
haml_pid,
|
262
|
+
compass_pid,
|
263
|
+
watch_server_pid,
|
264
|
+
watch_haml_pid,
|
265
|
+
watch_compass_pid
|
266
|
+
].compact!
|
267
|
+
|
227
268
|
Process.waitall
|
228
269
|
end
|
229
270
|
|
data/lib/nimbu/version.rb
CHANGED