forked from jruby/jruby
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added nested IsolatedScriptingContainer via jruby-mains test
execute code inside a jar via jruby-mains, create an IsolatedSCriptingContainer which should inherit the environment from the jruby-mains, i.e. GEM_PATH, GEM_HOME, JARS_HOME, current working directory should all point inside the jars Sponsored by Lookout Inc.
- Loading branch information
Showing
7 changed files
with
110 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# TODO needs fix in jruby | ||
#require_relative 'test' | ||
require 'uri:classloader:/test' | ||
|
||
# not use Singleton scope since in this case it would use the on global runtime | ||
other = org.jruby.embed.IsolatedScriptingContainer.new(org.jruby.embed.LocalContextScope::THREADSAFE) | ||
|
||
other.runScriptlet("$other = #{JRuby.runtime.object_id}") | ||
|
||
# TODO needs fix in jruby | ||
#other.runScriptlet( "require_relative 'test_other'" ) | ||
other.runScriptlet( "require 'uri:classloader:/test_other'" ) | ||
|
||
other.terminate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require 'minitest/autorun' | ||
|
||
describe 'ENV' do | ||
|
||
it 'has current directory inside classloader' do | ||
Dir.pwd.must_equal 'uri:classloader://' | ||
end | ||
|
||
it 'has first entry LOAD_PATH' do | ||
$LOAD_PATH.first.must_equal 'uri:classloader://' | ||
end | ||
|
||
it 'has GEM_HOME set' do | ||
ENV['GEM_HOME'].must_equal 'uri:classloader://META-INF/jruby.home/lib/ruby/gems/shared' | ||
end | ||
|
||
it 'has GEM_PATH set' do | ||
ENV['GEM_PATH'].must_equal 'uri:classloader://' | ||
end | ||
|
||
it 'has JARS_HOME set' do | ||
ENV['JARS_HOME'].must_equal 'uri:classloader://jars' | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require 'minitest/autorun' | ||
|
||
describe 'ENV' do | ||
|
||
it 'has $other' do | ||
$other.wont_equal JRuby.runtime.object_id | ||
end | ||
|
||
it 'has first entry LOAD_PATH' do | ||
$LOAD_PATH.first.must_equal 'uri:classloader:/' | ||
end | ||
|
||
it 'has current directory inside classloader' do | ||
Dir.pwd.must_equal 'uri:classloader:/' | ||
end | ||
|
||
it 'has GEM_HOME set' do | ||
ENV['GEM_HOME'].must_equal 'uri:classloader:/' | ||
end | ||
|
||
it 'has GEM_PATH set' do | ||
ENV['GEM_PATH'].must_equal 'uri:classloader:/' | ||
end | ||
|
||
it 'has JARS_HOME set' do | ||
ENV['JARS_HOME'].must_equal 'uri:classloader:/jars' | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters