Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions fixtures/default/rails7/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,14 @@ GEM
drb (2.2.3)
erb (6.0.1)
erubi (1.13.1)
ffi (1.17.3-aarch64-linux-gnu)
ffi (1.17.3-aarch64-linux-musl)
ffi (1.17.3-arm-linux-gnu)
ffi (1.17.3-arm-linux-musl)
ffi (1.17.3-arm64-darwin)
ffi (1.17.3-x86_64-darwin)
ffi (1.17.3-x86_64-linux-gnu)
ffi (1.17.3-x86_64-linux-musl)
globalid (1.3.0)
activesupport (>= 6.1)
i18n (1.14.8)
Expand Down Expand Up @@ -120,12 +127,26 @@ GEM
net-smtp (0.5.1)
net-protocol
nio4r (2.7.5)
nokogiri (1.19.0-aarch64-linux-gnu)
racc (~> 1.4)
nokogiri (1.19.0-aarch64-linux-musl)
racc (~> 1.4)
nokogiri (1.19.0-arm-linux-gnu)
racc (~> 1.4)
nokogiri (1.19.0-arm-linux-musl)
racc (~> 1.4)
nokogiri (1.19.0-arm64-darwin)
racc (~> 1.4)
nokogiri (1.19.0-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.19.0-x86_64-linux-gnu)
racc (~> 1.4)
nokogiri (1.19.0-x86_64-linux-musl)
racc (~> 1.4)
pp (0.6.3)
prettyprint
prettyprint (0.2.0)
prism (1.8.0)
prism (1.9.0)
psych (5.3.1)
date
stringio
Expand Down Expand Up @@ -220,7 +241,14 @@ GEM
zeitwerk (2.7.4)

PLATFORMS
x86_64-linux
aarch64-linux-gnu
aarch64-linux-musl
arm-linux-gnu
arm-linux-musl
arm64-darwin
x86_64-darwin
x86_64-linux-gnu
x86_64-linux-musl

DEPENDENCIES
puma (~> 6.0)
Expand All @@ -232,4 +260,4 @@ RUBY VERSION
ruby 3.2.9p265

BUNDLED WITH
2.4.19
2.7.2
37 changes: 23 additions & 14 deletions fixtures/default/relative_gemspec_path/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,34 @@ PATH
GEM
remote: https://rubygems.org/
specs:
mustermann (3.0.0)
base64 (0.3.0)
logger (1.7.0)
mustermann (3.0.4)
ruby2_keywords (~> 0.0.1)
rack (2.2.8)
rack-protection (3.0.6)
rack
rackup (1.0.1)
rack (< 3)
webrick
rack (3.2.4)
rack-protection (4.2.1)
base64 (>= 0.1.0)
logger (>= 1.6.0)
rack (>= 3.0.0, < 4)
rack-session (2.1.1)
base64 (>= 0.1.0)
rack (>= 3.0.0)
rackup (2.3.1)
rack (>= 3)
ruby2_keywords (0.0.5)
sinatra (3.0.6)
sinatra (4.2.1)
logger (>= 1.6.0)
mustermann (~> 3.0)
rack (~> 2.2, >= 2.2.4)
rack-protection (= 3.0.6)
rack (>= 3.0.0, < 4)
rack-protection (= 4.2.1)
rack-session (>= 2.0.0, < 3)
tilt (~> 2.0)
tilt (2.2.0)
webrick (1.8.1)
tilt (2.7.0)
webrick (1.9.2)

PLATFORMS
ruby
x86_64-linux

DEPENDENCIES
hola!
Expand All @@ -33,7 +42,7 @@ DEPENDENCIES
webrick

RUBY VERSION
ruby 3.2.0p0
ruby 3.2.9p265

