Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -37,6 +37,6 @@ PLATFORMS
DEPENDENCIES
faker
rake
rawr (= 1.6.6)!
rawr (= 1.8.3)!
rspec (= 2.12.0)
user-choices
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Binary file modified lib/java/jruby-complete.jar
Binary file not shown.
14 changes: 12 additions & 2 deletions src/com/kkbox/compassapp/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 8 additions & 0 deletions src/com/kkbox/compassapp/Path.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.kkbox.compassapp;

public class Path {
public String getJarPath() {
return getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
}
}

2 changes: 1 addition & 1 deletion src/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down