From a2e65b001855416c919c817689fa2caceee9c403 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 9 Apr 2015 21:12:39 +0100 Subject: [PATCH] Prepend copyright to built editor files --- Gruntfile.js | 58 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index db93ad48d..311fc8d01 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -138,6 +138,18 @@ module.exports = function(grunt) { }] } }, + attachCopyright: { + js: { + src: [ + 'public/red/red.min.js' + ] + }, + css: { + src: [ + 'public/red/style.min.css' + ] + } + }, clean: { build: { src: [ @@ -159,13 +171,13 @@ module.exports = function(grunt) { files: [ 'editor/js/**/*.js' ], - tasks: ['concat','uglify'] + tasks: ['concat','uglify','attachCopyright:js'] }, sass: { files: [ 'editor/sass/**/*.scss' ], - tasks: ['sass'] + tasks: ['sass','attachCopyright:css'] } }, @@ -260,6 +272,46 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-compress'); grunt.loadNpmTasks('grunt-contrib-copy'); + grunt.registerMultiTask('attachCopyright', function() { + var files = this.data.src; + var copyright = "/**\n"+ + " * Copyright 2013, 2015 IBM Corp.\n"+ + " *\n"+ + " * Licensed under the Apache License, Version 2.0 (the \"License\");\n"+ + " * you may not use this file except in compliance with the License.\n"+ + " * You may obtain a copy of the License at\n"+ + " *\n"+ + " * http://www.apache.org/licenses/LICENSE-2.0\n"+ + " *\n"+ + " * Unless required by applicable law or agreed to in writing, software\n"+ + " * distributed under the License is distributed on an \"AS IS\" BASIS,\n"+ + " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"+ + " * See the License for the specific language governing permissions and\n"+ + " * limitations under the License.\n"+ + " **/\n"; + + if (files) { + for (var i=0;i