Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var appName = path.basename($projectData.projectDir);
var sanitizedName = appName.split('').filter(function(c) { return /[a-zA-Z0-9]/.test(c); }).join('');
var projectPath = path.join($projectData.projectDir, 'platforms', 'ios', sanitizedName + '.xcodeproj', 'project.pbxproj');
var plistPath = path.join($projectData.projectDir, 'platforms', 'ios', sanitizedName, sanitizedName + '-Info.plist');
var podsPath = path.join($projectData.projectDir, 'platforms', 'ios', 'Pods');
$logger.trace('Using Xcode project', projectPath);
$logger.trace('Using Info plist', plistPath);
$logger.trace('Using Pods path', podsPath);
var xcodeProject = xcode.project(projectPath);
xcodeProject.parseSync();
var options = { shellPath: '/bin/sh', shellScript: podsPath + '/Fabric/run ' + apiKey + ' ' + apiSecret };
var buildPhase = xcodeProject.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Configure Fabric', xcodeProject.getFirstTarget().uuid, options).buildPhase;
$logger.trace('Written Xcode project');
fs.writeFileSync(projectPath, xcodeProject.writeSync());
var appPlist = plist.readFileSync(plistPath);
plist.Fabric = {
APIKey: apiKey,
Kits: [{
KitInfo: '',
KiteName: 'Crashlytics'
}, {
KitInfo: '',
KiteName: 'Answers'
}]
}
plist.writeFileSync(plistPath, appPlist);
$logger.trace('Written Info plist');
resolve();
} else if (platform == 'windows') {
//TODO PRs gladly accepted :P
reject();
}