summaryrefslogtreecommitdiffstats
path: root/js/Gruntfile.js
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-15 04:36:40 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-15 04:36:40 +0200
commit04e421cf2f4f801d7e5e6b1fbdb8221855ad4613 (patch)
tree4a5e0b5a447ed75813fd4ef92c35f2e2fb4f1ac8 /js/Gruntfile.js
parentadb9dfeb350bdb92e998fefc2827ffe8b58256a2 (diff)
add basic files for js rewrite
Diffstat (limited to 'js/Gruntfile.js')
-rw-r--r--js/Gruntfile.js151
1 files changed, 151 insertions, 0 deletions
diff --git a/js/Gruntfile.js b/js/Gruntfile.js
new file mode 100644
index 000000000..04a48a1c4
--- /dev/null
+++ b/js/Gruntfile.js
@@ -0,0 +1,151 @@
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Bernhard Posselt 2012, 2014
+ */
+
+module.exports = function(grunt) {
+
+ // load needed modules
+ grunt.loadNpmTasks('grunt-contrib-concat');
+ grunt.loadNpmTasks('grunt-contrib-watch');
+ grunt.loadNpmTasks('grunt-contrib-jshint');
+ grunt.loadNpmTasks('grunt-jslint');
+ grunt.loadNpmTasks('grunt-phpunit');
+ grunt.loadNpmTasks('grunt-wrap');
+ grunt.loadNpmTasks('grunt-karma');
+ grunt.loadNpmTasks('grunt-ngmin');
+
+ grunt.initConfig({
+ meta: {
+ pkg: grunt.file.readJSON('package.json'),
+ version: '<%= meta.pkg.version %>',
+ production: 'build/'
+ },
+ concat: {
+ options: {
+ // remove license headers
+ stripBanners: true
+ },
+ dist: {
+ src: [
+ 'config/app.js',
+ 'config/config.js',
+ 'config/run.js',
+ 'filter/**/*.js',
+ 'service/**/*.js',
+ 'directive/**/*.js',
+ 'utilitie/**/*.js'
+ ],
+ dest: '<%= meta.production %>app.js'
+ }
+ },
+ ngmin: {
+ app: {
+ src: ['<%= meta.production %>app.js'],
+ dest: '<%= meta.production %>app.js',
+ }
+ },
+ wrap: {
+ basic: {
+ src: ['<%= meta.production %>app.js'],
+ dest: '<%= meta.production %>app.js',
+ options: {
+ wrapper: [
+ '(function(angular, $, OC, undefined){\n\n\'use strict\';\n\n',
+ '\n})(angular, jQuery, OC);'
+ ]
+ }
+ }
+ },
+ jslint: {
+ browser: {
+ src: [
+ 'tests/**/*.js',
+ 'config/app.js',
+ 'config/config.js',
+ 'config/run.js',
+ 'controller/**/*.js',
+ 'directive/**/*.js',
+ 'filter/**/*.js',
+ 'service/**/*.js',
+ ],
+ directives: {
+ browser: true,
+ predef: ['$', 'angular', 'app', 'OC']
+ }
+ }
+ },
+ jshint: {
+ all: [
+ '**/*.js',
+ '!config/karma.js',
+ '!build/**/*',
+ '!coverage/**/*',
+ '!vendor/**/*',
+ '!node_modules/**/*'
+ ],
+ options: {
+ jshintrc: true
+ }
+ },
+ watch: {
+ concat: {
+ files: [
+ 'tests/**/*.js',
+ 'config/**/*.js',
+ 'controller/**/*.js',
+ 'directive/**/*.js',
+ 'filter/**/*.js',
+ 'service/**/*.js',
+ ],
+ tasks: ['default']
+ },
+ phpunit: {
+ files: [
+ '../*/**.php',
+ '!../3rdparty',
+ ],
+ tasks: ['phpunit']
+ }
+ },
+ karma: {
+ unit: {
+ configFile: 'config/karma.js',
+ browsers: ['PhantomJS']
+ },
+ continuous: {
+ configFile: 'config/karma.js',
+ singleRun: true,
+ browsers: ['PhantomJS'],
+ preprocessors: {
+ 'build/app.js': 'coverage'
+ },
+ coverageReporter: {
+ type: 'lcovonly',
+ dir: 'coverage/',
+ file: 'coverage.lcov'
+ },
+ reporters: ['coverage']
+ }
+ },
+ phpunit: {
+ classes: {
+ dir: '../tests'
+ },
+ options: {
+ colors: true
+ }
+ }
+ });
+
+ // make tasks available under simpler commands
+ grunt.registerTask('default', ['jshint', 'jslint', 'concat', 'ngmin', 'wrap']);
+ grunt.registerTask('test', ['karma:unit']);
+ grunt.registerTask('ci', ['default', 'karma:continuous']);
+
+}; \ No newline at end of file