@@ -2,6 +2,7 @@ const os = require('os')
2
2
const fs = require ( 'fs' )
3
3
const path = require ( 'path' )
4
4
const core = require ( '@actions/core' )
5
+ const exec = require ( '@actions/exec' )
5
6
6
7
export async function run ( ) {
7
8
try {
@@ -23,6 +24,9 @@ export async function run() {
23
24
const [ rubyPrefix , newPathEntries ] = await installer . install ( platform , ruby )
24
25
25
26
setupPath ( ruby , newPathEntries )
27
+
28
+ await installBundler ( platform , rubyPrefix )
29
+
26
30
core . setOutput ( 'ruby-prefix' , rubyPrefix )
27
31
} catch ( error ) {
28
32
core . setFailed ( error . message )
@@ -107,6 +111,14 @@ function setupPath(ruby, newPathEntries) {
107
111
core . exportVariable ( 'PATH' , [ ...newPathEntries , ...cleanPath ] . join ( path . delimiter ) )
108
112
}
109
113
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
+
110
122
function getVirtualEnvironmentName ( ) {
111
123
const platform = os . platform ( )
112
124
if ( platform === 'linux' ) {
0 commit comments