Skip to content

Instantly share code, notes, and snippets.

@nikitug
Created April 4, 2012 13:31
Show Gist options
  • Save nikitug/2301064 to your computer and use it in GitHub Desktop.
Save nikitug/2301064 to your computer and use it in GitHub Desktop.
JRuby compile
require 'jruby-jars'
classpath = [JRubyJars.core_jar_path, JRubyJars.stdlib_jar_path].join(File::PATH_SEPARATOR)
files = Dir["**/*.rb"].reject{|file| file.match(/compile\.rb$/)}
%x{java -Djruby.compat.version=1.9 -classpath #{classpath} org.jruby.Main -S jrubyc #{files.join(" ")}}
files.each do |ruby_source|
File.open(ruby_source, "w") { |f| f.write("require __FILE__.sub(/\.rb$/, '.class')") }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment