UNPKG

tooltwist

Version:
151 lines (135 loc) 3.74 kB
var IMAGE_DIR = '{{&HIDDEN_DIR}}/image'; var PRODUCTION_DIR = '{{&HIDDEN_DIR}}/outputs/production'; var PACKAGE_DIR = '{{&PROJECT_ROOT}}/WAR_PACKAGE'; module.exports = function(grunt){ grunt.initConfig({ exec: { generate_navpoints: { cwd: '{{&PROJECT_ROOT}}', command: 'tooltwist generate {{&PROJECT_NAME}} {{&GENERATE_OPTIONS}}' } }, mkdir: { all: { options: { mode: 0700, create: [ PACKAGE_DIR + '/site-conf.example/bin', PACKAGE_DIR + '/site-conf.example/conf', PACKAGE_DIR + '/site-conf.example/logs' ] }, }, }, copy: { "war-contents": { expand: true, dot: true, cwd: '{{&BUILD_DIR}}/exploded', src: '**', dest: IMAGE_DIR + '/tomcat/webapps/ttsvr', }, "generated-files": { expand: true, dot: true, cwd: '{{&HIDDEN_DIR}}/do_generate/work', src: '**', dest: IMAGE_DIR + '/tomcat/webapps/ttsvr', }, "webdesign-projects": { expand: true, dot: true, cwd: '{{&HIDDEN_DIR}}', src: 'webdesign-projects/**', dest: IMAGE_DIR, }, "extension-projects": { expand: true, dot: true, cwd: '{{&HIDDEN_DIR}}', src: 'extension-projects/**', dest: IMAGE_DIR, }, // Overwrite files in ttsvr, with files generated from templates "ttsvr": { expand: true, cwd: PRODUCTION_DIR, src: 'ttsvr/**', dest: IMAGE_DIR + '/tomcat/webapps', // rename: function(dest, src) { // return dest + "/web.xml"; // } }, // Make the config files easy for the user to see "README": { expand: true, cwd: PRODUCTION_DIR, src: [ 'README' ], dest: PACKAGE_DIR }, "exampleConfig": { expand: true, cwd: PRODUCTION_DIR + '/site-conf', src: [ '**' ], dest: PACKAGE_DIR + '/site-conf.example' }, "tomcatConfig": { expand: true, cwd: PRODUCTION_DIR + '/tomcat', src: [ '**' ], dest: PACKAGE_DIR + '/tomcat-conf.example' } }, // Create the war file war: { target: { options: { war_dist_folder: PACKAGE_DIR, /* Folder where to generate the WAR. */ war_name: 'ttsvr' /* The name fo the WAR file (.war will be the extension) */ }, files: [ { expand: true, cwd: IMAGE_DIR + '/tomcat/webapps/ttsvr', src: ['**'], dest: '' }, { expand: true, cwd: IMAGE_DIR + '/extension-projects', src: ['**'], dest: '/META-INF/extension-projects' }, { expand: true, cwd: IMAGE_DIR + '/webdesign-projects', src: ['**'], dest: '/META-INF/webdesign-projects' } ] } } }); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-exec'); grunt.loadNpmTasks('grunt-war'); grunt.loadNpmTasks('grunt-mkdir'); grunt.registerTask('default', [ 'exec:generate_navpoints', // Create directories "mkdir", // Create the image directory "copy:war-contents", "copy:generated-files", "copy:webdesign-projects", "copy:extension-projects", "copy:ttsvr", // Create the war file from the image directory 'war', // Copy files to the OUTPUTS directory // "copy:ttsvr.war", "copy:README", "copy:exampleConfig", "copy:tomcatConfig" ]); };