88 "os/exec"
99 "path/filepath"
1010
11- "reflect"
12-
1311 "github.com/cloudfoundry/ruby-buildpack/src/ruby/cache"
1412 "github.com/cloudfoundry/ruby-buildpack/src/ruby/supply"
1513
@@ -481,32 +479,13 @@ var _ = Describe("Supply", func() {
481479
482480 const windowsWarning = "**WARNING** Windows line endings detected in Gemfile. Your app may fail to stage. Please use UNIX line endings."
483481
484- handleBundleBinstubRegeneration := func (cmd * exec.Cmd ) error {
485- if len (cmd .Args ) > 5 && reflect .DeepEqual (cmd .Args [0 :5 ], []string {"bundle" , "binstubs" , "bundler" , "--force" , "--path" }) {
486- Expect (cmd .Args [5 ]).To (HavePrefix (filepath .Join (depsDir , depsIdx )))
487- Expect (os .MkdirAll (cmd .Args [5 ], 0755 )).To (Succeed ())
488- Expect (os .WriteFile (filepath .Join (cmd .Args [5 ], "bundle" ), []byte ("new bundle binstub" ), 0644 )).To (Succeed ())
489- }
490- return nil
491- }
492-
493- itRegeneratesBundleBinstub := func () {
494- It ("Re-generates the bundler binstub to replace older, rails-generated ones that are incompatible with bundler > 1.16.0" , func () {
495- Expect (supplier .InstallGems ()).To (Succeed ())
496- Expect (os .ReadFile (filepath .Join (depsDir , depsIdx , "binstubs" , "bundle" ))).To (Equal ([]byte ("new bundle binstub" )))
497- Expect (os .ReadFile (filepath .Join (depsDir , depsIdx , "bin" , "bundle" ))).To (Equal ([]byte ("new bundle binstub" )))
498- })
499- }
500-
501482 Context ("Windows Gemfile" , func () {
502483 BeforeEach (func () {
503484 mockVersions .EXPECT ().HasWindowsGemfileLock ().Return (false , nil )
504- mockCommand .EXPECT ().Run (gomock .Any ()).AnyTimes (). Do ( handleBundleBinstubRegeneration )
485+ mockCommand .EXPECT ().Run (gomock .Any ()).AnyTimes ()
505486 Expect (os .WriteFile (filepath .Join (buildDir , "Gemfile" ), []byte ("source \" https://rubygems.org\" \r \n gem \" rack\" \r \n " ), 0644 )).To (Succeed ())
506487 })
507488
508- itRegeneratesBundleBinstub ()
509-
510489 It ("Warns the user" , func () {
511490 Expect (supplier .InstallGems ()).To (Succeed ())
512491 Expect (buffer .String ()).To (ContainSubstring (windowsWarning ))
@@ -521,10 +500,7 @@ var _ = Describe("Supply", func() {
521500 if len (cmd .Args ) > 2 && cmd .Args [1 ] == "install" {
522501 Expect (os .MkdirAll (filepath .Join (cmd .Dir , ".bundle" ), 0755 )).To (Succeed ())
523502 Expect (os .WriteFile (filepath .Join (cmd .Dir , ".bundle" , "config" ), []byte ("new bundle config" ), 0644 )).To (Succeed ())
524- } else {
525- return handleBundleBinstubRegeneration (cmd )
526503 }
527-
528504 return nil
529505 })
530506 Expect (os .WriteFile (filepath .Join (buildDir , "Gemfile" ), []byte ("source \" https://rubygems.org\" \n gem \" rack\" \n " ), 0644 )).To (Succeed ())
@@ -534,8 +510,6 @@ var _ = Describe("Supply", func() {
534510 os .Unsetenv ("BUNDLE_CONFIG" )
535511 })
536512
537- itRegeneratesBundleBinstub ()
538-
539513 It ("Does not warn the user" , func () {
540514 Expect (supplier .InstallGems ()).To (Succeed ())
541515 Expect (buffer .String ()).ToNot (ContainSubstring (windowsWarning ))
@@ -572,8 +546,6 @@ var _ = Describe("Supply", func() {
572546 if cmd .Args [1 ] == "install" {
573547 Expect (filepath .Join (cmd .Dir , "Gemfile" )).To (BeAnExistingFile ())
574548 Expect (filepath .Join (cmd .Dir , "Gemfile.lock" )).To (BeAnExistingFile ())
575- } else {
576- handleBundleBinstubRegeneration (cmd )
577549 }
578550 })
579551 Expect (supplier .InstallGems ()).To (Succeed ())
@@ -588,8 +560,6 @@ var _ = Describe("Supply", func() {
588560 if cmd .Args [1 ] == "install" {
589561 Expect (cmd .Dir ).ToNot (Equal (buildDir ))
590562 installCalled = true
591- } else {
592- handleBundleBinstubRegeneration (cmd )
593563 }
594564 })
595565 Expect (supplier .InstallGems ()).To (Succeed ())
@@ -614,8 +584,6 @@ var _ = Describe("Supply", func() {
614584 Expect (filepath .Join (cmd .Dir , "Gemfile" )).To (BeAnExistingFile ())
615585 Expect (filepath .Join (cmd .Dir , "Gemfile.lock" )).ToNot (BeAnExistingFile ())
616586 Expect (os .WriteFile (filepath .Join (cmd .Dir , "Gemfile.lock" ), []byte (newGemfileLock ), 0644 )).To (Succeed ())
617- } else {
618- handleBundleBinstubRegeneration (cmd )
619587 }
620588 })
621589 Expect (supplier .InstallGems ()).To (Succeed ())
@@ -630,8 +598,6 @@ var _ = Describe("Supply", func() {
630598 if cmd .Args [1 ] == "install" {
631599 Expect (cmd .Dir ).ToNot (Equal (buildDir ))
632600 installCalled = true
633- } else {
634- handleBundleBinstubRegeneration (cmd )
635601 }
636602 })
637603 Expect (supplier .InstallGems ()).To (Succeed ())
0 commit comments