Skip to content

Commit

Permalink
ruby 1.8.7 support
Browse files Browse the repository at this point in the history
  • Loading branch information
hone committed Jul 16, 2012
1 parent 4bec1de commit 28e68a9
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions lib/language_pack/ruby.rb
Expand Up @@ -52,6 +52,7 @@ def compile
install_jvm
setup_language_pack_environment
allow_git do
install_rubygems
install_language_pack_gems
build_bundler
create_database_yml
Expand All @@ -71,7 +72,13 @@ def default_path
# the relative path to the bundler directory of gems
# @return [String] resulting path
def slug_vendor_base
@slug_vendor_base ||= run(%q(ruby -e "require 'rbconfig';puts \"vendor/bundle/#{RUBY_ENGINE}/#{RbConfig::CONFIG['ruby_version']}\"")).chomp
if @slug_vendor_base
@slug_vendor_base
elsif @ruby_version == "ruby-1.8.7"
@slug_vendor_base = "vendor/bundle/1.8"
else
@slug_vendor_base = run(%q(ruby -e "require 'rbconfig';puts \"vendor/bundle/#{RUBY_ENGINE}/#{RbConfig::CONFIG['ruby_version']}\"")).chomp
end
end

# the relative path to the vendored ruby directory
Expand Down Expand Up @@ -264,11 +271,21 @@ def setup_ruby_install_env
end

# list of default gems to vendor into the slug
# @return [Array] resulting list of gems
# @return [Array] resluting list of gems
def gems
[BUNDLER_GEM_PATH]
end

# need to install rubygems separately for 1.8.x
def install_rubygems
Dir.mktmpdir("rubygems-") do |tmpdir|
Dir.chdir(tmpdir) do
run("curl http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz -s -o - | tar xzf -")
puts run("ruby rubygems-1.8.24/setup.rb")
end
end
end

# installs vendored gems into the slug
def install_language_pack_gems
FileUtils.mkdir_p(slug_vendor_base)
Expand Down Expand Up @@ -406,7 +423,7 @@ def syck_hack
ruby_version = run('ruby -e "puts RUBY_VERSION"').chomp
# < 1.9.3 includes syck, so we need to use the syck hack
if Gem::Version.new(ruby_version) < Gem::Version.new("1.9.3")
"-r #{syck_hack_file}"
"-r#{syck_hack_file}"
else
""
end
Expand Down

0 comments on commit 28e68a9

Please sign in to comment.