Skip to content

Commit a47b9d9

Browse files
dpogueshazron
authored andcommitted
CB-11860 - Print a warning if system ruby is not in use
This closes #261
1 parent 0231fcb commit a47b9d9

File tree

1 file changed

+12
-0
lines changed
  • bin/templates/scripts/cordova/lib

1 file changed

+12
-0
lines changed

bin/templates/scripts/cordova/lib/build.js

+12
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,17 @@ module.exports.run = function (buildOpts) {
118118

119119
var buildOutputDir = path.join(projectPath, 'build', 'device');
120120

121+
122+
function checkSystemRuby() {
123+
var ruby_cmd = shell.which('ruby');
124+
125+
if (ruby_cmd != '/usr/bin/ruby') {
126+
events.emit('warn', 'Non-system Ruby in use. This may cause packaging to fail.\n' +
127+
'If you use RVM, please run `rvm use system`.\n' +
128+
'If you use chruby, please run `chruby system`.');
129+
}
130+
}
131+
121132
function packageArchive() {
122133
var xcodearchiveArgs = getXcodeArchiveArgs(projectName, projectPath, buildOutputDir, exportOptionsPath);
123134
return spawn('xcodebuild', xcodearchiveArgs, projectPath);
@@ -148,6 +159,7 @@ module.exports.run = function (buildOpts) {
148159
}
149160

150161
return Q.nfcall(fs.writeFile, exportOptionsPath, exportOptionsPlist, 'utf-8')
162+
.then(checkSystemRuby)
151163
.then(packageArchive)
152164
.then(unpackIPA)
153165
.then(moveApp);

0 commit comments

Comments
 (0)