@busy-web/deploy
Version:
busy-web ember-cli-deploy addon.
59 lines (51 loc) • 1.47 kB
JavaScript
/**
* @module Commands
*
*/
var RSVP = require('rsvp');
var versionUtil = require('../helpers/version');
/**
* `ember deploy:version`
*
*/
module.exports = {
name: 'deploy:version',
description: 'Update the package version and commit it to the repo',
works: 'insideProject',
availableOptions: [],
anonymousOptions: ['<patch|minor|major>'],
run: function(commandOptions, rawArgs) {
var command = rawArgs.shift();
var version, buildDate;
if (command === 'patch') {
version = versionUtil.patch();
versionUtil.setVersion(version);
} else if (command === 'minor') {
version = versionUtil.minor();
versionUtil.setVersion(version);
} else if (command === 'major') {
version = versionUtil.major();
versionUtil.setVersion(version);
} else if (command === 'build') {
var build = rawArgs.shift();
if (build === undefined) {
// this will log out the build info
version = versionUtil.getBuild();
} else {
version = versionUtil.setBuild(build);
versionUtil.setVersion(version);
}
} else if (command === undefined) {
versionUtil.getVersion();
}
version = versionUtil.vf.version;
buildDate = versionUtil.vf.buildDate;
if (version) {
this.ui.write("Version: " + version + "\n");
this.ui.write("Created: " + buildDate + "\n");
return RSVP.Promise.resolve();
} else {
return RSVP.Promise.reject("busy:version takes no arg or <patch> <minor> <major> or <build> as an argument");
}
}
};