Add Gruntfile.js, setup linting task and Travis build

refs #23
- add `grunt lint`
- add lint build to Travis matrix
This commit is contained in:
Kevin Ansfield 2016-05-24 13:07:31 +01:00
parent 55cb0f1dbe
commit a2a041db2a
5 changed files with 90 additions and 4 deletions

View File

@ -6,8 +6,7 @@
"-Promise",
"-Notification",
"validator",
"moment",
"fileUpload"
"moment"
],
"browser": true,
"boss": true,

View File

@ -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

75
ghost/admin/Gruntfile.js Normal file
View File

@ -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']
);
};

View File

@ -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": {

View File

@ -26,7 +26,8 @@
"currentURL",
"currentPath",
"currentRouteName",
"expect"
"expect",
"fileUpload"
],
"mocha": true,
"node": false,