diff --git a/dist/verbs/analyze.js b/dist/verbs/analyze.js index 58e08d1..e00b6b9 100644 --- a/dist/verbs/analyze.js +++ b/dist/verbs/analyze.js @@ -6,7 +6,9 @@ Implementation of the 'analyze' verb for HackMyResume. */ (function() { - var AnalyzeVerb, HMEVENT, HMSTATUS, MKDIRP, PATH, ResumeFactory, Verb, _, _analyze, _analyzeOne, _loadInspectors, chalk; + var AnalyzeVerb, HMEVENT, HMSTATUS, MKDIRP, PATH, ResumeFactory, Verb, _, _analyze, _analyzeOne, _loadInspectors, chalk, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; MKDIRP = require('mkdirp'); @@ -27,11 +29,16 @@ Implementation of the 'analyze' verb for HackMyResume. /** An invokable resume analysis command. */ - AnalyzeVerb = module.exports = Verb.extend({ - init: function() { - return this._super('analyze', _analyze); + module.exports = AnalyzeVerb = (function(superClass) { + extend(AnalyzeVerb, superClass); + + function AnalyzeVerb() { + AnalyzeVerb.__super__.constructor.call(this, 'analyze', _analyze); } - }); + + return AnalyzeVerb; + + })(Verb); /** Private workhorse for the 'analyze' command. */ diff --git a/dist/verbs/build.js b/dist/verbs/build.js index 4aacd8f..7af8564 100644 --- a/dist/verbs/build.js +++ b/dist/verbs/build.js @@ -6,7 +6,9 @@ Implementation of the 'build' verb for HackMyResume. */ (function() { - var BuildVerb, FRESHTheme, FS, HMEVENT, HMSTATUS, JRSTheme, MD, MKDIRP, PATH, RConverter, RTYPES, ResumeFactory, Verb, _, _addFreebieFormats, _build, _err, _expand, _fmts, _loadTheme, _log, _opts, _prep, _rezObj, _single, _verifyOutputs, _verifyTheme, addFreebieFormats, build, expand, extend, loadTheme, parsePath, prep, single, verifyOutputs, verifyTheme; + var BuildVerb, FRESHTheme, FS, HMEVENT, HMSTATUS, JRSTheme, MD, MKDIRP, PATH, RConverter, RTYPES, ResumeFactory, Verb, _, _addFreebieFormats, _build, _err, _expand, _fmts, _loadTheme, _log, _opts, _prep, _rezObj, _single, _verifyOutputs, _verifyTheme, addFreebieFormats, build, expand, extend, loadTheme, parsePath, prep, single, verifyOutputs, verifyTheme, + extend1 = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; _ = require('underscore'); @@ -70,13 +72,19 @@ Implementation of the 'build' verb for HackMyResume. /** An invokable resume generation command. */ - BuildVerb = module.exports = Verb.extend({ + module.exports = BuildVerb = (function(superClass) { + extend1(BuildVerb, superClass); + /** Create a new build verb. */ - init: function() { - return this._super('build', _build); + + function BuildVerb() { + BuildVerb.__super__.constructor.call(this, 'build', _build); } - }); + + return BuildVerb; + + })(Verb); /** diff --git a/dist/verbs/convert.js b/dist/verbs/convert.js index 5e70861..ade42f8 100644 --- a/dist/verbs/convert.js +++ b/dist/verbs/convert.js @@ -6,7 +6,9 @@ Implementation of the 'convert' verb for HackMyResume. */ (function() { - var ConvertVerb, HMEVENT, HMSTATUS, ResumeFactory, Verb, _, _convert, _convertOne, chalk; + var ConvertVerb, HMEVENT, HMSTATUS, ResumeFactory, Verb, _, _convert, _convertOne, chalk, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; ResumeFactory = require('../core/resume-factory'); @@ -20,11 +22,16 @@ Implementation of the 'convert' verb for HackMyResume. HMEVENT = require('../core/event-codes'); - ConvertVerb = module.exports = Verb.extend({ - init: function() { - return this._super('convert', _convert); + module.exports = ConvertVerb = (function(superClass) { + extend(ConvertVerb, superClass); + + function ConvertVerb() { + ConvertVerb.__super__.constructor.call(this, 'convert', _convert); } - }); + + return ConvertVerb; + + })(Verb); /** Private workhorse method. Convert 0..N resumes between FRESH and JRS diff --git a/dist/verbs/create.js b/dist/verbs/create.js index 43a492d..a5cc601 100644 --- a/dist/verbs/create.js +++ b/dist/verbs/create.js @@ -6,7 +6,9 @@ Implementation of the 'create' verb for HackMyResume. */ (function() { - var CreateVerb, HMEVENT, HMSTATUS, MKDIRP, PATH, Verb, _, _create, _createOne, chalk; + var CreateVerb, HMEVENT, HMSTATUS, MKDIRP, PATH, Verb, _, _create, _createOne, chalk, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; MKDIRP = require('mkdirp'); @@ -22,11 +24,16 @@ Implementation of the 'create' verb for HackMyResume. HMEVENT = require('../core/event-codes'); - CreateVerb = module.exports = Verb.extend({ - init: function() { - return this._super('new', _create); + module.exports = CreateVerb = (function(superClass) { + extend(CreateVerb, superClass); + + function CreateVerb() { + CreateVerb.__super__.constructor.call(this, 'new', _create); } - }); + + return CreateVerb; + + })(Verb); /** Create a new empty resume in either FRESH or JRS format. */ diff --git a/dist/verbs/peek.js b/dist/verbs/peek.js index 24f640a..aae8215 100644 --- a/dist/verbs/peek.js +++ b/dist/verbs/peek.js @@ -6,7 +6,9 @@ Implementation of the 'peek' verb for HackMyResume. */ (function() { - var HMEVENT, HMSTATUS, PeekVerb, Verb, _, __, _peek, _peekOne, safeLoadJSON; + var HMEVENT, HMSTATUS, PeekVerb, Verb, _, __, _peek, _peekOne, safeLoadJSON, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; Verb = require('../verbs/verb'); @@ -20,11 +22,16 @@ Implementation of the 'peek' verb for HackMyResume. HMEVENT = require('../core/event-codes'); - PeekVerb = module.exports = Verb.extend({ - init: function() { - return this._super('peek', _peek); + module.exports = PeekVerb = (function(superClass) { + extend(PeekVerb, superClass); + + function PeekVerb() { + PeekVerb.__super__.constructor.call(this, 'peek', _peek); } - }); + + return PeekVerb; + + })(Verb); /** Peek at a resume, resume section, or resume field. */ diff --git a/dist/verbs/validate.js b/dist/verbs/validate.js index ce33673..bb8d0a8 100644 --- a/dist/verbs/validate.js +++ b/dist/verbs/validate.js @@ -6,7 +6,9 @@ Implementation of the 'validate' verb for HackMyResume. */ (function() { - var FS, HMEVENT, HMSTATUS, ResumeFactory, SyntaxErrorEx, ValidateVerb, Verb, _, _validate, _validateOne, chalk, safeLoadJSON; + var FS, HMEVENT, HMSTATUS, ResumeFactory, SyntaxErrorEx, ValidateVerb, Verb, _, _validate, _validateOne, chalk, safeLoadJSON, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; FS = require('fs'); @@ -29,11 +31,16 @@ Implementation of the 'validate' verb for HackMyResume. /** An invokable resume validation command. */ - ValidateVerb = module.exports = Verb.extend({ - init: function() { - return this._super('validate', _validate); + module.exports = ValidateVerb = (function(superClass) { + extend(ValidateVerb, superClass); + + function ValidateVerb() { + ValidateVerb.__super__.constructor.call(this, 'validate', _validate); } - }); + + return ValidateVerb; + + })(Verb); /** Validate 1 to N resumes in FRESH or JSON Resume format. */ diff --git a/dist/verbs/verb.js b/dist/verbs/verb.js index 95332f6..f76b7e0 100644 --- a/dist/verbs/verb.js +++ b/dist/verbs/verb.js @@ -6,9 +6,7 @@ Definition of the Verb class. */ (function() { - var Class, EVENTS, HMEVENT, Promise, Verb; - - Class = require('../utils/class'); + var EVENTS, HMEVENT, Promise, Verb; EVENTS = require('events'); @@ -22,17 +20,20 @@ Definition of the Verb class. @class Verb */ - Verb = module.exports = Class.extend({ + module.exports = Verb = (function() { /** Constructor. Automatically called at creation. */ - init: function(moniker, workhorse) { + function Verb(moniker, workhorse) { this.moniker = moniker; this.workhorse = workhorse; this.emitter = new EVENTS.EventEmitter(); - }, + return; + } + /** Invoke the command. */ - invoke: function() { + + Verb.prototype.invoke = function() { var argsArray, that; this.stat(HMEVENT.begin, { cmd: this.moniker @@ -44,23 +45,29 @@ Definition of the Verb class. that.reject = rej; that.workhorse.apply(that, argsArray); }); - }, + }; + /** Forward subscriptions to the event emitter. */ - on: function() { + + Verb.prototype.on = function() { return this.emitter.on.apply(this.emitter, arguments); - }, + }; + /** Fire an arbitrary event, scoped to "hmr:". */ - fire: function(evtName, payload) { + + Verb.prototype.fire = function(evtName, payload) { payload = payload || {}; payload.cmd = this.moniker; this.emitter.emit('hmr:' + evtName, payload); return true; - }, + }; + /** Handle an error condition. */ - err: function(errorCode, payload, hot) { + + Verb.prototype.err = function(errorCode, payload, hot) { payload = payload || {}; payload.sub = payload.fluenterror = errorCode; payload["throw"] = hot; @@ -74,25 +81,33 @@ Definition of the Verb class. throw payload; } return true; - }, + }; + /** Fire the 'hmr:status' error event. */ - stat: function(subEvent, payload) { + + Verb.prototype.stat = function(subEvent, payload) { payload = payload || {}; payload.sub = subEvent; this.fire('status', payload); return true; - }, - hasError: function() { + }; + + Verb.prototype.hasError = function() { return this.errorCode || this.errorObj; - }, + }; + /** Associate error info with the invocation. */ - setError: function(code, obj) { + + Verb.prototype.setError = function(code, obj) { this.errorCode = code; this.errorObj = obj; - } - }); + }; + + return Verb; + + })(); }).call(this); diff --git a/src/verbs/analyze.coffee b/src/verbs/analyze.coffee index 23c5f84..a77faf0 100644 --- a/src/verbs/analyze.coffee +++ b/src/verbs/analyze.coffee @@ -17,9 +17,9 @@ chalk = require('chalk') ###* An invokable resume analysis command. ### -AnalyzeVerb = module.exports = Verb.extend +module.exports = class AnalyzeVerb extends Verb - init: -> @_super 'analyze', _analyze + constructor: -> super 'analyze', _analyze diff --git a/src/verbs/build.coffee b/src/verbs/build.coffee index fb42553..8a4aa1f 100644 --- a/src/verbs/build.coffee +++ b/src/verbs/build.coffee @@ -39,10 +39,10 @@ verifyTheme = null loadTheme = null ###* An invokable resume generation command. ### -BuildVerb = module.exports = Verb.extend +module.exports = class BuildVerb extends Verb ###* Create a new build verb. ### - init: () -> @_super 'build', _build + constructor: () -> super 'build', _build diff --git a/src/verbs/convert.coffee b/src/verbs/convert.coffee index 1ba1655..a88a8d7 100644 --- a/src/verbs/convert.coffee +++ b/src/verbs/convert.coffee @@ -15,9 +15,9 @@ HMEVENT = require('../core/event-codes'); -ConvertVerb = module.exports = Verb.extend +module.exports = class ConvertVerb extends Verb - init: -> @_super 'convert', _convert + constructor: -> super 'convert', _convert diff --git a/src/verbs/create.coffee b/src/verbs/create.coffee index 0f659db..4c80775 100644 --- a/src/verbs/create.coffee +++ b/src/verbs/create.coffee @@ -16,9 +16,9 @@ HMEVENT = require '../core/event-codes' -CreateVerb = module.exports = Verb.extend +module.exports = class CreateVerb extends Verb - init: -> @_super 'new', _create + constructor: -> super 'new', _create diff --git a/src/verbs/peek.coffee b/src/verbs/peek.coffee index 865a721..6e2aca6 100644 --- a/src/verbs/peek.coffee +++ b/src/verbs/peek.coffee @@ -15,9 +15,9 @@ HMEVENT = require('../core/event-codes') -PeekVerb = module.exports = Verb.extend +module.exports = class PeekVerb extends Verb - init: -> @_super 'peek', _peek + constructor: -> super 'peek', _peek diff --git a/src/verbs/validate.coffee b/src/verbs/validate.coffee index b14a993..3f5feb9 100644 --- a/src/verbs/validate.coffee +++ b/src/verbs/validate.coffee @@ -19,9 +19,9 @@ safeLoadJSON = require '../utils/safe-json-loader' ###* An invokable resume validation command. ### -ValidateVerb = module.exports = Verb.extend +module.exports = class ValidateVerb extends Verb - init: -> @_super 'validate', _validate + constructor: -> super 'validate', _validate diff --git a/src/verbs/verb.coffee b/src/verbs/verb.coffee index 5e39b1f..d6bbc48 100644 --- a/src/verbs/verb.coffee +++ b/src/verbs/verb.coffee @@ -6,8 +6,6 @@ Definition of the Verb class. -# Use J. Resig's nifty class implementation -Class = require '../utils/class' EVENTS = require 'events' HMEVENT = require '../core/event-codes' Promise = require 'pinkie-promise' @@ -18,14 +16,12 @@ Promise = require 'pinkie-promise' An instantiation of a HackMyResume command. @class Verb ### -Verb = module.exports = Class.extend +module.exports = class Verb ###* Constructor. Automatically called at creation. ### - init: ( moniker, workhorse ) -> - @moniker = moniker - @workhorse = workhorse + constructor: ( @moniker, @workhorse ) -> @emitter = new EVENTS.EventEmitter() return