Skip to content

Commit

Permalink
Remove BUNDLED WITH earlier
Browse files Browse the repository at this point in the history
Because Ruby 2.6.5 ships with Bundler 2 it also includes a check for bundler version and will error if the version does not match. This commit bumps up the logic of when the BUNDLED WITH lines in the Gemfile.lock get removed so they allow the Buildpack to execute correctly.
  • Loading branch information
schneems committed Jan 22, 2020
1 parent 6b7f38c commit 4b3bfc6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 12 additions & 0 deletions lib/language_pack/helpers/bundler_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ def lockfile_parser
def fetch_bundler
instrument 'fetch_bundler' do
return true if Dir.exists?(bundler_path)

topic("Installing bundler #{@version}")
bundler_version_escape_valve!

FileUtils.mkdir_p(bundler_path)
Dir.chdir(bundler_path) do
@fetcher.fetch_untar(@bundler_tar)
Expand Down Expand Up @@ -202,4 +206,12 @@ def detect_bundler_version_and_dir_name!
raise UnsupportedBundlerVersion.new(BLESSED_BUNDLER_VERSIONS, major)
end
end

def bundler_version_escape_valve!
topic("Removing BUNDLED WITH version in the Gemfile.lock")
contents = File.read("Gemfile.lock")
File.open("Gemfile.lock", "w") do |f|
f.write contents.sub(/^BUNDLED WITH$(\r?\n) (?<major>\d+)\.\d+\.\d+/m, '')
end
end
end
6 changes: 0 additions & 6 deletions lib/language_pack/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -783,12 +783,6 @@ def write_bundler_shim(path)
# runs bundler to install the dependencies
def build_bundler(default_bundle_without)
instrument 'ruby.build_bundler' do
topic("Removing BUNDLED WITH version in the Gemfile.lock")
contents = File.read("Gemfile.lock")
File.open("Gemfile.lock", "w") do |f|
f.write contents.sub(/^BUNDLED WITH$(\r?\n) (?<major>\d+)\.\d+\.\d+/m, '')
end

log("bundle") do
bundle_without = env("BUNDLE_WITHOUT") || default_bundle_without
bundle_bin = "bundle"
Expand Down

0 comments on commit 4b3bfc6

Please sign in to comment.