Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4ff8608

Browse filesBrowse files
committed
refactor(gen:docker): refactor gen code, move template to root templates folder
1 parent b33bc7b commit 4ff8608
Copy full SHA for 4ff8608

File tree

Expand file treeCollapse file tree

2 files changed

+40
-35
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+40
-35
lines changed
Open diff view settings
Collapse file

‎src/generators/docker/index.js‎

Copy file name to clipboard
+40-35Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,43 @@
11
'use strict';
2-
var util = require('util');
3-
var yeoman = require('yeoman-generator');
4-
var exec = require('child_process').exec;
5-
var chalk = require('chalk');
6-
var path = require('path');
7-
var s = require('underscore.string');
8-
9-
var Generator = module.exports = function Generator() {
10-
yeoman.generators.Base.apply(this, arguments);
11-
this.sourceRoot(path.join(__dirname, './templates'));
12-
this.filters = this.config.get('filters') || {};
13-
};
14-
15-
util.inherits(Generator, yeoman.generators.NamedBase);
16-
17-
Generator.prototype.copyDockerfile = function copyDockerfile() {
18-
var done = this.async();
19-
this.log(chalk.bold('Creating Dockerfile'));
20-
this.fs.copyTpl(this.templatePath('_Dockerfile'), 'dist/Dockerfile', this );
21-
this.conflicter.resolve(function (err) {
22-
done();
23-
});
24-
};
25-
26-
Generator.prototype.gruntBuild = function gruntBuild() {
27-
var done = this.async();
28-
29-
this.log(chalk.bold('\nBuilding dist folder, please wait...'));
30-
var child = exec('grunt build', function (err, stdout) {
31-
done();
32-
}.bind(this));
33-
child.stdout.on('data', function(data) {
34-
this.log(data.toString());
35-
}.bind(this));
36-
};
2+
import {exec} from 'child_process';
3+
import chalk from 'chalk';
4+
import path from 'path';
5+
import {Base} from 'yeoman-generator';
6+
import Promise from 'bluebird';
377

8+
class Generator extends Base {
9+
constructor(...args) {
10+
super(...args);
3811

12+
this.sourceRoot(path.join(__dirname, '../../templates/docker'));
13+
}
14+
15+
initializing() {
16+
return genBase(this);
17+
}
18+
19+
copyDockerfile() {
20+
var done = this.async();
21+
this.log(chalk.bold('Creating Dockerfile'));
22+
this.fs.copyTpl(this.templatePath('_Dockerfile'), 'dist/Dockerfile', this);
23+
this.conflicter.resolve(err => {
24+
done(err);
25+
});
26+
}
27+
28+
gruntBuild() {
29+
this.log(chalk.bold('\nBuilding dist folder, please wait...'));
30+
31+
return new Promise((resolve, reject) => {
32+
var child = exec('grunt build', (err, stdout) => {
33+
if(err) return reject(err);
34+
35+
resolve();
36+
});
37+
38+
child.stdout.on('data', data => {
39+
this.log(data.toString());
40+
});
41+
});
42+
}
43+
}
Collapse file
File renamed without changes.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.