diff --git a/ghost/admin/.jshintrc b/ghost/admin/.jshintrc index de3bcfb08e..c753d6085b 100644 --- a/ghost/admin/.jshintrc +++ b/ghost/admin/.jshintrc @@ -6,8 +6,7 @@ "-Promise", "-Notification", "validator", - "moment", - "fileUpload" + "moment" ], "browser": true, "boss": true, diff --git a/ghost/admin/.travis.yml b/ghost/admin/.travis.yml index 3b96c2a8d8..5ddf0b5c15 100644 --- a/ghost/admin/.travis.yml +++ b/ghost/admin/.travis.yml @@ -5,6 +5,11 @@ language: node_js node_js: - "0.10" +matrix: + include: + - node_js: "0.10" + env: TEST_SUITE=lint + cache: directories: - node_modules @@ -30,4 +35,4 @@ before_script: - export DISPLAY=:99; sh -e /etc/init.d/xvfb start; sleep 3; script: - - npm test + - if [ "$TEST_SUITE" == "lint" ]; then grunt lint; else npm test; fi diff --git a/ghost/admin/Gruntfile.js b/ghost/admin/Gruntfile.js new file mode 100644 index 0000000000..bfd72862dc --- /dev/null +++ b/ghost/admin/Gruntfile.js @@ -0,0 +1,75 @@ +/* global module, require, process */ +/* jscs:disable */ +var path = require('path'), + + escapeChar = process.platform.match(/^win/) ? '^' : '\\', + cwd = process.cwd().replace(/( |\(|\))/g, escapeChar + '$1'); + +module.exports = function(grunt) { + + // Find all of the task which start with `grunt-` and load them, rather than explicitly declaring them all + require('matchdep').filterDev(['grunt-*', '!grunt-cli']).forEach(grunt.loadNpmTasks); + + grunt.initConfig({ + jshint: { + options: { + jshintrc: true, + ignores: [ + 'node_modules/**', + 'bower_components/**', + 'tmp/**', + 'dist/**', + 'vendor/**' + ] + }, + + all: ['**/*.js'] + }, + + jscs: { + app: { + options: { + config: '.jscsrc', + excludeFiles: [ + 'node_modules/**', + 'bower_components/**', + 'tests/**', + 'tmp/**', + 'dist/**', + 'vendor/**' + ] + }, + + files: { + src: ['**/*.js'] + } + }, + + tests: { + options: { + config: 'tests/.jscsrc' + }, + + files: { + src: [ + 'tests/**/*.js' + ] + } + } + }, + + shell: { + csscombfix: { + command: path.resolve(cwd + '/node_modules/.bin/csscomb -c app/styles/csscomb.json -v app/styles') + }, + + csscomblint: { + command: path.resolve(cwd + '/node_modules/.bin/csscomb -c app/styles/csscomb.json -lv app/styles') + } + } + }); + + grunt.registerTask('lint', 'Run the code style checks and linter', + ['jshint', 'jscs', 'shell:csscomblint'] + ); +}; diff --git a/ghost/admin/package.json b/ghost/admin/package.json index 8a4d496e76..68f78fdb58 100644 --- a/ghost/admin/package.json +++ b/ghost/admin/package.json @@ -20,6 +20,7 @@ "license": "MIT", "devDependencies": { "broccoli-asset-rev": "2.4.2", + "csscomb": "3.1.8", "ember-ajax": "0.7.1", "ember-cli": "2.5.1", "ember-cli-app-version": "1.0.0", @@ -58,9 +59,14 @@ "emberx-file-input": "1.0.0", "fs-extra": "0.30.0", "glob": "^7.0.3", + "grunt": "1.0.1", + "grunt-contrib-jshint": "1.0.0", + "grunt-jscs": "2.8.0", + "grunt-shell": "1.3.0", "liquid-fire": "0.23.1", "liquid-tether": "1.1.1", "loader.js": "4.0.7", + "matchdep": "1.0.1", "walk-sync": "^0.2.6" }, "ember-addon": { diff --git a/ghost/admin/tests/.jshintrc b/ghost/admin/tests/.jshintrc index fbdf3a678f..f34de9ce41 100644 --- a/ghost/admin/tests/.jshintrc +++ b/ghost/admin/tests/.jshintrc @@ -26,7 +26,8 @@ "currentURL", "currentPath", "currentRouteName", - "expect" + "expect", + "fileUpload" ], "mocha": true, "node": false,