Skip to content

Commit

Permalink
Showing 7 changed files with 36 additions and 8 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/util/JRubyClassLoader.java
Original file line number Diff line number Diff line change
@@ -83,7 +83,7 @@ private File getTempDir() {
}

// Change visibility so others can see it
@Override
@Override
public void addURL(URL url) {
// if we have such embedded jar within a jar, we copy it to temp file and use the
// the temp file with the super URLClassLoader
Original file line number Diff line number Diff line change
@@ -661,7 +661,7 @@ private String resolveScript(String scriptName) {
String path = maybePath.toString();
String[] paths = path.split(System.getProperty("path.separator"));
for (int i = 0; i < paths.length; i++) {
result = resolve(paths[i], scriptName);
result = resolve(new File(paths[i]).getAbsolutePath(), scriptName);
if (result != null) return result;
}
}
21 changes: 21 additions & 0 deletions maven/jruby-complete/src/it/integrity/pom.xml
Original file line number Diff line number Diff line change
@@ -233,6 +233,27 @@
</arguments>
</configuration>
</execution>
<execution>
<id>-S icecream - GH-3186</id>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<workingDirectory>${basedir}</workingDirectory>
<executable>java</executable>
<environmentVariables>
<PATH>${env.PATH}:somebin</PATH>
</environmentVariables>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>org.jruby.Main</argument>
<argument>-S</argument>
<argument>icecream</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>META-INF/jruby.home is not a file - GH-3342</id>
<phase>test</phase>
1 change: 1 addition & 0 deletions maven/jruby-complete/src/it/integrity/somebin/icecream
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts __FILE__
5 changes: 5 additions & 0 deletions maven/jruby-complete/src/it/integrity/verify.bsh
Original file line number Diff line number Diff line change
@@ -53,6 +53,11 @@ if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = basedir + "/somebin/icecream";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}

File file = new File(basedir, "bin/.jrubydir");
if ( !file.exists() )
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ public class DeclarationContext {

/** @see <a href="http://yugui.jp/articles/846">http://yugui.jp/articles/846</a> */
private enum DefaultDefinee {
DECLARING_MODULE,
LEXICAL_SCOPE,
SINGLETON_CLASS,
SELF
}
@@ -55,8 +55,8 @@ public DeclarationContext withVisibility(Visibility visibility) {

public DynamicObject getModuleToDefineMethods(VirtualFrame frame, RubyContext context, SingletonClassNode singletonClassNode) {
switch (defaultDefinee) {
case DECLARING_MODULE:
return (DynamicObject) RubyArguments.getMethod(frame.getArguments()).getDeclaringModule();
case LEXICAL_SCOPE:
return RubyArguments.getMethod(frame.getArguments()).getSharedMethodInfo().getLexicalScope().getLiveModule();
case SINGLETON_CLASS:
final Object self = RubyArguments.getSelf(frame.getArguments());
return singletonClassNode.executeSingletonClass(frame, self);
@@ -67,9 +67,10 @@ public DynamicObject getModuleToDefineMethods(VirtualFrame frame, RubyContext co
}
}

public static final DeclarationContext METHOD = new DeclarationContext(Visibility.PUBLIC, DefaultDefinee.DECLARING_MODULE);
public static final DeclarationContext MODULE = METHOD;
public static final DeclarationContext MODULE = new DeclarationContext(Visibility.PUBLIC, DefaultDefinee.LEXICAL_SCOPE);
public static final DeclarationContext METHOD = MODULE;
public static final DeclarationContext BLOCK = METHOD;
public static final DeclarationContext TOP_LEVEL = METHOD;
public static final DeclarationContext INSTANCE_EVAL = new DeclarationContext(Visibility.PUBLIC, DefaultDefinee.SINGLETON_CLASS);
public static final DeclarationContext CLASS_EVAL = new DeclarationContext(Visibility.PUBLIC, DefaultDefinee.SELF);

Original file line number Diff line number Diff line change
@@ -373,7 +373,7 @@ public RubyNode wrap(RubyNode node) {
}
};

execute(source, UTF8Encoding.INSTANCE, ParserContext.TOP_LEVEL, coreLibrary.getMainObject(), null, true, DeclarationContext.MODULE, currentNode, composed);
execute(source, UTF8Encoding.INSTANCE, ParserContext.TOP_LEVEL, coreLibrary.getMainObject(), null, true, DeclarationContext.TOP_LEVEL, currentNode, composed);
}

public SymbolTable getSymbolTable() {

0 comments on commit eaa3565

Please sign in to comment.