Comparing version 5.0.1 to 5.1.0
@@ -37,5 +37,12 @@ #!/usr/bin/env node | ||
// Reading parameters from command line | ||
configHelper.readConfig(process.argv, 'forceios', SDK.version, SDK.appTypes.ios, createApp); | ||
configHelper.readConfig(process.argv, 'forceios', SDK.version, SDK.appTypes.ios, toolsChecker, createApp); | ||
// | ||
// Tools checker | ||
// | ||
function toolsChecker(appType) { | ||
createHelper.checkTools('ios', appType); | ||
} | ||
// | ||
// Helper for 'create' command | ||
@@ -50,6 +57,5 @@ // | ||
createHelper.createApp(config, 'ios', 'XCode'); | ||
} | ||
catch (error) { | ||
utils.logError('forceios create failed\n', error); | ||
utils.logError('forceios failed\n', error); | ||
process.exit(1); | ||
@@ -56,0 +62,0 @@ } |
{ | ||
"name": "forceios", | ||
"version": "5.0.1", | ||
"version": "5.1.0", | ||
"description": "Utilities for creating mobile apps based on the Salesforce Mobile SDK for iOS", | ||
@@ -5,0 +5,0 @@ "keywords": [ "mobilesdk", "ios", "salesforce", "mobile", "sdk" ], |
@@ -35,3 +35,3 @@ /* | ||
function readConfig(args, toolName, toolVersion, appTypes, handler) { | ||
function readConfig(args, toolName, toolVersion, appTypes, toolsChecker, handler) { | ||
var commandLineArgs = args.slice(2, args.length); | ||
@@ -48,3 +48,3 @@ var command = commandLineArgs.shift(); | ||
case 'create': | ||
processorList = createArgsProcessorList(appTypes); | ||
processorList = createArgsProcessorList(appTypes, false, toolsChecker); | ||
break; | ||
@@ -87,3 +87,3 @@ case 'createWithTemplate': | ||
// | ||
function createArgsProcessorList(appTypes, isCreateWithTemplate) { | ||
function createArgsProcessorList(appTypes, isCreateWithTemplate, toolsChecker) { | ||
var argProcessorList = new commandLineUtils.ArgProcessorList(); | ||
@@ -100,3 +100,5 @@ | ||
'App type must be ' + appTypes.join(', ') + '.', | ||
function(val) { return appTypes.indexOf(val) >= 0; }); | ||
function(val) { return appTypes.indexOf(val) >= 0; }, | ||
undefined, | ||
toolsChecker); | ||
} | ||
@@ -103,0 +105,0 @@ |
@@ -28,3 +28,3 @@ /* | ||
var VERSION = '5.0.1'; | ||
var VERSION = '5.1.0'; | ||
@@ -35,2 +35,3 @@ module.exports = { | ||
tools: { | ||
gitMinVersion: '2.10', | ||
npmMinVersion: '3.10', | ||
@@ -41,3 +42,3 @@ podMinVersion: '1.1' | ||
cordova: { | ||
// pluginRepoUri: 'https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin#unstable', // unstable | ||
//pluginRepoUri: 'https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin#dev', // dev | ||
pluginRepoUri: 'https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin#v' + VERSION, // GA | ||
@@ -47,3 +48,3 @@ minimumCliVersion: '6.4.0', | ||
ios: '4.3.0', | ||
android: '6.1.0' | ||
android: '6.1.2' | ||
} | ||
@@ -58,3 +59,3 @@ }, | ||
templates: { | ||
// repoUri: 'https://github.com/forcedotcom/SalesforceMobileSDK-Templates#unstable', // unstable | ||
//repoUri: 'https://github.com/forcedotcom/SalesforceMobileSDK-Templates#dev', // dev | ||
repoUri: 'https://github.com/forcedotcom/SalesforceMobileSDK-Templates#v' + VERSION, // GA | ||
@@ -61,0 +62,0 @@ appTypesToPath: { |
@@ -149,2 +149,32 @@ /* | ||
// | ||
// Check tools | ||
// | ||
function checkTools(platform, appType) { | ||
try { | ||
utils.log("Checking tools"); | ||
var isNative = appType.indexOf('native') >= 0; | ||
// Check git version | ||
utils.checkToolVersion('git --version', SDK.tools.gitMinVersion); | ||
// Check npm version | ||
utils.checkToolVersion('npm -v', SDK.tools.npmMinVersion); | ||
// Check pod version | ||
if (platform === 'ios') { | ||
utils.checkToolVersion('pod --version', SDK.tools.podMinVersion); | ||
} | ||
// Check cordova cli | ||
if (!isNative) { | ||
utils.checkToolVersion('cordova -v', SDK.cordova.minimumCliVersion); | ||
} | ||
} | ||
catch (error) { | ||
utils.logError('Missing tools\n', error); | ||
process.exit(1); | ||
} | ||
} | ||
// | ||
// Helper for 'create' command | ||
@@ -190,16 +220,5 @@ // | ||
// Check npm version | ||
utils.checkToolVersion('npm -v', SDK.tools.npmMinVersion); | ||
// Check pod version | ||
if (config.platform === 'ios') { | ||
utils.checkToolVersion('pod --version', SDK.tools.podMinVersion); | ||
} | ||
// Check cordova cli | ||
if (!isNative) { | ||
utils.checkToolVersion('cordova -v', SDK.cordova.minimumCliVersion); | ||
} | ||
// Check tools | ||
checkTools(config.platform, config.apptype); | ||
// Print details | ||
@@ -220,3 +239,4 @@ printDetails(config); | ||
module.exports = { | ||
createApp | ||
createApp, | ||
checkTools | ||
}; |
@@ -45,3 +45,3 @@ /* | ||
var LOG_LEVEL = LOG_LEVELS.ALL; | ||
var LOG_LEVEL = LOG_LEVELS.INFO; | ||
@@ -87,3 +87,3 @@ /** | ||
* Checks the the version of a tool by running the given command | ||
* | ||
* | ||
* @param {String} cmd Command to run to get the tool version | ||
@@ -99,3 +99,3 @@ * @param {String} minVersionRequired Minimum version required | ||
var result = runProcessThrowError(cmd, null, true /* return output */); | ||
toolVersion = result.replace(/\r?\n|\r/, ''); | ||
toolVersion = result.replace(/\r?\n|\r/, '').replace(/[^0-9\.]*/, ''); | ||
} | ||
@@ -116,3 +116,3 @@ catch (error) { | ||
/** | ||
/** | ||
* Replaces text in a file | ||
@@ -131,3 +131,3 @@ * | ||
fs.writeFileSync(fileName, result, 'utf8'); | ||
fs.writeFileSync(fileName, result, 'utf8'); | ||
} | ||
@@ -144,3 +144,3 @@ | ||
function runProcessThrowError(cmd, dir, returnOutput) { | ||
logDebug('Running: ' + cmd); | ||
logDebug('Running: ' + cmd); | ||
if (dir) shelljs.pushd(dir); | ||
@@ -159,3 +159,3 @@ try { | ||
} | ||
execSync(cmd, {stdio: stdio}); | ||
@@ -225,3 +225,3 @@ } | ||
* Replace string in files. | ||
* | ||
* | ||
* @param {String or RegExp} from String to match. | ||
@@ -241,3 +241,3 @@ * @param {String} to Replacement string. | ||
* Move file or directory. | ||
* | ||
* | ||
* @param {String} from Path of file or directory to move. | ||
@@ -257,3 +257,3 @@ * @param {String} to New path for file or directory. | ||
* Copy recursively. | ||
* | ||
* | ||
* @param {String} from Path of file or directory to move. | ||
@@ -270,3 +270,3 @@ * @param {String} to New path for file or directory. | ||
* Remove file or directory. | ||
* | ||
* | ||
* @param {String} path Path of file or directory to remove. | ||
@@ -297,3 +297,3 @@ */ | ||
shelljs.mkdir('-p', repoDir); | ||
runProcessThrowError('git clone --branch ' + branch + ' --single-branch --depth 1 --recurse-submodules ' + repoUrl + ' ' + repoDir); | ||
runProcessThrowError('git clone --branch ' + branch + ' --single-branch --depth 1 --recurse-submodules ' + repoUrl + ' ' + '"' + repoDir + '"'); | ||
return repoDir; | ||
@@ -356,3 +356,3 @@ } | ||
* Log in color. | ||
* | ||
* | ||
* @param {integer} logLevel Max LOG_LEVEL for which the message should be logged | ||
@@ -359,0 +359,0 @@ * @param {String} msg Message to log. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50877
1038