<commit_before>/*
 * grunt-synchard
 * https://github.com/reidransom/grunt-synchard
 *
 * Copyright (c) 2013 <NAME>
 * Licensed under the MIT license.
 */

'use strict'

var rsync = require('rsyncwrapper').rsync

function clone(obj) {
    return JSON.parse(JSON.stringify(obj))
}

module.exports = function(grunt) {

    // Please see the Grunt documentation for more information regarding task
    // creation: http://gruntjs.com/creating-tasks

    grunt.registerMultiTask('synchard', 'rsync task handler.', function() {
        
        // Merge task-specific and/or target-specific options with these defaults.
        var done = this.async(),
            options = this.options({
                args: ['--archive']
            })

        // Iterate over all specified file groups.
        this.files.forEach(function(f) {
            
            var grpoptions = clone(options)
            grpoptions.src = []
            grpoptions.dest = './' + f.dest

            // Concat specified files.
            f.src.filter(function(filepath) {
                // Warn on and remove invalid source files (if nonull was set).
                if (!grunt.file.exists(filepath)) {
                    grunt.log.warn('Source file "' + filepath + '" not found.')
                    return false
                }
                else {
                    grpoptions.src.push('./' + filepath)
                    return true
                }
            })
            // Write the destination file.
            if (!grunt.file.exists(grpoptions.dest)) {
                grunt.file.mkdir(grpoptions.dest, '0755')
            }
            rsync(grpoptions, function(error, stdout, stderr, cmd) {
                grunt.log.writeln(cmd)
                grunt.log.writeln(stdout)
                if (error) {
                    grunt.log.warn(stderr)
                    done(false)
                }
                else {
                    done(true)
                }
            })
        })
    
    })

}<commit_msg>trim whitespace on rsync stdout<commit_after>/*
 * grunt-synchard
 * https://github.com/reidransom/grunt-synchard
 *
 * Copyright (c) 2013 <NAME>
 * Licensed under the MIT license.
 */

'use strict'

var rsync = require('rsyncwrapper').rsync

function clone(obj) {
    return JSON.parse(JSON.stringify(obj))
}

module.exports = function(grunt) {

    // Please see the Grunt documentation for more information regarding task
    // creation: http://gruntjs.com/creating-tasks

    grunt.registerMultiTask('synchard', 'rsync task handler.', function() {
        
        // Merge task-specific and/or target-specific options with these defaults.
        var done = this.async(),
            options = this.options({
                args: ['--archive']
            })

        // Iterate over all specified file groups.
        this.files.forEach(function(f) {
            
            var grpoptions = clone(options)
            grpoptions.src = []
            grpoptions.dest = './' + f.dest

            // Concat specified files.
            f.src.filter(function(filepath) {
                // Warn on and remove invalid source files (if nonull was set).
                if (!grunt.file.exists(filepath)) {
                    grunt.log.warn('Source file "' + filepath + '" not found.')
                    return false
                }
                else {
                    grpoptions.src.push('./' + filepath)
                    return true
                }
            })
            // Write the destination file.
            if (!grunt.file.exists(grpoptions.dest)) {
                grunt.file.mkdir(grpoptions.dest, '0755')
            }
            rsync(grpoptions, function(error, stdout, stderr, cmd) {
                grunt.log.writeln(cmd)
                stdout = stdout.trim()
                if (stdout) {
                    grunt.log.writeln(stdout)
                }
                if (error) {
                    grunt.log.warn(stderr)
                    done(false)
                }
                else {
                    done(true)
                }
            })
        })
    
    })

}
{'fraction_non_alphanumeric': 0.11076330363592583, 'fraction_numerical': 0.003852636648206116, 'mean_word_length': 1.3508771929824561, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1602331', 'n_tokens_mistral': 1159, 'n_tokens_neox': 1089, 'n_words': 244}