Review toolchain.

This commit is contained in:
Alexis Lahouze 2016-10-15 11:45:39 +02:00
parent 96a553c130
commit 8cad18d5ea
2 changed files with 80 additions and 18 deletions

View File

@ -1,57 +1,115 @@
// vim: set tw=80 ts=4 sw=4 sts=4:
'use strict';
module.exports = function(grunt) {
// Grunt plugin initialization.
// ============================
// Automagically load grunt tasks.
require('load-grunt-tasks')(grunt);
// Display duration for each task.
require('time-grunt')(grunt);
// Options
var options = {
// Application related configuration.
accountant: {
// Frontend related
frontend: {
// Application dependencies by bower.
app: require('./bower.json'),
// Source path
src: 'accountant-ui',
// Distribution path
dist: 'accountant-ui_dist'
}
},
// Grunt configurationi files.
config: {
src: 'grunt-config/*.js'
},
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %>\n' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %> */\n'
// Package description for NPM.
pkg: grunt.file.readJSON('package.json')
// banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %>\n' +
// '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %> */\n'
};
// Load configuration from Grunt configuration directory.
var configs = require('load-grunt-configs')(grunt, options);
// Initialize Grunt configuration.
grunt.initConfig(configs);
grunt.registerTask('dependencies', [
// Toolchain tasks.
// ================
// Manage toolchain
grunt.registerTask('toolchain', [
// NodeJS dependencies for toolchain.
'shell:npmInstall',
'shell:bowerInstall',
'shell:pipInstall',
'wiredep:app'
// Configuration file linting.
'newer:eslint:toolchain',
'newer:jsonlint:toolchain'
]);
grunt.registerTask('pydev', [
// Backend tasks.
// ==============
grunt.registerTask('beDeps', [
// Python dependencies. Does not work in virtualenv.
// 'shell:pipInstall'
]);
// Linting
grunt.registerTask('beLint', [
// Use flake8 for python linting.
'newer:flake8'
]);
grunt.registerTask('jsdev', [
'wiredep',
'newer:eslint'
// Backend dev task.
grunt.registerTask('beDev', [
'beDeps',
'beLint'
]);
grunt.registerTask('htmldev', [
// Frontend tasks.
// ===============
// Front dependency management.
grunt.registerTask('feDeps', [
// Web assets using bower
'shell:bowerInstall',
// Inject dependencies into application.
'wiredep:app'
]);
// Linting
grunt.registerTask('feLint', [
// ECMAScript
'newer:eslint:frontend',
// HTML.
'newer:htmllint'
]);
grunt.registerTask('dev', [
'dependencies',
'pydev',
'jsdev',
'htmldev'
// Frontend dev task.
grunt.registerTask('feDev', [
'feDeps',
'feLint'
]);
// Global tasks.
// =============
// Dev.
grunt.registerTask('dev', [
'toolchain',
'beDev',
'feDev'
]);
// Serve application.
grunt.registerTask('serve', [
'dev',
'bgShell:runserver',
@ -59,8 +117,9 @@ module.exports = function(grunt) {
'watch'
]);
// Make distribution.
grunt.registerTask('dist', [
'wiredep',
'dev',
'clean:dist',
'useminPrepare',
'copy:dist',

View File

@ -1,6 +1,9 @@
'use strict';
module.exports = {
options: {
maxComplexity: 4
},
src: [
'accountant/**/*.py'
]