Skip to content

Commit edc2118

Browse files
committed
feat(subgen/value): add the value generator
1 parent 063d990 commit edc2118

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

templates/value.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
3+
angular.module('<%= preffix %>.<%= moduleName %>')
4+
.value('<%= name %>', {
5+
meaningOfLife: 42
6+
});
7+
8+

value/USAGE

Whitespace-only changes.

value/index.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict';
2+
3+
var util = require('util');
4+
var path = require('path');
5+
var yeoman = require('yeoman-generator');
6+
var ScriptBase = require('../script-base.js');
7+
8+
var ValueGenerator = module.exports = function(args, options) {
9+
ScriptBase.apply(this, arguments);
10+
11+
this.moduleName = args[0];
12+
this.name = args[1];
13+
};
14+
15+
util.inherits(ValueGenerator, ScriptBase);
16+
17+
ValueGenerator.prototype.createSourceFile = function() {
18+
this.sourceRoot(path.join(__dirname, '../templates'));
19+
yeoman.generators.Base.prototype.template.apply(this, [
20+
'value.js',
21+
'app/' + this.moduleName + '/' + this.name + 'Value.js'
22+
]);
23+
};
24+

0 commit comments

Comments
 (0)