nimbu 0.13.0 → 0.13.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5ca8decb3bbcaff09111f825e17dfac4f94e3703f015568ec3923369ef46383
4
- data.tar.gz: 54270a24b7ae669ff6fb9e9d1d298b3b92ed022eace0d06f841fe2e0807974ad
3
+ metadata.gz: fcaf454345adbb424c6f94c09a304e98d8a3a76cf76ca2d9df76a9f991f867c1
4
+ data.tar.gz: 33ec694a0be3a929f9612629d43451389fee686a9789574356018da1ee536744
5
5
  SHA512:
6
- metadata.gz: b729ae9aa81917073c5fe296c31fcf8cbd4e97090360a81c4b307995078938a13f55692e4cf204f6362e23975bcc39e016c518698c8405bae10a115fccfb4107
7
- data.tar.gz: 7d396b10643c17110361d3799979e96154695af5688a0aeebce1e9472a2750b3acd3a7b03f497755f008211190826f5487ada963da1606b281b211989d8d6d32
6
+ metadata.gz: fe4bb037e2ea41168414108bb662618f942fb5d4507591bfe2c317725199772244434b1a5c2536f551e1d98c1fab0fa0bfb03870045f016a3e3014330805e3bb
7
+ data.tar.gz: a93d431f551918a465378f55b6a03e06389797bcfbad13dfedff952cc8679488707c6a19bcbb8126bf792810b63a0f7a18423ea7bf611815c297573a07e18ae7
@@ -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 { |sig| trap(sig) { server.respond_to?(:stop!) ? server.stop! : server.stop } }
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
- # $stdout.reopen(compiler_write)
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
- compass_pid = Process.spawn(cmd, out: $stdout, err: [:child, :out])
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
- puts yellow("\n== Waiting for all processes to finish...")
143
- Process.kill('INT', compass_pid) if compass_pid && running?(compass_pid)
144
- Process.waitall
145
- puts green("== Nimbu has ended its work " + bold("(crowd applauds!)\n"))
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
- [:INT, :TERM].each { |sig| trap(sig) { server.respond_to?(:stop!) ? server.stop! : server.stop } }
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
- [:INT, :TERM].each do |sig|
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
- trap('INT') { exit }
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
- trap('INT') { exit }
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
- trap('INT') { exit }
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
- puts yellow("\n== Waiting for all processes to finish...")
221
- Process.kill('INT', haml_pid) if haml_pid && running?(haml_pid)
222
- Process.waitall
223
- puts green("== Nimbu has ended its work " + bold("(crowd applauds!)\n"))
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
@@ -1,3 +1,3 @@
1
1
  module Nimbu
2
- VERSION = '0.13.0'.freeze
2
+ VERSION = '0.13.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nimbu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zenjoy BVBA