12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- module.exports = function(grunt) {
- basicPath = 'static/js/threeJsHelper/';
- sshServers = {};
- sshServers['compute3'] = 'ipepdvcompute3.ipe.kit.edu';
- sshServers['anka'] = 'anka-visualize.anka.kit.edu';
- username = 'visualization';
- tarName = '<%= pkg.name %>.tar';
- deployCommand = function(env, server) {
- var command = 'ssh ' + username + '@' + sshServers[server]
- + ' "cd /usr/local/www/;'
- + 'rm -rf <%= pkg.name %>;'
- + 'tar -xf ' + tarName + ';'
- + 'cp -r <%= pkg.name %>/* visualization-' + env + '/;"'
- + 'cp visualization-' + env + '/visualization/settings_env.py.' + env + '.' + server + ' visualization-' + env + '/visualization/settings_env.py;';
- return command;
- }
- var env = grunt.option('env') || 'staging';
- var server = grunt.option('server') || 'compute3';
- grunt.initConfig({
- pkg: grunt.file.readJSON('package.json'),
- concat: {
- options: {
- separator: ';'
- },
- dist: {
- src: [ basicPath + 'src/**/*.js' ],
- dest: basicPath + 'dist/<%= pkg.jsname %>.js'
- }
- },
- shell: {
- pkg: {
- command: 'tar -cf ' + tarName + ' ../<%= pkg.name %>/* --exclude=settings_env.py --exclude=node_modules --exclude=__pycache__ --exclude=Gruntfile.js --exclude=startDev.sh --exclude=manage.py'
- },
- rmPkg: {
- command: 'rm ' + tarName
- },
- scp: {
- command: 'scp ' + tarName + ' visualization@' + sshServers[server] + ':/usr/local/www/'
- },
- deploy: {
- command: deployCommand(env, server)
- },
- bumbVersion: {
- command: 'npm version patch'
- }
- },
- watch: {
- scripts: {
- files: [ basicPath + 'src/**/*.js' ],
- tasks: ['dev-watch'],
- options : {
- interrupt: true
- }
- }
- }
- });
- grunt.loadNpmTasks('grunt-contrib-concat');
- grunt.loadNpmTasks('grunt-contrib-watch');
- grunt.loadNpmTasks('grunt-shell');
- grunt.registerTask('default', ['concat']);
- grunt.registerTask('dev-watch', ['concat:dist']);
- grunt.registerTask('update-version', ['shell:bumbVersion']);
- grunt.registerTask('deploy', ['concat', 'shell:pkg', 'shell:scp', 'shell:rmPkg', 'shell:deploy']);
- };
|