bumped
Version:
Makes easy release software.
64 lines (48 loc) • 1.56 kB
text/coffeescript
async = require 'async'
CSON = require 'season'
fs = require 'fs-extra'
Util = require './Bumped.util'
Semver = require './Bumped.semver'
Config = require './Bumped.config'
Logger = require './Bumped.logger'
Plugins = require './Bumped.plugins'
DEFAULT = require './Bumped.default'
MSG = require './Bumped.messages'
module.exports = class Bumped
constructor: (opts = {}) ->
process.chdir opts.cwd if opts.cwd?
= require '../package.json'
= new Config this
= new Semver this
= new Logger opts.logger
= new Util this
= new Plugins this
this
start: ->
[opts, cb] = DEFAULT.args arguments
return cb() unless .rc.config
opts, cb
load: ->
[opts, cb] = DEFAULT.args arguments
tasks = [ .load ]
async.waterfall tasks, => .sync opts, cb
init: =>
[opts, cb] = DEFAULT.args arguments
tasks = [
(next) => .autodetect opts, next
(next) => .save opts, next
(next) => .sync opts, next
]
async.waterfall tasks, (err, result) =>
return .errorHandler err, cb if err
opts, cb
end: ->
[opts, cb] = DEFAULT.args arguments
return .version opts, cb unless opts.outputMessage
if .rc.files.length is 0
.warn MSG.NOT_AUTODETECTED()
.warn MSG.NOT_AUTODETECTED_2()
.version opts, =>
.success MSG.CONFIG_CREATED() if opts.outputMessage
cb()