<commit_before>#!/usr/bin/env node
'use strict';

var fs = require('fs');

var getValue = function(config, name) {
    var value = config.match(new RegExp('<' + name + '>(.*?)</' + name + '>', "i"))
    if(value && value[1]) {
        return value[1]
    } else {
        return null
    }
}

var config = fs.readFileSync("config.xml").toString()
var name = getValue(config, "name")

try {
	var contents = fs.readFileSync("GoogleService-Info.plist").toString();
    fs.writeFileSync("platforms/ios/" + name + "/Resources/GoogleService-Info.plist", contents)
} catch(err) {}

try {
	var contents = fs.readFileSync("google-services.json").toString();
    fs.writeFileSync("platforms/android/google-services.json", contents);

    var json = JSON.parse(contents);
    var strings = fs.readFileSync("platforms/android/res/values/strings.xml").toString();

    // strip non-default value
    strings = strings.replace(new RegExp('<string name="google_app_id">([^@<]+?)</string>', "i"), '')

    // strip empty lines
    strings = strings.replace(new RegExp('(\r\n|\n|\r)[ \t]*(\r\n|\n|\r)', "gm"), '$1')

    // replace the default value
    strings = strings.replace(new RegExp('<string name="google_app_id">([^<]+?)</string>', "i"), '<string name="google_app_id">' + json.client[0].client_info.mobilesdk_app_id + '</string>')

    fs.writeFileSync("platforms/android/res/values/strings.xml", strings);
} catch(err) {}<commit_msg>adds log to script<commit_after>#!/usr/bin/env node
'use strict';

var fs = require('fs');

var getValue = function(config, name) {
    var value = config.match(new RegExp('<' + name + '>(.*?)</' + name + '>', "i"))
    if(value && value[1]) {
        return value[1]
    } else {
        return null
    }
}

var config = fs.readFileSync("config.xml").toString()
var name = getValue(config, "name")

try {
	var contents = fs.readFileSync("GoogleService-Info.plist").toString();
    fs.writeFileSync("platforms/ios/" + name + "/Resources/GoogleService-Info.plist", contents)
} catch(err) {
  process.stdout.write(err);
}

try {
	var contents = fs.readFileSync("google-services.json").toString();
    fs.writeFileSync("platforms/android/google-services.json", contents);

    var json = JSON.parse(contents);
    var strings = fs.readFileSync("platforms/android/res/values/strings.xml").toString();

    // strip non-default value
    strings = strings.replace(new RegExp('<string name="google_app_id">([^@<]+?)</string>', "i"), '')

    // strip empty lines
    strings = strings.replace(new RegExp('(\r\n|\n|\r)[ \t]*(\r\n|\n|\r)', "gm"), '$1')

    // replace the default value
    strings = strings.replace(new RegExp('<string name="google_app_id">([^<]+?)</string>', "i"), '<string name="google_app_id">' + json.client[0].client_info.mobilesdk_app_id + '</string>')

    fs.writeFileSync("platforms/android/res/values/strings.xml", strings);
} catch(err) {
  process.stdout.write(err);
}
{'fraction_non_alphanumeric': 0.2056907781967775, 'fraction_numerical': 0.002742543709290367, 'mean_word_length': 4.065972222222222, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '779847', 'n_tokens_mistral': 977, 'n_tokens_neox': 964, 'n_words': 177}