Commits

schneems authored d1355c479ab
Fix Double Ruby for CI & DRY We can DRY up the bash scripts a bit by putting common logic into a function. You get access to this function by sourcing `bin/support/bash_functions.sh`. Currently only one function is offered: ``` heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$ROOT_DIR" ``` This will download a version of Ruby for the buildpack and set the appropriate env vars so that it can be run. Now everywhere we were previously doing this manually we can re-use this bash function: ``` source "$BIN_DIR/support/bash_functions.sh" heroku_buildpack_ruby_install_ruby "$BIN_DIR" "$ROOT_DIR" ``` This left us with a problem since `bin/test-compile` is what set's up an app's `PATH` and `GEM_PATH`, however `bin/test` which is called after, also installs a verison of Ruby for the buildpack and to get this working correctly it mutates the `PATH` and unsets the `GEM_PATH`. To get the application code working correctly we can manually set the two values. ```ruby LanguagePack::ShellHelpers.user_env_hash["PATH"] = "#{build_dir}/bin:#{ENV["PATH"]}" LanguagePack::ShellHelpers.user_env_hash["GEM_PATH"] = LanguagePack::Ruby.slug_vendor_base ``` To get this code to work we have to remove support for Ruby 1.8.7 from the buildpack. This is fine since 1.8.7 is EOL for many years now and not supported on any stacks that Heroku currently maintains.