Github user shazron commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/234#discussion_r69504887 --- Diff: bin/templates/scripts/cordova/lib/podMod.js --- @@ -0,0 +1,162 @@ +var fs = require('fs'); +var util = require('util'); +var events = require('cordova-common').events; +var superspawn = require('cordova-common').superspawn; +var CordovaError = require('cordova-common').CordovaError; +var opts = {}; +/* +-- After pods are installed in a .xcworkspace, all existing ios code needs to go into the WORKSPACE file -- will need to + create a workspace file and then embed the Xcode project + + - Holly might have done some work on this, see the docs: + https://github.com/phonegap/phonegap-webview-ios not sure how applicable it can be to our case +*/ +function removeProjectFromPath (pathToProjectFile) { + var array = []; + //remove the project from the path + array = pathToProjectFile.split('/'); + array.pop(); + var path = array.join('/'); + return path; +} + +function createPodfile (projectName, pathToProjectFile) { + var path = removeProjectFromPath(pathToProjectFile); + var pathToPodfile = path + '/Podfile'; + var podfileText = util.format('platform :ios, \'8.0\'\n\ntarget \'%s\' do\n\n project \'%s\'\n\n \n\nend' , projectName, pathToProjectFile); + fs.writeFileSync(pathToPodfile, podfileText); +} + +function editPodfileSync (Podfile, pod, isRemoval) { + var podfileContents = fs.readFileSync(Podfile, 'utf8'); + //split by \n, add in the pod after the project line, shift the rest down + var podfileContentsArray = podfileContents.split('\n'); + var linesInPodfileToKeep = []; + + if (isRemoval) { + podfileContentsArray.forEach (function (lineInPodfile) { --- End diff -- use Array.filter here
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org