@@ -64,7 +64,6 @@ process.on('exit', function () {
6464var template = program . args [ 0 ]
6565var hasSlash = template . indexOf ( '/' ) > - 1
6666var rawName = program . args [ 1 ]
67- var templatePath = exists ( template ) ? template : path . normalize ( path . join ( process . cwd ( ) , template ) )
6867var inPlace = ! rawName || rawName === '.'
6968var name = inPlace ? path . relative ( '../' , process . cwd ( ) ) : rawName
7069var to = path . resolve ( rawName || '.' )
@@ -92,12 +91,19 @@ if (exists(to)) {
9291
9392function run ( ) {
9493 // check if template is local
95- if ( exists ( templatePath ) ) {
96- generate ( name , templatePath , to , function ( err ) {
97- if ( err ) logger . fatal ( err )
98- console . log ( )
99- logger . success ( 'Generated "%s".' , name )
100- } )
94+ if ( / ^ [ . / ] / . test ( template ) ) {
95+ var templatePath = template . charAt ( 0 ) === '/'
96+ ? template
97+ : path . normalize ( path . join ( process . cwd ( ) , template ) )
98+ if ( exists ( templatePath ) ) {
99+ generate ( name , templatePath , to , function ( err ) {
100+ if ( err ) logger . fatal ( err )
101+ console . log ( )
102+ logger . success ( 'Generated "%s".' , name )
103+ } )
104+ } else {
105+ logger . fatal ( 'Local template "%s" not found.' , template )
106+ }
101107 } else {
102108 checkVersion ( function ( ) {
103109 if ( ! hasSlash ) {
0 commit comments