Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function copyDirSync(src, dest, filter, rel) {
fs.existsSync(dest) || wrench.mkdirSyncRecursive(dest);
fs.existsSync(src) && fs.readdirSync(src).forEach(function (name) {
var from = path.join(src, name),
to = path.join(dest, name);
if (fs.existsSync(from) && (!filter || filter.test(name))) {
if (fs.statSync(from).isDirectory()) {
// we only want to apply the filter to the root of the directory being copied... I think
!ignoreDirs.test(name) && copyDirSync(from, to, null, rel);
// !ignoreDirs.test(name) && copyDirSync(from, to, filter, rel);
} else if (!ignoreFiles.test(name)) {
copyFileSync(from, to, rel);
}
}
});
}
grunt.registerTask('cleanup','Removes the urza scratch dir',function(){
console.log('Cleaning up...')
wrench.rmdirSyncRecursive(scratchDir)
wrench.rmdirSyncRecursive(workingDir + '/public')
wrench.rmdirSyncRecursive(workingDir + '/public_web')
wrench.rmdirSyncRecursive(workingDir + '/public_mobile')
})
// set up grunt task to upload to s3
cleanArray.forEach(function(target) {
target = target === 'ios' ? 'iphone' : target;
var cleanPath = path.join(buildPath, target);
// delete and recreate build paths
logger.debug('* Cleaning "' + cleanPath + "'");
wrench.rmdirSyncRecursive(cleanPath, true);
fs.mkdirSync(cleanPath,'777');
});
logger.info('Project build directories cleaned and reinitialized.');
cleanup: function () {
try {
fs.unlinkSync(__dirname + '/../sustain.json')
} catch (err) { }
wrench.rmdirSyncRecursive(__dirname + '/../node_modules', 'failSilently')
}
}
beforeEach(function() {
wrench.mkdirSyncRecursive(tmpDir);
wrench.copyDirSyncRecursive(repoSrc, tmpReposDir, {forceDelete: true});
wrench.copyDirSyncRecursive(filesSrc, repoDir, {forceDelete: true});
repo = fsStore(new Repository(repoDir));
configDir = path.join(repo.getPath(), ".imdone");
repo1 = fsStore(new Repository(repo1Dir));
repo2 = fsStore(new Repository(repo2Dir));
repo3 = fsStore(new Repository(repo3Dir))
});
repo.saveConfig(function(err) {
expect(err).to.be(null);
expect(fs.existsSync(configDir)).to.be(true);
wrench.rmdirSyncRecursive(configDir, true);
expect(fs.existsSync(configDir)).to.be(false);
done();
});
});
gitteh.initRepository(tempPath, true, function (err, repo) {
t.ok(repo instanceof gitteh.Repository, 'returns an instance of #gitteh.Repository');
t.ok(repo.bare, 'works');
t.equal(path.relative(repo.path, tempPath), '', 'initialises a bare repo in the specified path');
wrench.rmdirSyncRecursive(tempPath, true);
t.end();
});
});
afterEach(function() {
repo1.destroy();
repo2.destroy();
wrench.rmdirSyncRecursive(tmpDir, true);
});
afterEach(function() {
repo1.destroy();
repo2.destroy();
wrench.rmdirSyncRecursive(tmpDir, true);
});
.forEach(function(folder){
try{
wrench.rmdirSyncRecursive(folderPath + '/' + folder + '/.ensime_cache');
console.log('Removed: ' + folder + '\'s cache');
}catch(e){
//Do nothing
}
});
}