@@ -213,14 +213,26 @@ async function installBundler(bundlerVersionInput, platform, rubyPrefix, engine,
213213}
214214
215215async function bundleInstall ( platform , engine , version ) {
216- if ( ! fs . existsSync ( 'Gemfile' ) ) {
217- console . log ( 'No Gemfile, skipping "bundle install" and caching' )
218- return
216+ if ( await bundleInstallSpecific ( 'gems.rb' , 'gems.locked' , platform , engine , version ) ) {
217+ return true
218+ }
219+
220+ if ( await bundleInstallSpecific ( 'Gemfile' , 'Gemfile.lock' , platform , engine , version ) ) {
221+ return true
222+ }
223+
224+ console . log ( 'No Gemfile/gems.rb, skipping "bundle install" and caching' )
225+ }
226+
227+ async function bundleInstallSpecific ( gemsPath , lockPath , platform , engine , version ) {
228+ if ( ! fs . existsSync ( gemsPath ) ) {
229+ return false
219230 }
220231
221232 // config
222233 const path = 'vendor/bundle'
223- const hasGemfileLock = fs . existsSync ( 'Gemfile.lock' ) ;
234+ const hasGemfileLock = fs . existsSync ( lockPath )
235+
224236 if ( hasGemfileLock ) {
225237 await exec . exec ( 'bundle' , [ 'config' , '--local' , 'deployment' , 'true' ] )
226238 }
@@ -232,9 +244,9 @@ async function bundleInstall(platform, engine, version) {
232244 let key = baseKey
233245 let restoreKeys
234246 if ( hasGemfileLock ) {
235- key += `-Gemfile.lock -${ await common . hashFile ( 'Gemfile.lock' ) } `
247+ key += `-${ lockPath } -${ await common . hashFile ( lockPath ) } `
236248 // If only Gemfile.lock we can reuse some of the cache (but it will keep old gem versions in the cache)
237- restoreKeys = [ `${ baseKey } -Gemfile.lock -` ]
249+ restoreKeys = [ `${ baseKey } -${ lockPath } -` ]
238250 } else {
239251 // Only exact key, to never mix native gems of different platforms or Ruby versions
240252 restoreKeys = [ ]
0 commit comments