BUNDLED WITH
2.4.1
2.7.2
37 changes: 23 additions & 14 deletions fixtures/default/specified_ruby_version/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,33 +1,42 @@
GEM
remote: https://rubygems.org/
specs:
mustermann (3.0.0)
base64 (0.3.0)
logger (1.7.0)
mustermann (3.0.4)
ruby2_keywords (~> 0.0.1)
rack (2.2.8)
rack-protection (3.1.0)
rack (~> 2.2, >= 2.2.4)
rackup (1.0.1)
rack (< 3)
webrick
rack (3.2.4)
rack-protection (4.2.1)
base64 (>= 0.1.0)
logger (>= 1.6.0)
rack (>= 3.0.0, < 4)
rack-session (2.1.1)
base64 (>= 0.1.0)
rack (>= 3.0.0)
rackup (2.3.1)
rack (>= 3)
ruby2_keywords (0.0.5)
sinatra (3.1.0)
sinatra (4.2.1)
logger (>= 1.6.0)
mustermann (~> 3.0)
rack (~> 2.2, >= 2.2.4)
rack-protection (= 3.1.0)
rack (>= 3.0.0, < 4)
rack-protection (= 4.2.1)
rack-session (>= 2.0.0, < 3)
tilt (~> 2.0)
tilt (2.3.0)
webrick (1.8.1)
tilt (2.7.0)
webrick (1.9.2)

PLATFORMS
ruby
x86_64-linux

DEPENDENCIES
rackup
sinatra
webrick

RUBY VERSION
ruby 3.2.0p0
ruby 3.2.9p265

BUNDLED WITH
2.4.1
2.7.2
37 changes: 23 additions & 14 deletions fixtures/multibuildpack/ruby_calls_go/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,33 +1,42 @@
GEM
remote: https://rubygems.org/
specs:
mustermann (3.0.0)
base64 (0.3.0)
logger (1.7.0)
mustermann (3.0.4)
ruby2_keywords (~> 0.0.1)
rack (2.2.8)
rack-protection (3.1.0)
rack (~> 2.2, >= 2.2.4)
rackup (1.0.1)
rack (< 3)
webrick
rack (3.2.4)
rack-protection (4.2.1)
base64 (>= 0.1.0)
logger (>= 1.6.0)
rack (>= 3.0.0, < 4)
rack-session (2.1.1)
base64 (>= 0.1.0)
rack (>= 3.0.0)
rackup (2.3.1)
rack (>= 3)
ruby2_keywords (0.0.5)
sinatra (3.1.0)
sinatra (4.2.1)
logger (>= 1.6.0)
mustermann (~> 3.0)
rack (~> 2.2, >= 2.2.4)
rack-protection (= 3.1.0)
rack (>= 3.0.0, < 4)
rack-protection (= 4.2.1)
rack-session (>= 2.0.0, < 3)
tilt (~> 2.0)
tilt (2.3.0)
webrick (1.8.1)
tilt (2.7.0)
webrick (1.9.2)

PLATFORMS
ruby
x86_64-linux

DEPENDENCIES
rackup
sinatra
webrick

RUBY VERSION
ruby 3.4.2p28
ruby 3.2.9p265

BUNDLED WITH
2.6.2
2.7.2
10 changes: 8 additions & 2 deletions manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ dependency_deprecation_dates:
name: node
date: 2025-04-30
link: https://github.com/nodejs/Release

- version_line: 3.2.x
name: ruby
date: 2026-03-31
Expand All @@ -33,6 +32,14 @@ dependencies:
- cflinuxfs3
source: https://github.com/rubygems/rubygems/tree/master/bundlertree/v2.6.5
source_sha256: 9d0eef5779ee569c43f317484f034081f58e9cf7529af6cd59d15266e46a72a3
- name: bundler
version: 2.7.2
uri: https://buildpacks.cloudfoundry.org/dependencies/bundler/bundler_2.7.2_linux_noarch_any-stack_54c53519.tgz
sha256: 54c53519ff41ac0ad0d498086039f6ee2eac5d1bdef5ad31ab33e8ab2c2b1e21
cf_stacks:
- cflinuxfs4
source: https://github.com/rubygems/rubygems/tree/master/bundlertree/v2.7.2
source_sha256: 1decaf9e2e1acb91b6586a2925c8f3f6da2334a82731a62ff2ded1b83c283871
- name: jruby
version: 9.4.8.0
uri: https://buildpacks.cloudfoundry.org/dependencies/jruby/jruby_9.4.8.0-ruby-3.1_linux_x64_cflinuxfs3_70896f95.tgz
Expand Down Expand Up @@ -74,7 +81,6 @@ dependencies:
- cflinuxfs4
source: https://java-buildpack.cloudfoundry.org/openjdk-jdk/bionic/x86_64/openjdk-jdk-1.8.0_242-bionic.tar.gz
source_sha256: dcb9fea2fc3a9b003031874ed17aa5d5a7ebbe397b276ecc8c814633003928fe

