jmms
Version:
Jmms cli tools, Jmms is a java meta-micro-service framework
39 lines (33 loc) • 1.01 kB
JavaScript
const _ = require('lodash');
const log = require('../../log');
const fs = require('fs');
const path = require('path');
var BaseGenerator = require('../../base');
module.exports = class extends BaseGenerator {
constructor(args, opts) {
super(args, opts, false);
}
initializing() {
var type = this.options['type'];
if(!type) {
type = 'pom';
}
this.pomFile = type + '.xml';
if(!fs.existsSync(this.templatePath(this.pomFile))) {
log.error('Invalid pom type \'' + type + '\'');
process.exit(0);
}
const dir = process.cwd();
this.pomPath = path.join(dir, "pom.xml");
if(fs.existsSync(this.pomPath)) {
log.warn(`Pom already exists at '${this.pomPath}`);
process.exit(0);
}
}
writing() {
this.fs.copyTpl(this.templatePath(this.pomFile), this.pomPath, {});
}
end() {
log.success(`pom.xml created!`);
}
};