Comparing version 0.1.0 to 0.1.1
"use strict"; | ||
/*! | ||
* Artisan | ||
* Author: Kevin Coughlin @kevintcoughlin , <kevintcoughlin@gmail.com> | ||
* MIT Licensed | ||
*/ | ||
/** | ||
* Module Dependencies | ||
*/ | ||
var program = require('commander') | ||
@@ -19,16 +28,47 @@ , fs = require('fs') | ||
// If no app name was passed prompt user for one | ||
/** | ||
* If no app name was passed prompt user for one | ||
*/ | ||
if(!program.args[0]) { | ||
program.prompt('Please name your node module: ', function (name) { | ||
process.stdin.destroy(); | ||
bootstrap(name); | ||
// Prompt user for top-level dir name | ||
program.prompt('Please name your node module: ', function ( name ) { | ||
canCreate( name, bootstrap ); | ||
}); | ||
} else { | ||
bootstrap(appName); | ||
canCreate( appName, bootstrap ); | ||
} | ||
/** | ||
* Check if directory exists, if so then prompt to create or exit | ||
*/ | ||
function canCreate( name, callback ) { | ||
// Check if dir exists | ||
if(fs.existsSync('./' + name)) { | ||
// Confirm replacement of dir | ||
program.confirm('Directory already exists. Replace? ', function( result ){ | ||
// Replace | ||
if(result) { | ||
process.stdin.destroy(); | ||
callback( name ); | ||
} | ||
// Exit | ||
else { | ||
process.stdin.destroy(); | ||
console.log('You chose not to replace the directory.\nExiting Artisan now.'); | ||
return; | ||
} | ||
}); | ||
} | ||
// Create dir | ||
else { | ||
process.stdin.destroy(); | ||
callback( name ); | ||
} | ||
} | ||
/** | ||
* Bootstrap app files. | ||
*/ | ||
function bootstrap( name ) { | ||
console.log('Bootstrapping your new node module - ' + name); | ||
//if (program.peppers) console.log(' - peppers'); | ||
//console.log(' - %s cheese', program.cheese); | ||
@@ -96,15 +136,2 @@ mkdirp('./' + name, function (err) { | ||
cursor.reset(); | ||
} | ||
/* | ||
function Artisan( ) { | ||
if (!(this instanceof Artisan)) | ||
return new Artisan(); | ||
this.defaults = { | ||
}; | ||
}; | ||
module.exports = Artisan; | ||
*/ | ||
} |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"author": "Kevin Coughlin <kevintcoughlin@gmail.com>", | ||
@@ -13,0 +13,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5479
114