11'use strict' ;
2- var yeoman = require ( 'yeoman-generator' ) ;
2+ var Generator = require ( 'yeoman-generator' ) ;
33var slugify = require ( 'underscore.string' ) . slugify ;
44var normalizeUrl = require ( 'normalize-url' ) ;
55
66function filterProjectName ( name ) {
77 return slugify ( name . replace ( / ^ t e s t c a f e ( - | \s ) r e p o r t e r ( - | \s ) / i, '' ) ) ;
88}
99
10- module . exports = yeoman . generators . Base . extend ( {
11- prompting : function ( ) {
12- var done = this . async ( ) ;
13- var gen = this ;
14-
10+ module . exports = class extends Generator {
11+ prompting ( ) {
1512 var prompts = [
1613 {
1714 name : 'reporterName' ,
@@ -43,16 +40,14 @@ module.exports = yeoman.generators.Base.extend({
4340 }
4441 ] ;
4542
46- this . prompt ( prompts , function ( props ) {
47- gen . props = props ;
48-
49- done ( ) ;
50- } ) ;
51- } ,
52-
53- writing : function ( ) {
54- var gen = this ;
43+ return this
44+ . prompt ( prompts )
45+ . then ( props => {
46+ this . props = props ;
47+ } ) ;
48+ }
5549
50+ writing ( ) {
5651 var tmplProps = {
5752 author : this . user . git . name ( ) ,
5853 email : this . user . git . email ( ) ,
@@ -74,12 +69,12 @@ module.exports = yeoman.generators.Base.extend({
7469 this . fs . copyTpl ( this . templatePath ( ) + '/**/!(*.png)' , this . destinationPath ( ) , tmplProps ) ;
7570 this . fs . copy ( this . templatePath ( ) + '/**/*.png' , this . destinationPath ( ) ) ;
7671
77- Object . keys ( unescaped ) . forEach ( function ( escaped ) {
78- gen . fs . move ( gen . destinationPath ( escaped ) , gen . destinationPath ( unescaped [ escaped ] ) ) ;
72+ Object . keys ( unescaped ) . forEach ( escaped => {
73+ this . fs . move ( this . destinationPath ( escaped ) , this . destinationPath ( unescaped [ escaped ] ) ) ;
7974 } ) ;
80- } ,
75+ }
8176
82- install : function ( ) {
77+ install ( ) {
8378 this . installDependencies ( { bower : false } ) ;
8479 }
85- } ) ;
80+ } ;
0 commit comments