lookout-jruby 2.2.0 → 2.3.0

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,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d2787a5e23b8927d67987b9b33751b54c5a3bf43
4
- data.tar.gz: c8185a3ef4a80f90abf25f7bc42fa76e13d89900
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZmIzOGI1MjI1ZTQ4YzBiNmUzZGQ4ZmUzNmY2MjNjNTdlYzJkMzA1ZQ==
5
+ data.tar.gz: !binary |-
6
+ ZGRkYzY5MTI2YWNjMGM2MmE2Mjc5OTg2ZmI0ZjE3Y2YwM2JjNjU1Yg==
5
7
  SHA512:
6
- metadata.gz: 2affda2e94e729f07340a9b60e87b509bcacc1718a0ba40c6a966cec6aced5fc0503a4e380d955e1a43672d2b4c8308dc0981fe73901d3072713e9aed9fef264
7
- data.tar.gz: 7e6fe8e4a25bed4f7959692b6b1aa1c7918f6b9030c6a9ddb3186ef9a506de857dbcb0855f3c53872aed39008118ac3c5a763545cfedd14d75c678b2b6c82df5
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
@@ -1,4 +1,7 @@
1
1
  language: ruby
2
+
3
+ sudo: false
4
+
2
5
  rvm:
3
- - jruby-1.7.21
4
- - jruby-9.0.0.0
6
+ - jruby-1.7.23
7
+ - jruby-9.0.4.0
data/lib/lookout/jruby.rb CHANGED
@@ -5,6 +5,9 @@ module Lookout
5
5
  if RUBY_PLATFORM == 'java'
6
6
  # JRuby YAML hack
7
7
  require 'lookout/jruby/psych'
8
+
9
+ # start a cleanup immediately
10
+ require 'lookout/jruby/cleanup_tempfiles'
8
11
  end
9
12
  end
10
13
  end
@@ -0,0 +1,9 @@
1
+ require "lookout/jruby/version"
2
+ require 'lookout/jruby/cleanup_tempfiles_common'
3
+
4
+ if JRUBY_VERSION.start_with?('1.')
5
+ require 'lookout/jruby/cleanup_tempfiles_17'
6
+ else
7
+ require 'lookout/jruby/cleanup_tempfiles_9k'
8
+ end
9
+ Lookout::Jruby.cleanup_tempfiles
@@ -0,0 +1,15 @@
1
+ module Lookout
2
+ module Jruby
3
+
4
+ class << self
5
+ def process_exists?(pid)
6
+ system("kill -0 #{pid} 2> /dev/null")
7
+ rescue
8
+ # i.e. windows
9
+ false
10
+ end
11
+ private :process_exists?
12
+
13
+ end
14
+ end
15
+ end
@@ -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
@@ -18,11 +18,15 @@ if JRUBY_VERSION.start_with?("1.")
18
18
  end
19
19
  end
20
20
 
21
- # This hack is required because YAML is all kinds of messed up and incompatible
22
- # with our version of Configatron under JRuby
23
- module Psych
24
- module Yecht
25
- class MergeKey
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
@@ -1,5 +1,5 @@
1
1
  module Lookout
2
2
  module Jruby
3
- VERSION = "2.2.0"
3
+ VERSION = "2.3.0"
4
4
  end
5
5
  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.2.0
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-09-04 00:00:00.000000000 Z
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