<commit_before>var plist = require('plist'),
    path = require('path'),
    fs = require('fs'),
    Q = require('q');


module.exports = function(grunt) {

    exports.generatePlist = function(abspath, target_filename, options, appOptions) {

        // Handle the INfo.plist file
        var info = plist.parseFileSync(abspath);
        info.CFBundleDisplayName = options.app_name;
        info.CFBundleName = options.app_name;

        info.CFBundleDocumentTypes = []; // zero out any document binding
        info.UTExportedTypeDeclarations = [];

        info.CFBundleVersion = options.app_version; // TODO: if git, get commit hash!
        info.CFBundleShortVersionString = 'Version ' + options.app_version;

        if(appOptions.copyright) {
          info.NSHumanReadableCopyright = appOptions.copyright;
        }

        grunt.file.write(target_filename, plist.build(info));
    };

    exports.getFileList = function(files) {
        var package_path = null, destFiles = [], srcFiles = [], jsonfile = null;

        files.forEach(function(file) {

            file.src.filter(function(f) {
                return grunt.file.isFile(f);

            }).forEach(function(srcFile) {
                var internalFileName = path.normalize(exports.unixifyPath(srcFile));

                // Get Package JSON
                if (internalFileName.match('package.json')) {
                    jsonfile = exports.closerPathDepth(internalFileName, jsonfile);
                    package_path = path.normalize(jsonfile.split('package.json')[0] || './' );
                }

                srcFiles.push(internalFileName);
            });
        });

        // Fail if there is no valid json file
        if(!jsonfile) {
            grunt.fail.warn('Could not find a package.json in your src folder');
        }

        // Make it easy for copy to understand the destination mapping
        srcFiles.forEach(function(file) {
            destFiles.push({src:file, dest: file.replace(package_path, '')});
        });

        // We return it as an array
        return [destFiles, jsonfile];
    };
<commit_msg>fix bug copy file #84<commit_after>var plist = require('plist'),
    path = require('path'),
    fs = require('fs'),
    Q = require('q');


module.exports = function(grunt) {

    exports.generatePlist = function(abspath, target_filename, options, appOptions) {

        // Handle the INfo.plist file
        var info = plist.parseFileSync(abspath);
        info.CFBundleDisplayName = options.app_name;
        info.CFBundleName = options.app_name;

        info.CFBundleDocumentTypes = []; // zero out any document binding
        info.UTExportedTypeDeclarations = [];

        info.CFBundleVersion = options.app_version; // TODO: if git, get commit hash!
        info.CFBundleShortVersionString = 'Version ' + options.app_version;

        if(appOptions.copyright) {
          info.NSHumanReadableCopyright = appOptions.copyright;
        }

        grunt.file.write(target_filename, plist.build(info));
    };

    exports.getFileList = function(files) {
        var package_path = null, destFiles = [], srcFiles = [], jsonfile = null;

        files.forEach(function(file) {

            file.src.filter(function(f) {
                return grunt.file.isFile(f);

            }).forEach(function(srcFile) {
                var internalFileName = path.normalize(exports.unixifyPath(srcFile));

                // Get Package JSON
                if (internalFileName.match('package.json')) {
                    jsonfile = exports.closerPathDepth(internalFileName, jsonfile);
                    package_path = path.normalize(jsonfile.split('package.json')[0] || './' );
                }

                srcFiles.push(internalFileName);
            });
        });

        // Fail if there is no valid json file
        if(!jsonfile) {
            grunt.fail.warn('Could not find a package.json in your src folder');
        }

        // Make it easy for copy to understand the destination mapping
        srcFiles.forEach(function(file) {
            var _file = file,
                firstDirOfFile = file.split('/')[0];
            if( package_path == firstDirOfFile || package_path == '/'+firstDirOfFile || package_path == firstDirOfFile+'/' ) {
                _file = file.replace(package_path, '');
            }
            destFiles.push({src:file, dest: _file});
        });

        // We return it as an array
        return [destFiles, jsonfile];
    };

{'fraction_non_alphanumeric': 0.11834187653220414, 'fraction_numerical': 0.0011143302874972142, 'mean_word_length': 2.151685393258427, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '4396405', 'n_tokens_mistral': 1253, 'n_tokens_neox': 1199, 'n_words': 256}