diff --git a/Gemfile b/Gemfile index c6c05c0b..ba2b2575 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,6 @@ source "http://rubygems.org" gem "rspec", "2.12.0" gem "faker" gem "rake" -gem "rawr", "1.6.6", :source => "http://gems.neurogami.com" +gem "rawr", "1.8.3", :source => "http://gems.neurogami.com" gem "user-choices" # gem "rails" diff --git a/Gemfile.lock b/Gemfile.lock index ed357cff..03111a01 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,7 +10,7 @@ GEM rake (>= 0.8, < 11.0) i18n (0.6.11) rake (10.3.2) - rawr (1.6.6) + rawr (1.8.3) rubyzip user-choices rspec (2.12.0) @@ -37,6 +37,6 @@ PLATFORMS DEPENDENCIES faker rake - rawr (= 1.6.6)! + rawr (= 1.8.3)! rspec (= 2.12.0) user-choices diff --git a/Rakefile b/Rakefile index cb018945..fe6fc1fa 100644 --- a/Rakefile +++ b/Rakefile @@ -50,7 +50,7 @@ INFO_ENDL %x{cp lib/java-appbundler/JavaAppLauncher #{CONFIG.osx_output_dir}/#{CONFIG.project_name}.app/Contents/MacOS } %x{mv #{CONFIG.osx_output_dir}/#{CONFIG.project_name}.app/Contents/Resources/Java #{CONFIG.osx_output_dir}/#{CONFIG.project_name}.app/Contents/Java } - %x{chmod 644 #{CONFIG.osx_output_dir}/#{CONFIG.project_name}.app/Contents/Resources/Java/compass-app.jar} + %x{chmod 644 #{CONFIG.osx_output_dir}/#{CONFIG.project_name}.app/Contents/Java/compass-app.jar} Dir.chdir CONFIG.osx_output_dir %x{mv #{CONFIG.project_name}.app compass.app;} @osx_bundle_file="compass.app.osx.#{@compile_time}-#{@revision}.zip" diff --git a/lib/java/jruby-complete.jar b/lib/java/jruby-complete.jar index 898f9927..c7ec0b76 100644 Binary files a/lib/java/jruby-complete.jar and b/lib/java/jruby-complete.jar differ diff --git a/src/com/kkbox/compassapp/Main.java b/src/com/kkbox/compassapp/Main.java index 804da27b..578dc696 100644 --- a/src/com/kkbox/compassapp/Main.java +++ b/src/com/kkbox/compassapp/Main.java @@ -40,24 +40,34 @@ public static void main(String[] args) throws Exception { System.err.println("Error loading run configuration file '" + runConfigFile + "', using defaults: " + npe ); } + String trailingPathSlash = ""; + for(String line : config_data) { String[] parts = line.split(":"); + + if("load_path_slash".equals(parts[0].replaceAll(" ", ""))) { + trailingPathSlash = parts[1].replaceAll(" ", ""); + } if("main_ruby_file".equals(parts[0].replaceAll(" ", ""))) { mainRubyFile = parts[1].replaceAll(" ", ""); } if("source_dirs".equals(parts[0].replaceAll(" ", ""))) { String[] source_dirs = parts[1].split(";"); - + for(String s : parts[1].split(";") ){ String d = s.replaceAll(" ", ""); - runtime.evalScriptlet( "$: << '"+d+"/'" ); + // System.err.println("Add '" + d + trailingPathSlash + "' to $:"); // JGBDEBUG + runtime.evalScriptlet( "$: << '" + d + "'" ); + //runtime.evalScriptlet( "$: << '" + d + trailingPathSlash + "'" ); + runtime.evalScriptlet( "$: << 'file://" + (new Path()).getJarPath() + "!/" + d + "'" ); } } } runtime.evalScriptlet("require '" + mainRubyFile + "'"); + JavaEmbedUtils.terminate(runtime); } public static URL getResource(String path) { diff --git a/src/com/kkbox/compassapp/Path.java b/src/com/kkbox/compassapp/Path.java new file mode 100644 index 00000000..45621043 --- /dev/null +++ b/src/com/kkbox/compassapp/Path.java @@ -0,0 +1,8 @@ +package com.kkbox.compassapp; + +public class Path { + public String getJarPath() { + return getClass().getProtectionDomain().getCodeSource().getLocation().getPath(); + } +} + diff --git a/src/main.rb b/src/main.rb index fc5a89b4..c973189d 100644 --- a/src/main.rb +++ b/src/main.rb @@ -27,7 +27,7 @@ def set_lib_path require 'uri' require 'cgi' main_file_path = CGI.unescape(URI.parse(URI.escape(__FILE__)).path) - resources_dir = File.join(File.dirname( File.dirname(File.dirname( main_file_path ))), 'Resources') + resources_dir = File.join(File.dirname(File.dirname(File.dirname(File.dirname( main_file_path )))), 'Resources') if File.exists?( File.join(resources_dir, 'lib','ruby')) @lib_path = File.join(resources_dir, 'lib') else