Fixes #167 - On El Cap, detect Xcode 7 properly installed

This commit is contained in:
Shazron Abdullah 2015-10-06 17:46:50 -07:00
parent 55d076b805
commit 6aa7b57014
2 changed files with 40 additions and 3 deletions

32
check_reqs.js Executable file
View File

@ -0,0 +1,32 @@
#!/usr/bin/env node
var shell = require('shelljs');
var util = require('util');
var os = require('os');
var XCODEBUILD_MIN_VERSION = '6.4';
var XCODEBUILD_NOT_FOUND_MESSAGE =
'Please install Xcode version ' + XCODEBUILD_MIN_VERSION + ' or greater from App Store';
var tool = 'xcodebuild'
var tool_command = shell.which(tool);
if (!tool_command) {
console.log(tool + ' : ' + XCODEBUILD_NOT_FOUND_MESSAGE);
process.exit(1);
}
shell.exec(tool + ' -version', { silent: true }, function(code, output) {
if (code === 0) {
var arr = output.match(/^Xcode (\d+\.\d+)/);
var ver = arr[1];
if (os.release() >= '15.0.0' && ver < '7.0') {
console.log(util.format('You need at least Xcode 7.0 on OS X 10.11 El Capitan (you have version %s)', ver));
process.exit(1);
}
if (ver < XCODEBUILD_MIN_VERSION) {
console.log(util.format('%s : %s. (you have version %s)', tool, XCODEBUILD_NOT_FOUND_MESSAGE, ver));
}
}
});

View File

@ -1,17 +1,22 @@
{
"name": "ios-deploy",
"version": "1.8.0",
"os" : [ "darwin" ],
"os": [
"darwin"
],
"description": "launch iOS apps iOS devices from the command line (Xcode 7)",
"main": "ios-deploy",
"scripts": {
"preinstall": "make ios-deploy"
"preinstall": "./check_reqs.js && make ios-deploy"
},
"bin" : "./ios-deploy" ,
"bin": "./ios-deploy",
"repository": {
"type": "git",
"url": "https://github.com/phonegap/ios-deploy"
},
"dependencies": {
"shelljs": "^0.2.6"
},
"keywords": [
"ios-deploy",
"deploy to iOS device"