- name: ruby
version: 3.2.8
uri: https://buildpacks.cloudfoundry.org/dependencies/ruby/ruby_3.2.8_linux_x64_cflinuxfs3_f36a7c8d.tgz
Expand Down
16 changes: 0 additions & 16 deletions src/ruby/supply/supply.go
Original file line number Diff line number Diff line change
Expand Up @@ -768,10 +768,6 @@ func (s *Supplier) InstallGems() error {
return err
}

if err := s.regenerateBundlerBinStub(tempDir); err != nil {
return err
}

s.Log.Info("Cleaning up the bundler cache.")
cmd = exec.Command("bundle", "clean")
cmd.Dir = tempDir
Expand Down Expand Up @@ -845,18 +841,6 @@ func (s *Supplier) removeIncompatibleBundledWithVersion(bundledWithVersion strin
return os.WriteFile(gemfileLockPath, output, 0666)
}

func (s *Supplier) regenerateBundlerBinStub(appDir string) error {
s.Log.BeginStep("Regenerating bundler binstubs...")
cmd := exec.Command("bundle", "binstubs", "bundler", "--force", "--path", filepath.Join(s.Stager.DepDir(), "binstubs"))
cmd.Dir = appDir
cmd.Stdout = text.NewIndentWriter(os.Stdout, []byte(" "))
cmd.Stderr = text.NewIndentWriter(os.Stderr, []byte(" "))
if err := s.Command.Run(cmd); err != nil {
return err
}
return libbuildpack.CopyFile(filepath.Join(s.Stager.DepDir(), "binstubs", "bundle"), filepath.Join(s.Stager.DepDir(), "bin", "bundle"))
}

