Skip to content

Commit 88e9f75

Browse files
committed
irb from within the jruby-complete.jar needs to handle uri like file names - fixes #1983
1 parent 29c2f06 commit 88e9f75

File tree

5 files changed

+70
-2
lines changed

5 files changed

+70
-2
lines changed

bin/jirb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
require "irb"
1111

12-
if __FILE__ == $0
12+
if __FILE__.sub(/file:/, '') == $0.sub(/file:/, '')
1313
IRB.start(__FILE__)
1414
else
1515
# check -e option

bin/jirb_swing

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ end
4949
JRuby.objectspace = true # useful for code completion
5050

5151
# From vanilla IRB
52-
if __FILE__ == $0
52+
if __FILE__.sub(/file:/, '') == $0.sub(/file:/, '')
5353
IRB.start(__FILE__)
5454
else
5555
# check -e option
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
JAVA=`which java`
2+
# jirb_swing does not work in those test environments
3+
for i in irb jirb ; do
4+
echo "puts 'hello $i'" | PATH= $JAVA -jar jruby-complete-1.7.16-SNAPSHOT.jar -S $i
5+
done
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<project>
2+
<groupId>org.jruby</groupId>
3+
<artifactId>execute-java--jar-jruby-complete_dot_jar--S-jirb</artifactId>
4+
<version>1</version>
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<dependencies>
8+
<dependency>
9+
<groupId>org.jruby</groupId>
10+
<artifactId>jruby-complete</artifactId>
11+
<version>1.7.16-SNAPSHOT</version>
12+
<type>jar</type>
13+
</dependency>
14+
</dependencies>
15+
16+
<build>
17+
<resources>
18+
<resource>
19+
<directory>../../local-repo/org/jruby/jruby-complete/1.7.16-SNAPSHOT</directory>
20+
<includes>
21+
<include>jruby-complete-*.jar</include>
22+
</includes>
23+
<targetPath>${project.basedir}</targetPath>
24+
</resource>
25+
</resources>
26+
<plugins>
27+
<plugin>
28+
<groupId>org.codehaus.mojo</groupId>
29+
<artifactId>exec-maven-plugin</artifactId>
30+
<version>1.2</version>
31+
<executions>
32+
<execution>
33+
<phase>package</phase>
34+
<goals><goal>exec</goal></goals>
35+
<configuration>
36+
<executable>irb.sh</executable>
37+
</configuration>
38+
</execution>
39+
</executions>
40+
</plugin>
41+
</plugins>
42+
</build>
43+
</project>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import java.io.*;
2+
import org.codehaus.plexus.util.FileUtils;
3+
4+
5+
String log = FileUtils.fileRead( new File( basedir, "build.log" ) );
6+
String expected = "hello irb";
7+
if ( !log.contains( expected ) )
8+
{
9+
throw new RuntimeException( "log file does not contain '" + expected + "'" );
10+
}
11+
// expected = "hello swing_jirb";
12+
// if ( !log.contains( expected ) )
13+
// {
14+
// throw new RuntimeException( "log file does not contain '" + expected + "'" );
15+
// }
16+
expected = "hello jirb";
17+
if ( !log.contains( expected ) )
18+
{
19+
throw new RuntimeException( "log file does not contain '" + expected + "'" );
20+
}

0 commit comments

Comments
 (0)