Skip to content

Commit

Permalink
initial work for vendoring jvm into slug
Browse files Browse the repository at this point in the history
  • Loading branch information
hone committed Jul 10, 2012
1 parent 96d8852 commit d32113d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/language_pack/ruby.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class LanguagePack::Ruby < LanguagePack::Base
BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}"
NODE_VERSION = "0.4.7" NODE_VERSION = "0.4.7"
NODE_JS_BINARY_PATH = "node-#{NODE_VERSION}" NODE_JS_BINARY_PATH = "node-#{NODE_VERSION}"
JVM_BASE_URL = "http://heroku-jvm-langpack-java.s3.amazonaws.com"
JVM_VERSION = "openjdk6-latest"


# detects if this is a valid Ruby app # detects if this is a valid Ruby app
# @return [Boolean] true if it's a Ruby app # @return [Boolean] true if it's a Ruby app
Expand Down Expand Up @@ -47,6 +49,7 @@ def compile
Dir.chdir(build_path) Dir.chdir(build_path)
remove_vendor_bundle remove_vendor_bundle
install_ruby install_ruby
install_jvm
setup_language_pack_environment setup_language_pack_environment
allow_git do allow_git do
install_language_pack_gems install_language_pack_gems
Expand Down Expand Up @@ -77,6 +80,12 @@ def slug_vendor_ruby
"vendor/#{ruby_version}" "vendor/#{ruby_version}"
end end


# the relative path to the vendored jvm
# @return [String] resulting path
def slug_vendor_jvm
"vendor/jvm"
end

# the absolute path of the build ruby to use during the buildpack # the absolute path of the build ruby to use during the buildpack
# @return [String] resulting path # @return [String] resulting path
def build_ruby_path def build_ruby_path
Expand Down Expand Up @@ -214,6 +223,18 @@ def install_ruby
true true
end end


# vendors JVM into the slug for JRuby
def install_jvm
if ruby_version_jruby?
topic "Installing JVM: #{JVM_VERSION}"

FileUtils.mkdir_p(slug_vendor_jvm)
Dir.chdir(slug_vendor_jvm) do
run("curl #{JVM_BASE_URL}/#{JVM_VERSION}.tar.gz -s -o - | tar xzf -")
end
end
end

# find the ruby install path for its binstubs during build # find the ruby install path for its binstubs during build
# @return [String] resulting path or empty string if ruby is not vendored # @return [String] resulting path or empty string if ruby is not vendored
def ruby_install_binstub_path def ruby_install_binstub_path
Expand Down

0 comments on commit d32113d

Please sign in to comment.