Gruntfile.js revision 1d407e39b7d8f68d9a2b1e178f35fab037d9835a
70N/A/**
70N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
70N/A *
70N/A * Copyright (c) 2015 ForgeRock AS. All Rights Reserved
70N/A *
70N/A * The contents of this file are subject to the terms
70N/A * of the Common Development and Distribution License
70N/A * (the License). You may not use this file except in
70N/A * compliance with the License.
70N/A *
70N/A * You can obtain a copy of the License at
70N/A * http://forgerock.org/license/CDDLv1.0.html
70N/A * See the License for the specific language governing
70N/A * permission and limitations under the License.
70N/A *
70N/A * When distributing Covered Code, include this CDDL
70N/A * Header Notice in each file and include the License file
70N/A * at http://forgerock.org/license/CDDLv1.0.html
70N/A * If applicable, add the following below the CDDL Header,
70N/A * with the fields enclosed by brackets [] replaced by
70N/A * your own identifying information:
70N/A * "Portions Copyrighted [year] [name of copyright owner]"
70N/A */
70N/A
70N/Amodule.exports = function (grunt) {
70N/A grunt.initConfig({
70N/A // please update OPENAM_VERSION after realise, for fix cache issue
70N/A buildNumber: process.env.OPENAM_VERSION,
70N/A destination: process.env.OPENAM_HOME,
70N/A forgerockui: process.env.FORGEROCK_UI_SRC,
70N/A replace: {
70N/A html: {
70N/A src: ['src/main/resources/index.html'],
70N/A dest: '<%= destination %>/scripts/index.html',
70N/A replacements: [{
70N/A from: '${version}',
70N/A to: '<%= buildNumber %>'
70N/A }]
70N/A },
70N/A style: {
70N/A src: ['src/main/resources/css/styles.less'],
70N/A dest: '<%= destination %>/scripts/css/styles.less',
70N/A replacements: [{
70N/A from: '${version}',
70N/A to: '<%= buildNumber %>'
70N/A }]
70N/A },
70N/A test: {
70N/A // temporary fix for test
70N/A src: ['src/main/resources/css/styles.less'],
70N/A dest: '<%= destination %>/../www/css/styles.less',
70N/A replacements: [{
70N/A from: '?v=@{openam-version}',
70N/A to: ''
70N/A }]
70N/A }
70N/A },
70N/A sync: {
70N/A source_to_test: {
70N/A files: [
{
cwd: 'target/dependency',
src: ['**'],
dest: 'target/www'
},
{
cwd: 'target/codemirror-4.10',
src: ['lib/codemirror.js', 'mode/javascript/javascript.js', 'mode/groovy/groovy.js'],
dest: 'target/www/libs/codemirror'
},
{
cwd: 'test/libs',
src: ['**'],
dest: '../../target/www/libs'
},
{
cwd: 'src/main/js',
src: ['**'],
dest: 'target/www'
},
{
cwd: 'src/main/resources',
src: ['**'],
dest: 'target/www'
},
{
cwd: 'src/test/resources',
src: ['**'],
dest: 'target/test'
},
{
cwd: 'src/test/js',
src: ['**'],
dest: 'target/test'
}
],
verbose: true
},
source_css_to_test: {
files: [
{
cwd: 'target/www',
src: ['css/**/*.css'],
dest: 'target/test'
}
],
verbose: true
},
source_to_tomcat: {
files: [
{
cwd: '<%= forgerockui %>/forgerock-ui-commons/src/main/js',
src: ['**/*'],
dest: '<%= destination %>/scripts'
},
{
cwd: '<%= forgerockui %>/forgerock-ui-commons/src/main/resources',
src: ['**/*'],
dest: '<%= destination %>/scripts'
},
{
cwd: 'src/main/resources',
src: ['**/*'],
dest: '<%= destination %>/scripts'
},
{
cwd: 'src/main/js',
src: ['**/*'],
dest: '<%= destination %>/scripts'
},
{
cwd: 'target/test',
src: ['**'],
dest: '<%= destination %>/../test'
},
{
cwd: 'target/www',
src: ['**'],
dest: '<%= destination %>/../www'
}
],
verbose: true
}
},
watch: {
editor: {
files: [
'<%= forgerockui %>/forgerock-ui-commons/src/main/js/**',
'<%= forgerockui %>/forgerock-ui-commons/src/main/resources/**',
'src/main/js/**',
'src/main/resources/**',
'src/test/js/**',
'src/test/resources/**'
],
tasks: ['sync', 'replace', 'qunit']
}
},
qunit: {
all: ['target/test/qunit.html']
},
notify_hooks: {
options: {
enabled: true,
title: "OpenAM Scripts Editor"
}
}
});
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-notify');
grunt.loadNpmTasks('grunt-sync');
grunt.loadNpmTasks('grunt-text-replace');
grunt.task.run('notify_hooks');
grunt.registerTask('default', [
'sync:source_to_test',
'sync:source_css_to_test',
'sync:source_to_tomcat',
'replace',
'qunit',
'watch']);
};