diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000000..0e42681150 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,54 @@ +(function () { + "use strict"; + + var configureGrunt = function (grunt) { + + var cfg = { + // JSLint all the things! + jslint: { + directives: { + node: true, + browser: true, + nomen: true, + todo: true + }, + files: [ + // Lint files in the root, including Gruntfile.js + "*.js", + // Lint core files, but not libs + ["core/**/*.js", "!**/assets/lib/**/*.js"] + ] + }, + + // Unit test all the things! + nodeunit: { + all: ['core/test/ghost/**/test-*.js'] + }, + + // Compile all the SASS! + compass: { + options: { + config: "config.rb" + }, + // No need for config, but separated for future options + admin: {} + } + }; + + grunt.initConfig(cfg); + + grunt.loadNpmTasks("grunt-jslint"); + grunt.loadNpmTasks("grunt-contrib-nodeunit"); + grunt.loadNpmTasks("grunt-contrib-compass"); + + // Prepare the project for development + // TODO: Git submodule init/update (https://github.com/jaubourg/grunt-update-submodules)? + grunt.registerTask("init", ["compass:admin"]); + + // Run tests and lint code + grunt.registerTask("validate", ["jslint", "nodeunit:all"]); + }; + + module.exports = configureGrunt; + +}()); \ No newline at end of file diff --git a/core/admin/assets/js/tagui.js b/core/admin/assets/js/tagui.js index 2713e8f8d3..51a933141d 100644 --- a/core/admin/assets/js/tagui.js +++ b/core/admin/assets/js/tagui.js @@ -99,8 +99,8 @@ } } else if (e.keyCode === keys.ESC) { suggestions.hide(); - } else if ((e.keyCode === keys.ENTER || e.keyCode === keys.COMMA) - && searchTerm) { // Submit tag using enter or comma key + } else if ((e.keyCode === keys.ENTER || e.keyCode === keys.COMMA) && searchTerm) { + // Submit tag using enter or comma key e.preventDefault(); if (suggestions.is(":visible") && suggestions.children(".selected").length !== 0) { diff --git a/core/ghost.js b/core/ghost.js index 30be09d74c..d227f84a0d 100644 --- a/core/ghost.js +++ b/core/ghost.js @@ -158,7 +158,7 @@ )); app.set('views', self.paths().activeTheme); } else { - app.engine('hbs', hbs.express3({partialsDir: self.paths().adminViews + '/partials'})); + app.engine('hbs', hbs.express3({partialsDir: self.paths().adminViews + 'partials'})); app.set('views', self.paths().adminViews); app.use('/core/admin/assets', express['static'](path.join(__dirname, '/admin/assets'))); } diff --git a/core/lang/i18n.js b/core/lang/i18n.js index 07c9bba35f..7c173875c4 100644 --- a/core/lang/i18n.js +++ b/core/lang/i18n.js @@ -19,6 +19,9 @@ if (lang === 'en') { // TODO: do stuff here to optimise for en + + // Make jslint empty block error go away + lang = 'en'; } /** TODO potentially use req.acceptedLanguages rather than the default diff --git a/package.json b/package.json index 877f3fa31d..dfbc2bdea3 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,10 @@ "jugglingdb-sqlite3": "git+https://github.com/jugglingdb/sqlite3-adapter.git#master" }, "devDependencies": { - "nodeunit": "*" + "grunt": "~0.4.1", + "grunt-contrib-nodeunit": "~0.1.2", + "grunt-contrib-compass": "~0.2.0", + "nodeunit": "*", + "grunt-jslint": "~0.2.5a" } -} \ No newline at end of file +}