-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstallios.js
executable file
·23 lines (18 loc) · 953 Bytes
/
installios.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env node
var packageJson = require('./package.json')
var execSync = require('child_process').execSync;
var path = require('path');
var fs = require('fs');
console.log('Installing sdk dependencies');
var sdkDependency = 'SalesforceMobileSDK-iOS';
var repoUrlWithBranch = packageJson.sdkDependencies[sdkDependency];
var parts = repoUrlWithBranch.split('#'), repoUrl = parts[0], branch = parts.length > 1 ? parts[1] : 'master';
var targetDir = path.join('mobile_sdk', sdkDependency);
if (fs.existsSync(targetDir))
console.log(targetDir + ' already exists - if you want to refresh it, please remove it and re-run install.js');
else
execSync('git clone --branch ' + branch + ' --single-branch --depth 1 ' + repoUrl + ' ' + targetDir, {stdio:[0,1,2]});
console.log('Installing npm dependencies');
execSync('npm install', {stdio:[0,1,2]});
console.log('Installing pod dependencies');
execSync('pod update', {stdio:[0,1,2], cwd:'ios'});