Skip to content

Commit

Permalink
Prevent hidden files (like .svn folders) from being copied from templ…
Browse files Browse the repository at this point in the history
…ate. Fixes #40
  • Loading branch information
JohnAlbin committed Jul 23, 2014
1 parent ed7d5d8 commit e0119c5
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions bin/kss-node
Expand Up @@ -20,7 +20,9 @@ var kss = require(__dirname + '/../lib/kss.js'),
sourceDirectory: __dirname + '/../demo',
destinationDirectory: process.cwd() + '/styleguide'
},
KSS_FAILED = false, argv;
KSS_FAILED = false,
argv,
error;

/**
* CLI argument parsing, thanks to Substack's optimist.
Expand Down Expand Up @@ -80,10 +82,19 @@ if (argv.init) {

console.log('Creating a new styleguide template...');
try {
wrench.copyDirSyncRecursive( __dirname + '/../lib/template', argv.init );
}
catch (e) {
console.log('Error! ' + argv.init + ' already exists.');
error = wrench.copyDirSyncRecursive(
__dirname + '/../lib/template',
argv.init,
{
forceDelete: false,
excludeHiddenUnix: true
}
);
if (error) {
throw error;
}
} catch (e) {
console.log('Error! This folder already exists: ' + argv.init);
return;
}
console.log('You can change it as you like, and use it with your styleguide like so:');
Expand Down Expand Up @@ -123,8 +134,8 @@ wrench.copyDirSyncRecursive(
config.templateDirectory + '/public',
config.destinationDirectory + '/public',
{
forceDelete: true,
excludeHiddenUnix: true
forceDelete: true,
excludeHiddenUnix: true
}
);

Expand Down

0 comments on commit e0119c5

Please sign in to comment.