diff --git a/.jshintignore b/.jshintignore new file mode 100644 index 0000000..4188205 --- /dev/null +++ b/.jshintignore @@ -0,0 +1,2 @@ +node_modules/** +templates/*/** diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..54cab19 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,29 @@ +{ + "bitwise": true, + "camelcase": true, + "curly": true, + "eqeqeq": true, + "forin": true, + "noarg": true, + "noempty": true, + "nonew": true, + "undef": true, + "unused": "vars", + "trailing": true, + "indent": 4, + "boss": true, + "eqnull": true, + "node": true, + "maxcomplexity": 10, + "globals": { + "jasmine": true, + "beforeEach": false, + "afterEach": false, + "describe": false, + "xdescribe": false, + "it": false, + "xit": false, + "expect": false, + "spyOn": false + } +} diff --git a/cli.js b/cli.js index e36ac5e..447462d 100644 --- a/cli.js +++ b/cli.js @@ -29,9 +29,6 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -var fs = require("fs"); -var path = require("path"); - var Command = require("commander").Command; var config = require("./package.json"); diff --git a/lib/create.js b/lib/create.js index ef1f270..5901e34 100644 --- a/lib/create.js +++ b/lib/create.js @@ -33,7 +33,9 @@ var fs = require("fs"); var path = require("path"); var MinitError = require("./error").MinitError; -var create = exports = module.exports = function(templateName, config, templateModule) { +exports = module.exports = create; +exports.create = create; +function create(templateName, config, templateModule) { config.templateName = templateName; @@ -64,8 +66,7 @@ var create = exports = module.exports = function(templateName, config, templateM return config; }); -}; -exports.create = create; +} exports.addCommandsTo = function(program) { var templatesDir = path.join(program.minitHome, "templates"); @@ -81,7 +82,7 @@ exports.addCommandsTo = function(program) { .fail(function(error) { var message = error.message; if (error instanceof MinitError) { - console.error(error.message); + console.error(message); } else { throw error; } diff --git a/lib/mustache.js b/lib/mustache.js deleted file mode 100644 index 9b5a4fa..0000000 --- a/lib/mustache.js +++ /dev/null @@ -1,536 +0,0 @@ -/*! - * mustache.js - Logic-less {{mustache}} templates with JavaScript - * http://github.com/janl/mustache.js - */ -var Mustache = (typeof module !== "undefined" && module.exports) || {}; - -(function (exports) { - - exports.name = "mustache.js"; - exports.version = "0.5.0-dev"; - exports.tags = ["{{", "}}"]; - exports.parse = parse; - exports.compile = compile; - exports.render = render; - exports.clearCache = clearCache; - - // This is here for backwards compatibility with 0.4.x. - exports.to_html = function (template, view, partials, send) { - var result = render(template, view, partials); - - if (typeof send === "function") { - send(result); - } else { - return result; - } - }; - - var _toString = Object.prototype.toString; - var _isArray = Array.isArray; - var _forEach = Array.prototype.forEach; - var _trim = String.prototype.trim; - - var isArray; - if (_isArray) { - isArray = _isArray; - } else { - isArray = function (obj) { - return _toString.call(obj) === "[object Array]"; - }; - } - - var forEach; - if (_forEach) { - forEach = function (obj, callback, scope) { - return _forEach.call(obj, callback, scope); - }; - } else { - forEach = function (obj, callback, scope) { - for (var i = 0, len = obj.length; i < len; ++i) { - callback.call(scope, obj[i], i, obj); - } - }; - } - - var spaceRe = /^\s*$/; - - function isWhitespace(string) { - return spaceRe.test(string); - } - - var trim; - if (_trim) { - trim = function (string) { - return string == null ? "" : _trim.call(string); - }; - } else { - var trimLeft, trimRight; - - if (isWhitespace("\xA0")) { - trimLeft = /^\s+/; - trimRight = /\s+$/; - } else { - // IE doesn't match non-breaking spaces with \s, thanks jQuery. - trimLeft = /^[\s\xA0]+/; - trimRight = /[\s\xA0]+$/; - } - - trim = function (string) { - return string == null ? "" : - String(string).replace(trimLeft, "").replace(trimRight, ""); - }; - } - - var escapeMap = { - "&": "&", - "<": "<", - ">": ">", - '"': '"', - "'": ''' - }; - - function escapeHTML(string) { - return String(string).replace(/&(?!\w+;)|[<>"']/g, function (s) { - return escapeMap[s] || s; - }); - } - - /** - * Adds the `template`, `line`, and `file` properties to the given error - * object and alters the message to provide more useful debugging information. - */ - function debug(e, template, line, file) { - file = file || "