stripmem 0.0.1 → 0.0.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/stripmem/app.rb CHANGED
@@ -1,6 +1,17 @@
1
1
  require 'stripmem/web'
2
2
  require 'stripmem/websocket'
3
3
 
4
+ if RUBY_VERSION =~ /^1.8/
5
+ module Enumerable
6
+ def each_with_object(obj)
7
+ each do |x|
8
+ yield x, obj
9
+ end
10
+ obj
11
+ end
12
+ end
13
+ end
14
+
4
15
  module StripMem
5
16
  class App
6
17
  def self.run!(argv)
@@ -23,14 +34,18 @@ module StripMem
23
34
  WebSocket.new(channel).run!
24
35
  Thread.new do
25
36
  Web.new(channel).run! # This doesn't return until sinatra exits. (Sinatra handles SIGINT.)
37
+ kill!
26
38
  EM.stop
39
+ exit
27
40
  end
28
41
  end
29
- begin
30
- Process.kill(@child, 'QUIT')
31
- rescue => e
32
- puts "kill #{@child.inspect}: #{e}"
33
- end
42
+ kill!
43
+ end
44
+
45
+ def kill!
46
+ Process.kill('QUIT', @child.to_i)
47
+ rescue => e
48
+ puts "kill #{@child.inspect}: #{e}"
34
49
  end
35
50
 
36
51
  def find_children
@@ -1,3 +1,3 @@
1
1
  module StripMem
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripmem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2013-07-17 00:00:00.000000000 Z
12
+ date: 2013-07-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: em-websocket
@@ -590,7 +590,8 @@ files:
590
590
  - LICENSE
591
591
  - exe/stripmem
592
592
  homepage: https://github.com/spraints/stripmem
593
- licenses: []
593
+ licenses:
594
+ - MIT
594
595
  post_install_message:
595
596
  rdoc_options: []
596
597
  require_paths: