Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d0cc57c1fded
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c5fa69253e83
Choose a head ref
  • 3 commits
  • 8 files changed
  • 1 contributor

Commits on Feb 10, 2015

  1. allow to change directory into the uri:classloader:// space

    Conflicts:
    	core/src/main/java/org/jruby/RubyDir.java
    mkristian committed Feb 10, 2015
    Copy the full SHA
    b949c59 View commit details
  2. Copy the full SHA
    3d4ccdf View commit details
  3. Copy the full SHA
    c5fa692 View commit details
28 changes: 18 additions & 10 deletions core/src/main/java/org/jruby/RubyDir.java
Original file line number Diff line number Diff line change
@@ -178,6 +178,9 @@ private static IRubyObject asRubyStringList(Ruby runtime, List<ByteList> dirs) {
}

private static String getCWD(Ruby runtime) {
if (runtime.getCurrentDirectory().startsWith("uri:")) {
return runtime.getCurrentDirectory();
}
try {
return new org.jruby.util.NormalizedFile(runtime.getCurrentDirectory()).getCanonicalPath();
} catch (Exception e) {
@@ -297,17 +300,22 @@ public static IRubyObject chdir(ThreadContext context, IRubyObject recv, IRubyOb
RubyFile.get_path(context, args[0]) : getHomeDirectoryPath(context);
String adjustedPath = RubyFile.adjustRootPathOnWindows(runtime, path.asJavaString(), null);
checkDirIsTwoSlashesOnWindows(runtime, adjustedPath);
JRubyFile dir = getDir(runtime, adjustedPath, true);
String realPath;
String realPath = null;
String oldCwd = runtime.getCurrentDirectory();
if (adjustedPath.startsWith("uri:")){
realPath = adjustedPath;
}
else {
JRubyFile dir = getDir(runtime, adjustedPath, true);

// We get canonical path to try and flatten the path out.
// a dir '/subdir/..' should return as '/'
// cnutter: Do we want to flatten path out?
try {
realPath = dir.getCanonicalPath();
} catch (IOException e) {
realPath = dir.getAbsolutePath();
// We get canonical path to try and flatten the path out.
// a dir '/subdir/..' should return as '/'
// cnutter: Do we want to flatten path out?
try {
realPath = dir.getCanonicalPath();
} catch (IOException e) {
realPath = dir.getAbsolutePath();
}
}

IRubyObject result = null;
@@ -317,7 +325,7 @@ public static IRubyObject chdir(ThreadContext context, IRubyObject recv, IRubyOb
try {
result = block.yield(context, path);
} finally {
getDir(runtime, oldCwd, true); // ENEBO: Needed in case exception is thrown???
getDir(runtime, oldCwd, true); // needed in case the block deleted the oldCwd
runtime.setCurrentDirectory(oldCwd);
}
} else {
4 changes: 2 additions & 2 deletions lib/ruby/stdlib/rubygems/defaults/jruby.rb
Original file line number Diff line number Diff line change
@@ -70,7 +70,7 @@ def self.win_platform?
# Allow specifying jar and classpath type gem path entries
def self.path_separator
return File::PATH_SEPARATOR unless File::PATH_SEPARATOR == ':'
/(?<!jar:file|jar|file|classpath):/
/(?<!jar:file|jar|file|classpath|uri:classloader|uri):/
end
end

@@ -85,7 +85,7 @@ def dirs
elsif File.directory?(File.join(dir, "specifications")) || dir =~ /^file:/
File.join(dir, "specifications")
end
}.compact + spec_directories_from_classpath
}.compact + ['uri:classloader://specifications'] + spec_directories_from_classpath
end

def add_dir dir
2 changes: 1 addition & 1 deletion maven/jruby/src/it/j2ee_jetty_rack/Mavenfile
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ gem 'flickraw', '0.9.7'
repository( :url => 'http://rubygems-proxy.torquebox.org/releases',
:id => 'rubygems-releases' )

jruby_plugin :gem, :includeRubygemsInResources => true, :includeLibDirectoryInResources => true do
jruby_plugin :gem, :includeRubygemsInResources => true, :includeLibDirectoryInResources => true, :jrubyVersion => '1.7.19' do
execute_goal :initialize
end

1 change: 1 addition & 0 deletions maven/jruby/src/it/j2ee_jetty_rack/pom.xml
Original file line number Diff line number Diff line change
@@ -71,6 +71,7 @@
<configuration>
<includeRubygemsInResources>true</includeRubygemsInResources>
<includeLibDirectoryInResources>true</includeLibDirectoryInResources>
<jrubyVersion>1.7.19</jrubyVersion>
</configuration>
</plugin>
<plugin>
2 changes: 1 addition & 1 deletion maven/jruby/src/it/j2ee_tomcat_rack/Mavenfile
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ gem 'flickraw', '0.9.7'
repository( :url => 'http://rubygems-proxy.torquebox.org/releases',
:id => 'rubygems-releases' )

jruby_plugin :gem, :includeRubygemsInResources => true, :includeLibDirectoryInResources => true do
jruby_plugin :gem, :includeRubygemsInResources => true, :includeLibDirectoryInResources => true, :jrubyVersion => '1.7.19' do
execute_goal :initialize
end

56 changes: 31 additions & 25 deletions maven/jruby/src/it/runnable/Mavenfile
Original file line number Diff line number Diff line change
@@ -2,48 +2,54 @@

properties( 'tesla.dump.pom' => 'pom.xml',
'tesla.dump.readOnly' => true,
'jruby.version' => '@project.version@' )
'jruby.version' => '@project.version@',
'jruby.plugins.version' => '1.0.8' )
gemfile

gem 'bundler', '1.7.7'

pom 'org.jruby:jruby', '${jruby.version}'

jar 'de.saumya.mojo:jruby-mains', '0.1.0'

files = [ 'config.ru', '*file', '*file.lock', '.jbundler/classpath.rb',
'lib/**', 'app/**', 'config/**', 'vendor/**', 'spec/**' ]

resource :directory => '${basedir}' do
includes( files )
end
# resource :directory => '${basedir}' do
# includes( files )
# end

execute 'create jrubydir info', :phase => 'process-resources' do |ctx|
target = ctx.project.build.output_directory.to_pathname
entries = files.collect { |f| Dir[ f.sub( /\/.*$/, '') ] }.flatten.uniq
File.write( File.join( target, '.jrubydir' ),
(['.'] + entries + [ '' ]).join( "\n" ) )
require (ctx.basedir.to_pathname + '/../../../../../core/src/main/ruby/jruby/commands.rb')
files.select do |f|
f =~ /\//
end.collect do |f|
f.sub( /\/.*$/, '')
end.each do |f|
JRuby::Commands.generate_dir_info( File.join( target, f ), false )
end
end
# execute 'create jrubydir info', :phase => 'process-resources' do |ctx|
# target = ctx.project.build.output_directory.to_pathname
# entries = files.collect { |f| Dir[ f.sub( /\/.*$/, '') ] }.flatten.uniq
# File.write( File.join( target, '.jrubydir' ),
# (['.'] + entries + [ '' ]).join( "\n" ) )
# require (ctx.basedir.to_pathname + '/../../../../../core/src/main/ruby/jruby/commands.rb')
# files.select do |f|
# f =~ /\//
# end.collect do |f|
# f.sub( /\/.*$/, '')
# end.each do |f|
# JRuby::Commands.generate_dir_info( File.join( target, f ), false )
# end
# end

resource :directory => '${project.build.directory}/rubygems/bin' do
includes '*'
target_path 'META-INF/jruby.home/bin'
end
# resource :directory => '${project.build.directory}/rubygems/bin' do
# includes '*'
# target_path 'META-INF/jruby.home/bin'
# end

build do
directory 'pkg'
end

jruby_plugin!( :gem, '1.0.8',
jruby_plugin!( :gem,
# need a jruby-complete from maven central here
:jrubyVersion => '1.7.19',
:includeRubygemsInResources => true )
:includeRubygemsInResources => true ) do
execute_goals( 'generate-resources', 'process-resources', :includeBinStubs => true, :includeRubyResources => files )
end


if File.file?('Jarfile.lock')
phase :package do
@@ -72,7 +78,7 @@ plugin :shade do
:id => 'pack',
:artifactSet => { :excludes => ['rubygems:*'] },
:transformers => [ { :@implementation => 'org.apache.maven.plugins.shade.resource.ManifestResourceTransformer',
:mainClass => 'Main' } ] )
:mainClass => 'de.saumya.mojo.mains.JarMain' } ] )
end

# test bits
78 changes: 27 additions & 51 deletions maven/jruby/src/it/runnable/pom.xml
Original file line number Diff line number Diff line change
@@ -9,10 +9,9 @@
<properties>
<tesla.dump.readOnly>true</tesla.dump.readOnly>
<jruby.version>@project.version@</jruby.version>
<jruby.plugins.version>1.0.3</jruby.plugins.version>
<jruby.plugins.version>1.0.8</jruby.plugins.version>
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
<tesla.dump.pom>pom.xml</tesla.dump.pom>
<tesla.version>0.1.1</tesla.version>
</properties>
<dependencies>
<dependency>
@@ -27,6 +26,11 @@
<version>${jruby.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>de.saumya.mojo</groupId>
<artifactId>jruby-mains</artifactId>
<version>0.1.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
@@ -35,29 +39,6 @@
</repository>
</repositories>
<build>
<resources>
<resource>
<directory>${basedir}</directory>
<includes>
<include>config.ru</include>
<include>*file</include>
<include>*file.lock</include>
<include>.jbundler/classpath.rb</include>
<include>lib/**</include>
<include>app/**</include>
<include>config/**</include>
<include>vendor/**</include>
<include>spec/**</include>
</includes>
</resource>
<resource>
<targetPath>META-INF/jruby.home/bin</targetPath>
<directory>${project.build.directory}/rubygems/bin</directory>
<includes>
<include>*</include>
</includes>
</resource>
</resources>
<directory>pkg</directory>
<plugins>
<plugin>
@@ -102,6 +83,26 @@
<goal>initialize</goal>
</goals>
</execution>
<execution>
<goals>
<goal>generate-resources</goal>
<goal>process-resources</goal>
</goals>
<configuration>
<includeBinStubs>true</includeBinStubs>
<includeRubyResources>
<includeRubyResource>config.ru</includeRubyResource>
<includeRubyResource>*file</includeRubyResource>
<includeRubyResource>*file.lock</includeRubyResource>
<includeRubyResource>.jbundler/classpath.rb</includeRubyResource>
<includeRubyResource>lib/**</includeRubyResource>
<includeRubyResource>app/**</includeRubyResource>
<includeRubyResource>config/**</includeRubyResource>
<includeRubyResource>vendor/**</includeRubyResource>
<includeRubyResource>spec/**</includeRubyResource>
</includeRubyResources>
</configuration>
</execution>
</executions>
<configuration>
<jrubyVersion>1.7.19</jrubyVersion>
@@ -172,7 +173,7 @@
</artifactSet>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>Main</mainClass>
<mainClass>de.saumya.mojo.mains.JarMain</mainClass>
</transformer>
</transformers>
</configuration>
@@ -226,31 +227,6 @@
</environmentVariables>
</configuration>
</plugin>
<plugin>
<groupId>io.tesla.polyglot</groupId>
<artifactId>tesla-polyglot-maven-plugin</artifactId>
<version>${tesla.version}</version>
<executions>
<execution>
<id>create jrubydir info</id>
<phase>process-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<taskId>create jrubydir info</taskId>
<nativePom>Mavenfile</nativePom>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>io.tesla.polyglot</groupId>
<artifactId>tesla-polyglot-ruby</artifactId>
<version>${tesla.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<profiles>
2 changes: 1 addition & 1 deletion maven/jruby/src/it/runnable/spec/one_spec.rb
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
describe "something" do
it "does something" do
$CLASSPATH.size.should == 4
Jars.home.should == 'uri:classloader:/'
Jars.home.should == 'uri:classloader://'
Dir.pwd.should == 'uri:classloader://'
$LOAD_PATH.each do |lp|
lp.should =~ /^uri:classloader:|runnable.jar!\//