diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..ac2c71d --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,46 @@ +module.exports = function(grunt) { + require('load-grunt-tasks')(grunt); + require('time-grunt')(grunt); + + // Options + var options = { + config: { + src: "grunt-config/*.js" + }, + paths: { + frontend_js: [ + 'accountant/frontend/static/js/app.js', + 'accountant/frontend/static/js/accounts.js', + 'accountant/frontend/static/js/months.js', + 'accountant/frontend/static/js/entries.js', + 'accountant/frontend/static/js/scheduler.js' + ], + frontend_build: 'accountant/frontend/static/build' + }, + 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', + }; + + var configs = require('load-grunt-configs')(grunt, options); + grunt.initConfig(configs); + + grunt.registerTask('generatestatic', [ + 'shell:npm_install', + 'bower:install', + 'bower_concat', + 'copy:bootstrap-select.css.map', + 'copy:fontawesome-webfont.woff', + 'copy:fontawesome-webfont.ttf' + ]); + + grunt.registerTask('jsdev', [ + 'jshint', + 'concat' + ]); + + grunt.registerTask('dev', [ + 'generatestatic', + 'jsdev' + ]); +}; diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..fdb084a --- /dev/null +++ b/bower.json @@ -0,0 +1,27 @@ +{ + "name": "accountant", + "version": "0.1.0", + "authors": [ + "Alexis Lahouze " + ], + "license": "AGPL", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "dependencies": { + "jquery": "2.1.4", + "moment": "2.10.3", + "bootstrap": "3.3.4", + "bootstrap-datepicker": "1.4.0", + "font-awesome": "4.3.0", + "pines-notify": "1.2.0", + "angular": "1.4.0", + "angular-strap": "2.2.4", + "d3": "3.5.5", + "nvd3": "1.8.1-alpha" + } +} diff --git a/grunt-config/bower.js b/grunt-config/bower.js new file mode 100644 index 0000000..b4ce4ac --- /dev/null +++ b/grunt-config/bower.js @@ -0,0 +1,16 @@ +module.exports = { + install: { + options: { + copy: false + } + }, + frontend: { + dest: 'accountant/frontend/static/third-party', + + options: { + expand: true, + stripAffix: true, + keepExpandedHierarchy: false + } + } +}; diff --git a/grunt-config/bower_concat.js b/grunt-config/bower_concat.js new file mode 100644 index 0000000..09b4ed3 --- /dev/null +++ b/grunt-config/bower_concat.js @@ -0,0 +1,9 @@ +module.exports = { + main: { + dest: 'accountant/frontend/static/build/js/vendor.js', + cssDest: 'accountant/frontend/static/build/css/vendor.css', + dependencies: { + 'autotype': 'jquery' + } + }, +}; diff --git a/grunt-config/clean.js b/grunt-config/clean.js new file mode 100644 index 0000000..7383930 --- /dev/null +++ b/grunt-config/clean.js @@ -0,0 +1,5 @@ +module.exports = { + libs: [ + "accountant/frontend/static/build" + ] +}; diff --git a/grunt-config/concat.js b/grunt-config/concat.js new file mode 100644 index 0000000..ddc9385 --- /dev/null +++ b/grunt-config/concat.js @@ -0,0 +1,15 @@ +module.exports = { + options: { + stripBanners: false, + banner: '<%= banner %>\n', + process: function(src, filepath) { + // Add comments with original filename. + return '// ### Begin: ' + filepath + ' ### //\n' + src + + '// ### End: ' + filepath + ' ### //\n'; + } + }, + frontend_js: { + src: '<%= paths.frontend_js %>', + dest: '<%= paths.frontend_build %>/js/app.js' + } +}; diff --git a/grunt-config/copy.js b/grunt-config/copy.js new file mode 100644 index 0000000..d3ffb9a --- /dev/null +++ b/grunt-config/copy.js @@ -0,0 +1,14 @@ +module.exports = { + "bootstrap-select.css.map": { + src: 'bower_components/bootstrap-select/dist/css/bootstrap-select.css.map', + dest: '<%= paths.frontend_build %>/css/bootstrap-select.css.map' + }, + "fontawesome-webfont.woff": { + src: 'bower_components/font-awesome/fonts/fontawesome-webfont.woff', + dest: '<%= paths.frontend_build %>/fonts/fontawesome-webfont.woff' + }, + "fontawesome-webfont.ttf": { + src: 'bower_components/font-awesome/fonts/fontawesome-webfont.ttf', + dest: '<%= paths.frontend_build %>/fonts/fontawesome-webfont.ttf' + } +}; diff --git a/grunt-config/jshint.js b/grunt-config/jshint.js new file mode 100644 index 0000000..561a2e2 --- /dev/null +++ b/grunt-config/jshint.js @@ -0,0 +1,9 @@ +module.exports = { + options: { + reporter: require('jshint-stylish') + }, + work: [ + '<%= paths.frontend_js %>/*.js', + 'Gruntfile.js' + ] +}; diff --git a/grunt-config/shell.js b/grunt-config/shell.js new file mode 100644 index 0000000..51eb220 --- /dev/null +++ b/grunt-config/shell.js @@ -0,0 +1,5 @@ +module.exports = { + npm_install: { + command: 'npm install' + } +}; diff --git a/grunt-config/watch.js b/grunt-config/watch.js new file mode 100644 index 0000000..be0d0d1 --- /dev/null +++ b/grunt-config/watch.js @@ -0,0 +1,6 @@ +module.exports = { + js: { + files: '<%= paths.frontend_js %>', + tasks: ['concat:frontend_js'] + } +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..79f767a --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "name": "accountant", + "version": "0.1.0", + "repository": "https://git.lahouze.org/xals/accountant", + "license": "AGPL-1.0", + "dependencies": { + "grunt": "0.4.5", + "grunt-copy": "0.1.0", + "grunt-contrib-clean": "0.6.0", + "grunt-contrib-watch": "0.6.1", + "grunt-contrib-concat": "0.5.1", + "time-grunt": "1.2.1", + "load-grunt-configs": "0.4.3", + "load-grunt-tasks": "3.2.0", + "grunt-bowercopy": "0.4.1", + "grunt-shell": "1.1.2", + "grunt-bower-task": "0.4.0", + "grunt-bower-concat": "0.5.0", + "grunt-contrib-jshint": "0.11.2", + "jshint-stylish": "2.0.0" + }, + "devDependencies": {} +}