@@ -60,64 +60,43 @@ function Generator() {
6060 }
6161
6262 this . sourceRoot ( path . join ( __dirname , sourceRoot ) ) ;
63-
64- this . moduleName = this . _ . camelize ( this . appname ) + 'App' ;
65-
66- this . namespace = [ ] ;
67- if ( this . name . indexOf ( '/' ) !== - 1 ) {
68- this . namespace = this . name . split ( '/' ) ;
69- this . name = this . namespace . pop ( ) ;
70-
71- this . moduleName += '.' + this . namespace . join ( '.' ) ; // add to parent ?
72- }
73-
7463}
7564
7665util . inherits ( Generator , yeoman . generators . NamedBase ) ;
7766
78- Generator . prototype . _dest = function ( src ) {
79- if ( src . indexOf ( 'spec/' ) === 0 ) {
80- src = src . substr ( 5 ) ;
81- } else if ( src . indexOf ( 'service/' ) === 0 ) {
82- src = src . substr ( 8 ) ;
83- }
84- return path . join ( ( this . namespace . join ( '/' ) || src ) , this . name ) ;
85- } ;
86-
87- Generator . prototype . appTemplate = function ( src ) {
67+ Generator . prototype . appTemplate = function ( src , dest ) {
8868 yeoman . generators . Base . prototype . template . apply ( this , [
8969 src + this . scriptSuffix ,
90- path . join ( this . env . options . appPath , this . _dest ( src ) ) + this . scriptSuffix
70+ path . join ( this . env . options . appPath , dest ) + this . scriptSuffix
9171 ] ) ;
92- this . addScriptToIndex ( src ) ;
9372} ;
9473
95- Generator . prototype . testTemplate = function ( src ) {
74+ Generator . prototype . testTemplate = function ( src , dest ) {
9675 yeoman . generators . Base . prototype . template . apply ( this , [
9776 src + this . scriptSuffix ,
98- path . join ( this . env . options . testPath , this . _dest ( src ) ) + this . scriptSuffix
77+ path . join ( this . env . options . testPath , dest ) + this . scriptSuffix
9978 ] ) ;
10079} ;
10180
102- Generator . prototype . htmlTemplate = function ( src ) {
81+ Generator . prototype . htmlTemplate = function ( src , dest ) {
10382 yeoman . generators . Base . prototype . template . apply ( this , [
10483 src ,
105- path . join ( this . env . options . appPath , this . _dest ( src ) )
84+ path . join ( this . env . options . appPath , dest )
10685 ] ) ;
10786} ;
10887
109- Generator . prototype . addScriptToIndex = function ( src ) {
88+ Generator . prototype . addScriptToIndex = function ( script ) {
11089 try {
11190 var appPath = this . env . options . appPath ;
11291 var fullPath = path . join ( appPath , 'index.html' ) ;
11392 angularUtils . rewriteFile ( {
11493 file : fullPath ,
11594 needle : '<!-- endbuild -->' ,
11695 splicable : [
117- '<script src="' + this . _dest ( src ) + '.js"></script>'
96+ '<script src="scripts/ ' + script + '.js"></script>'
11897 ]
11998 } ) ;
12099 } catch ( e ) {
121- console . log ( '\nUnable to find ' . yellow + fullPath + '. Reference to ' . yellow + this . _dest ( src ) + '.js ' + 'not added.\n' . yellow ) ;
100+ console . log ( '\nUnable to find ' . yellow + fullPath + '. Reference to ' . yellow + script + '.js ' + 'not added.\n' . yellow ) ;
122101 }
123102} ;
0 commit comments