@@ -2,6 +2,7 @@ const os = require('os')
22const fs = require ( 'fs' )
33const path = require ( 'path' )
44const core = require ( '@actions/core' )
5+ const exec = require ( '@actions/exec' )
56
67export async function run ( ) {
78 try {
@@ -23,6 +24,9 @@ export async function run() {
2324 const [ rubyPrefix , newPathEntries ] = await installer . install ( platform , ruby )
2425
2526 setupPath ( ruby , newPathEntries )
27+
28+ await installBundler ( platform , rubyPrefix )
29+
2630 core . setOutput ( 'ruby-prefix' , rubyPrefix )
2731 } catch ( error ) {
2832 core . setFailed ( error . message )
@@ -107,6 +111,14 @@ function setupPath(ruby, newPathEntries) {
107111 core . exportVariable ( 'PATH' , [ ...newPathEntries , ...cleanPath ] . join ( path . delimiter ) )
108112}
109113
114+ async function installBundler ( platform , rubyPrefix ) {
115+ const bundle_exe = platform === 'windows-latest' ? 'bundle.cmd' : 'bundle'
116+ // Install Bundler if not already part of the stdlib
117+ if ( ! fs . existsSync ( path . join ( rubyPrefix , 'bin' , bundle_exe ) ) ) {
118+ await exec . exec ( path . join ( rubyPrefix , 'bin' , 'gem' ) , [ 'install' , 'bundler' , '-v' , '~> 1' , '--no-document' ] )
119+ }
120+ }
121+
110122function getVirtualEnvironmentName ( ) {
111123 const platform = os . platform ( )
112124 if ( platform === 'linux' ) {
0 commit comments