func (s *Supplier) EnableLDLibraryPathEnv() error {
if exists, err := libbuildpack.FileExists(filepath.Join(s.Stager.BuildDir(), "ld_library_path")); err != nil {
return err
Expand Down
36 changes: 1 addition & 35 deletions src/ruby/supply/supply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import (
"os/exec"
"path/filepath"

"reflect"

"github.com/cloudfoundry/ruby-buildpack/src/ruby/cache"
"github.com/cloudfoundry/ruby-buildpack/src/ruby/supply"

Expand Down Expand Up @@ -481,32 +479,13 @@ var _ = Describe("Supply", func() {

const windowsWarning = "**WARNING** Windows line endings detected in Gemfile. Your app may fail to stage. Please use UNIX line endings."

handleBundleBinstubRegeneration := func(cmd *exec.Cmd) error {
if len(cmd.Args) > 5 && reflect.DeepEqual(cmd.Args[0:5], []string{"bundle", "binstubs", "bundler", "--force", "--path"}) {
Expect(cmd.Args[5]).To(HavePrefix(filepath.Join(depsDir, depsIdx)))
Expect(os.MkdirAll(cmd.Args[5], 0755)).To(Succeed())
Expect(os.WriteFile(filepath.Join(cmd.Args[5], "bundle"), []byte("new bundle binstub"), 0644)).To(Succeed())
}
return nil
}

itRegeneratesBundleBinstub := func() {
It("Re-generates the bundler binstub to replace older, rails-generated ones that are incompatible with bundler > 1.16.0", func() {
Expect(supplier.InstallGems()).To(Succeed())
Expect(os.ReadFile(filepath.Join(depsDir, depsIdx, "binstubs", "bundle"))).To(Equal([]byte("new bundle binstub")))
Expect(os.ReadFile(filepath.Join(depsDir, depsIdx, "bin", "bundle"))).To(Equal([]byte("new bundle binstub")))
})
}

Context("Windows Gemfile", func() {
BeforeEach(func() {
mockVersions.EXPECT().HasWindowsGemfileLock().Return(false, nil)
mockCommand.EXPECT().Run(gomock.Any()).AnyTimes().Do(handleBundleBinstubRegeneration)
mockCommand.EXPECT().Run(gomock.Any()).AnyTimes()
Expect(os.WriteFile(filepath.Join(buildDir, "Gemfile"), []byte("source \"https://rubygems.org\"\r\ngem \"rack\"\r\n"), 0644)).To(Succeed())
})

itRegeneratesBundleBinstub()

It("Warns the user", func() {
Expect(supplier.InstallGems()).To(Succeed())
Expect(buffer.String()).To(ContainSubstring(windowsWarning))
Expand All @@ -521,10 +500,7 @@ var _ = Describe("Supply", func() {
if len(cmd.Args) > 2 && cmd.Args[1] == "install" {
Expect(os.MkdirAll(filepath.Join(cmd.Dir, ".bundle"), 0755)).To(Succeed())
Expect(os.WriteFile(filepath.Join(cmd.Dir, ".bundle", "config"), []byte("new bundle config"), 0644)).To(Succeed())
} else {
return handleBundleBinstubRegeneration(cmd)
}

return nil
})
Expect(os.WriteFile(filepath.Join(buildDir, "Gemfile"), []byte("source \"https://rubygems.org\"\ngem \"rack\"\n"), 0644)).To(Succeed())
Expand All @@ -534,8 +510,6 @@ var _ = Describe("Supply", func() {
os.Unsetenv("BUNDLE_CONFIG")
})

itRegeneratesBundleBinstub()

It("Does not warn the user", func() {
Expect(supplier.InstallGems()).To(Succeed())
Expect(buffer.String()).ToNot(ContainSubstring(windowsWarning))
Expand Down Expand Up @@ -572,8 +546,6 @@ var _ = Describe("Supply", func() {
if cmd.Args[1] == "install" {
Expect(filepath.Join(cmd.Dir, "Gemfile")).To(BeAnExistingFile())
Expect(filepath.Join(cmd.Dir, "Gemfile.lock")).To(BeAnExistingFile())
} else {
handleBundleBinstubRegeneration(cmd)
}
})
Expect(supplier.InstallGems()).To(Succeed())
Expand All @@ -588,8 +560,6 @@ var _ = Describe("Supply", func() {
if cmd.Args[1] == "install" {
Expect(cmd.Dir).ToNot(Equal(buildDir))
installCalled = true
} else {
handleBundleBinstubRegeneration(cmd)
}
})
Expect(supplier.InstallGems()).To(Succeed())
Expand All @@ -614,8 +584,6 @@ var _ = Describe("Supply", func() {
Expect(filepath.Join(cmd.Dir, "Gemfile")).To(BeAnExistingFile())
Expect(filepath.Join(cmd.Dir, "Gemfile.lock")).ToNot(BeAnExistingFile())
Expect(os.WriteFile(filepath.Join(cmd.Dir, "Gemfile.lock"), []byte(newGemfileLock), 0644)).To(Succeed())
} else {
handleBundleBinstubRegeneration(cmd)
}
})
Expect(supplier.InstallGems()).To(Succeed())
Expand All @@ -630,8 +598,6 @@ var _ = Describe("Supply", func() {
if cmd.Args[1] == "install" {
Expect(cmd.Dir).ToNot(Equal(buildDir))
installCalled = true
} else {
handleBundleBinstubRegeneration(cmd)
}
})
Expect(supplier.InstallGems()).To(Succeed())
Expand Down
Loading