<commit_before>var fs = require('fs'),
    path = require('path'),
    util = require('util'),
    events = require('cordova-common').events,
    superspawn = require('cordova-common').superspawn,
    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 arrayOfDirectories = [];
    //remove the project from the path
    arrayOfDirectories = pathToProjectFile.split(path.sep);
    arrayOfDirectories.pop();
    var pathToProjectDirectory = arrayOfDirectories.join(path.sep);
    return pathToProjectDirectory;
}

function createPodfile (projectName, pathToProjectFile) {
    var pathToProjectDirectory = removeProjectFromPath(pathToProjectFile);
    var pathToPodfile = path.join(pathToProjectDirectory, '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');<commit_msg>CB-11789 - Generated Podfile should not have an absolute path to .xcodeproj<commit_after>var fs = require('fs'),
    path = require('path'),
    util = require('util'),
    events = require('cordova-common').events,
    superspawn = require('cordova-common').superspawn,
    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 arrayOfDirectories = [];
    //remove the project from the path
    arrayOfDirectories = pathToProjectFile.split(path.sep);
    arrayOfDirectories.pop();
    var pathToProjectDirectory = arrayOfDirectories.join(path.sep);
    return pathToProjectDirectory;
}

function createPodfile (projectName, pathToProjectFile) {
    var pathToProjectDirectory = removeProjectFromPath(pathToProjectFile);
    var projectFileName = pathToProjectFile.split(path.sep).pop();
    var pathToPodfile = path.join(pathToProjectDirectory, 'Podfile');
    var podfileText = util.format('platform :ios, \'8.0\'\n\ntarget \'%s\' do\n\n  project \'%s\'\n\n  \n\nend' , projectName, projectFileName);
    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');
{'fraction_non_alphanumeric': 0.10982487384980706, 'fraction_numerical': 0.003265063817156426, 'mean_word_length': 4.029850746268656, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7578526', 'n_tokens_mistral': 1007, 'n_tokens_neox': 993, 'n_words': 290}