forked from heroku/heroku-buildpack-ruby
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from Scalingo/deps/63/upstream_v268
Sync with upstream v268
- Loading branch information
Showing
24 changed files
with
270 additions
and
326 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,4 +72,4 @@ RUBY VERSION | |
ruby 3.1.4p223 | ||
|
||
BUNDLED WITH | ||
2.3.10 | ||
2.5.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,59 @@ | ||
require 'language_pack/installers/ruby_installer' | ||
require 'language_pack/base' | ||
require 'language_pack/shell_helpers' | ||
|
||
class LanguagePack::Installers::HerokuRubyInstaller | ||
include LanguagePack::ShellHelpers, LanguagePack::Installers::RubyInstaller | ||
module LanguagePack::Installers; end | ||
|
||
class LanguagePack::Installers::HerokuRubyInstaller | ||
BASE_URL = LanguagePack::Base::VENDOR_URL | ||
BIN_DIR = Pathname("bin") | ||
|
||
def initialize(stack) | ||
@fetcher = LanguagePack::Fetcher.new(BASE_URL, stack) | ||
include LanguagePack::ShellHelpers | ||
attr_reader :fetcher | ||
|
||
def initialize(stack: , multi_arch_stacks: , arch: ) | ||
if multi_arch_stacks.include?(stack) | ||
@fetcher = LanguagePack::Fetcher.new(BASE_URL, stack: stack, arch: arch) | ||
else | ||
@fetcher = LanguagePack::Fetcher.new(BASE_URL, stack: stack) | ||
end | ||
end | ||
|
||
def fetch_unpack(ruby_version, install_dir, build = false) | ||
def install(ruby_version, install_dir) | ||
fetch_unpack(ruby_version, install_dir) | ||
setup_binstubs(install_dir) | ||
end | ||
|
||
def fetch_unpack(ruby_version, install_dir) | ||
FileUtils.mkdir_p(install_dir) | ||
Dir.chdir(install_dir) do | ||
file = "#{ruby_version.version_for_download}.tgz" | ||
if build | ||
file.sub!("ruby", "ruby-build") | ||
@fetcher.fetch_untar("#{ruby_version.version_for_download}.tgz") | ||
end | ||
end | ||
|
||
private def setup_binstubs(install_dir) | ||
BIN_DIR.mkpath | ||
run("ln -s ruby #{install_dir}/bin/ruby.exe") | ||
|
||
install_pathname = Pathname.new(install_dir) | ||
Dir["#{install_dir}/bin/*"].each do |vendor_bin| | ||
# for Ruby 2.6.0+ don't symlink the Bundler bin so our shim works | ||
next if vendor_bin.include?("bundle") | ||
|
||
# The bin/rake binstub generated when compiling ruby does not load bundler | ||
# which can cause unexpected failures. Deleting this binstub allows two things: | ||
# | ||
# - If the app includes a custom binstub allows it to be used | ||
# - If the app does not include a custom binstub, then it will fall back to vendor/bundle/bin/rake | ||
# which is generated by bundler | ||
# | ||
# Discussion: https://github.com/heroku/heroku-buildpack-ruby/issues/1025#issuecomment-653102430 | ||
next if vendor_bin.include?("rake") | ||
|
||
if install_pathname.absolute? | ||
run("ln -s #{vendor_bin} #{BIN_DIR}") | ||
else | ||
run("ln -s ../#{vendor_bin} #{BIN_DIR}") | ||
end | ||
@fetcher.fetch_untar(file) | ||
end | ||
end | ||
end | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.