lookout-jruby 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/.travis.yml +5 -2
- data/lib/lookout/jruby.rb +3 -0
- data/lib/lookout/jruby/cleanup_tempfiles.rb +9 -0
- data/lib/lookout/jruby/cleanup_tempfiles_17.rb +15 -0
- data/lib/lookout/jruby/cleanup_tempfiles_9k.rb +19 -0
- data/lib/lookout/jruby/cleanup_tempfiles_common.rb +23 -0
- data/lib/lookout/jruby/psych.rb +9 -5
- data/lib/lookout/jruby/version.rb +1 -1
- data/spec/cleanup_tempfile_spec.rb +53 -0
- data/spec/test.jar +0 -0
- metadata +22 -14
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZmIzOGI1MjI1ZTQ4YzBiNmUzZGQ4ZmUzNmY2MjNjNTdlYzJkMzA1ZQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZGRkYzY5MTI2YWNjMGM2MmE2Mjc5OTg2ZmI0ZjE3Y2YwM2JjNjU1Yg==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
OTlmMWRkNmVkNTJjYjc2NGM5ZDA2MzkwZjM4MGJjYzQ3MzE0MTA4MzI4ODg1
|
10
|
+
Zjk1YzEwMTc3MTFmMmZkYjhiOGJmZWExYTc1MjNkZDk4ZDBlYjU0N2ZlOTk2
|
11
|
+
NTcwNTI3ZWFhNjBiY2NiMjgwZDBjNTM3NzM1OTZjYmZjZjc4ZTA=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NjAzMmQ1MTEwNGJjNjAyNWU2NzIwMGFlZmEzYzRhNjgzYTJlYTRmYzZjMzcw
|
14
|
+
NGIyMTE3MTVhMjViZTFiNWI2NTFiNjU5Yjk1NmE2NzcxYzllNWVmMGM2ZGZl
|
15
|
+
MjU1OTVhMmZlNmQ1MDBmYTM3YjE5NDc3ZWViZTA3NmFiYjVjMDk=
|
data/.travis.yml
CHANGED
data/lib/lookout/jruby.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Lookout
|
2
|
+
module Jruby
|
3
|
+
|
4
|
+
class << self
|
5
|
+
|
6
|
+
# stolen from process_exists gem https://github.com/wilsonsilva/process_exists/blob/master/lib/process_exists/core_ext/process.rb
|
7
|
+
def process_exists?(pid)
|
8
|
+
Process.kill(0, pid.to_i)
|
9
|
+
true
|
10
|
+
rescue Errno::ESRCH # No such process
|
11
|
+
false
|
12
|
+
rescue Errno::EPERM # The process exists, but you dont have permission to send the signal to it.
|
13
|
+
true
|
14
|
+
end
|
15
|
+
private :process_exists?
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Lookout
|
2
|
+
module Jruby
|
3
|
+
|
4
|
+
class << self
|
5
|
+
# cleanup the jars copied to the temp directory when it gets
|
6
|
+
# added to the JRuby classloader. when killing jruby hard
|
7
|
+
# then those files remain there as the JVM does not clean them
|
8
|
+
# up.
|
9
|
+
def cleanup_tempfiles
|
10
|
+
Dir[File.join(ENV_JAVA['java.io.tmpdir'], 'jruby-*')].each do |dir|
|
11
|
+
pid = File.basename(dir)[6..-1]
|
12
|
+
unless process_exists?(pid)
|
13
|
+
# do not use fileutils here as we are in jruby-core
|
14
|
+
Dir[File.join(dir, '*')].each do |file|
|
15
|
+
File.delete(file) rescue warn "could not delete #{file}"
|
16
|
+
end
|
17
|
+
Dir.delete(dir) rescue warn "could not delete #{dir}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/lookout/jruby/psych.rb
CHANGED
@@ -18,11 +18,15 @@ if JRUBY_VERSION.start_with?("1.")
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
#
|
23
|
-
|
24
|
-
module
|
25
|
-
|
21
|
+
begin
|
22
|
+
# This hack is required because YAML is all kinds of messed up and incompatible
|
23
|
+
# with our version of Configatron under JRuby
|
24
|
+
module Psych
|
25
|
+
module Yecht
|
26
|
+
class MergeKey
|
27
|
+
end
|
26
28
|
end
|
27
29
|
end
|
30
|
+
rescue Exception
|
31
|
+
# just be failsafe
|
28
32
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
unless defined? JRUBY_VERSION
|
2
|
+
exit
|
3
|
+
end
|
4
|
+
|
5
|
+
$: << File.expand_path( '../../lib', __FILE__ )
|
6
|
+
|
7
|
+
describe 'cleanup tempfiles' do
|
8
|
+
|
9
|
+
it 'cleanup /tmp/jruby-*/jruby*.jar' do
|
10
|
+
args = [ RbConfig.ruby,
|
11
|
+
'-J-cp',
|
12
|
+
File.expand_path( '../test.jar', __FILE__ ),
|
13
|
+
'-e',
|
14
|
+
'require \'uri:classloader:/my.jar\'; sleep 1234;' ]
|
15
|
+
|
16
|
+
pid = Process.spawn(*args)
|
17
|
+
# give jruby some time to start
|
18
|
+
sleep 10
|
19
|
+
|
20
|
+
tmpdir = File.join( ENV_JAVA['java.io.tmpdir'], "jruby-#{pid}" )
|
21
|
+
unless File.directory?(tmpdir)
|
22
|
+
# some OS give the right PID some uses bash to start java
|
23
|
+
tmpdir = File.join( ENV_JAVA['java.io.tmpdir'], "jruby-#{pid + 1}" )
|
24
|
+
end
|
25
|
+
|
26
|
+
tmpfiles = File.join( tmpdir, 'jruby*.jar' )
|
27
|
+
|
28
|
+
expect(Dir[tmpfiles].size).to be > 0
|
29
|
+
|
30
|
+
if JRUBY_VERSION.start_with?('1.')
|
31
|
+
system("kill -9 #{pid}")
|
32
|
+
else
|
33
|
+
Process.kill(9, pid)
|
34
|
+
end
|
35
|
+
|
36
|
+
# be sure it is killed
|
37
|
+
sleep 1
|
38
|
+
|
39
|
+
require 'lookout/jruby'
|
40
|
+
|
41
|
+
# execute the clean manually for the test
|
42
|
+
Lookout::Jruby.cleanup_tempfiles
|
43
|
+
|
44
|
+
|
45
|
+
if JRUBY_VERSION.start_with?('1.')
|
46
|
+
expect(Dir[tmpfiles].size).to eq 0
|
47
|
+
else
|
48
|
+
warn( 'pending: can not kill process with jruby-9k' )
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
data/spec/test.jar
ADDED
Binary file
|
metadata
CHANGED
@@ -1,52 +1,52 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lookout-jruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Smith
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
14
15
|
requirement: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
17
|
- - ~>
|
17
18
|
- !ruby/object:Gem::Version
|
18
19
|
version: '1.5'
|
19
|
-
name: bundler
|
20
|
-
prerelease: false
|
21
20
|
type: :development
|
21
|
+
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
28
29
|
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
31
|
- - ~>
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '10.2'
|
33
|
-
name: rake
|
34
|
-
prerelease: false
|
35
34
|
type: :development
|
35
|
+
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
42
43
|
requirement: !ruby/object:Gem::Requirement
|
43
44
|
requirements:
|
44
45
|
- - ~>
|
45
46
|
- !ruby/object:Gem::Version
|
46
47
|
version: '3.3'
|
47
|
-
name: rspec
|
48
|
-
prerelease: false
|
49
48
|
type: :development
|
49
|
+
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -66,35 +66,43 @@ files:
|
|
66
66
|
- README.md
|
67
67
|
- Rakefile
|
68
68
|
- lib/lookout/jruby.rb
|
69
|
+
- lib/lookout/jruby/cleanup_tempfiles.rb
|
70
|
+
- lib/lookout/jruby/cleanup_tempfiles_17.rb
|
71
|
+
- lib/lookout/jruby/cleanup_tempfiles_9k.rb
|
72
|
+
- lib/lookout/jruby/cleanup_tempfiles_common.rb
|
69
73
|
- lib/lookout/jruby/psych.rb
|
70
74
|
- lib/lookout/jruby/version.rb
|
71
75
|
- lookout-jruby.gemspec
|
76
|
+
- spec/cleanup_tempfile_spec.rb
|
72
77
|
- spec/some.yml
|
78
|
+
- spec/test.jar
|
73
79
|
- spec/yaml_spec.rb
|
74
80
|
homepage: https://github.com/lookout/lookout-jruby
|
75
81
|
licenses:
|
76
82
|
- MIT
|
77
83
|
metadata: {}
|
78
|
-
post_install_message:
|
84
|
+
post_install_message:
|
79
85
|
rdoc_options: []
|
80
86
|
require_paths:
|
81
87
|
- lib
|
82
88
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
89
|
requirements:
|
84
|
-
- - '>='
|
90
|
+
- - ! '>='
|
85
91
|
- !ruby/object:Gem::Version
|
86
92
|
version: '0'
|
87
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
94
|
requirements:
|
89
|
-
- - '>='
|
95
|
+
- - ! '>='
|
90
96
|
- !ruby/object:Gem::Version
|
91
97
|
version: '0'
|
92
98
|
requirements: []
|
93
|
-
rubyforge_project:
|
99
|
+
rubyforge_project:
|
94
100
|
rubygems_version: 2.4.5
|
95
|
-
signing_key:
|
101
|
+
signing_key:
|
96
102
|
specification_version: 4
|
97
103
|
summary: JRuby hacks
|
98
104
|
test_files:
|
105
|
+
- spec/cleanup_tempfile_spec.rb
|
99
106
|
- spec/some.yml
|
107
|
+
- spec/test.jar
|
100
108
|
- spec/yaml_spec.rb
|