This repository was archived by the owner on Mar 26, 2018. It is now read-only.
File tree 2 files changed +47
-0
lines changed
2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ Description:
2
+ Creates a new AngularJS decorator for a specified service
3
+
4
+ Example:
5
+ yo angular:decorator serviceName [--coffee]
6
+
7
+ This will create:
8
+ app/scripts/decorators/serviceNameDecorator.js
9
+
10
+
11
+ if you want to use multiple decorator for a service,
12
+ you are able to use the second argument
13
+
14
+ yo angular:decorator serviceName serviceNameLogging [--coffee]
15
+
16
+ This will create:
17
+ app/scripts/decorators/serviceNameLoggingDecorator.js
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+ var path = require ( 'path' ) ;
3
+ var util = require ( 'util' ) ;
4
+ var ScriptBase = require ( '../script-base.js' ) ;
5
+ var angularUtils = require ( '../util.js' ) ;
6
+
7
+
8
+ module . exports = Generator ;
9
+
10
+ function Generator ( ) {
11
+ ScriptBase . apply ( this , arguments ) ;
12
+ var postFix = "Decorator" ;
13
+
14
+ //TODO: Any better way in yeoman to get this value?
15
+ var fileName = arguments [ 0 ] [ 1 ] ;
16
+ if ( fileName === undefined ) {
17
+ fileName = this . name + postFix ;
18
+ }
19
+ else {
20
+ fileName += postFix ;
21
+ }
22
+ this . fileName = fileName ;
23
+ }
24
+
25
+ util . inherits ( Generator , ScriptBase ) ;
26
+
27
+ Generator . prototype . createDecoratorFiles = function createDecoratorFiles ( ) {
28
+ this . appTemplate ( 'decorator' , 'scripts/decorators/' + this . fileName ) ;
29
+ this . addScriptToIndex ( 'decorators/' + this . fileName ) ;
30
+ } ;
You can’t perform that action at this time.
0 commit comments