<commit_before>var _ = require('lodash');
var async = require('async-chainable');
var colors = require('colors');
var copy = require('copy');

module.exports = {
	name: 'locations',
	description: 'Backup specified on-disk directories',
	backup: function(finish, workspace) {
		async()
			.then(function(next) {
				// Sanity checks {{{
				if (!mindstate.config.locations.enabled) {
					if (mindstate.verbose) console.log(colors.blue('[Locations]'), 'Locations backup is disabled');
					return next('SKIP');
				}

				if (!mindstate.config.locations.dir.length) {
					if (mindstate.verbose) console.log(colors.blue('[Locations]'), 'No locations specified to backup');
					return next('SKIP');
				}
				next();
				// }}}
			})
			.forEach(mindstate.config.locations.dir, function(next, dir) {
				if (mindstate.verbose) console.log(colors.blue('[Locations]'), 'Backup', colors.cyan(dir));
				copy.dir(dir, workspace.dir + '/' + dir, function(err) {
					if (mindstate.verbose > 1) console.log(colors.blue('[Locations]'), 'Backup complete of', colors.cyan(dir));<commit_msg>Switched from NPM copy -> NPM fs-extra as copy() seems to be acting weird<commit_after>var _ = require('lodash');
var async = require('async-chainable');
var colors = require('colors');
var fs = require('fs-extra');

module.exports = {
	name: 'locations',
	description: 'Backup specified on-disk directories',
	backup: function(finish, workspace) {
		async()
			.then(function(next) {
				// Sanity checks {{{
				if (!mindstate.config.locations.enabled) {
					if (mindstate.verbose) console.log(colors.blue('[Locations]'), 'Locations backup is disabled');
					return next('SKIP');
				}

				if (!mindstate.config.locations.dir.length) {
					if (mindstate.verbose) console.log(colors.blue('[Locations]'), 'No locations specified to backup');
					return next('SKIP');
				}
				next();
				// }}}
			})
			.forEach(mindstate.config.locations.dir, function(next, dir) {
				if (mindstate.verbose) console.log(colors.blue('[Locations]'), 'Backup', colors.cyan(dir));
				fs.copy(dir, workspace.dir + '/' + dir, function(err) {
					if (mindstate.verbose > 1) console.log(colors.blue('[Locations]'), 'Backup complete of', colors.cyan(dir));
{'fraction_non_alphanumeric': 0.17739756866276452, 'fraction_numerical': 0.0009004952723998199, 'mean_word_length': 4.17948717948718, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '6995392', 'n_tokens_mistral': 816, 'n_tokens_neox': 697, 'n_words': 151}