Skip to content

Instantly share code, notes, and snippets.

@automaticgiant
Last active August 29, 2015 14:18
Show Gist options
  • Select an option

  • Save automaticgiant/2df64c748bcdfc8103d2 to your computer and use it in GitHub Desktop.

Select an option

Save automaticgiant/2df64c748bcdfc8103d2 to your computer and use it in GitHub Desktop.

Revisions

  1. automaticgiant revised this gist Apr 21, 2015. 2 changed files with 33 additions and 10 deletions.
    36 changes: 29 additions & 7 deletions Gruntfile.js
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,31 @@
    module.exports = function (grunt) {

    var assignment = 'HW5';
    var files = [assignment + '.html', assignment + '.css', assignment + '.js']

    var addr;

    var lookup = require('deasync')(require('dns').lookup);
    addr = lookup(require('os').hostname());

    // Project configuration.
    grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    connect: {
    options: {
    port: 8080,
    base: './',
    hostname: addr,
    livereload: true
    },
    server: {
    options: {
    port: 8080,
    base: './'
    hostname: addr
    }
    },
    local: {
    options: {
    hostname: 'localhost'
    }
    }
    },
    @@ -16,14 +34,18 @@ module.exports = function (grunt) {
    reload: true,
    livereload: true
    },
    hw4: {
    files: ['Gruntfile.js', 'HW4.*'],
    tasks: ['shell:package']
    hw5: {
    files: ['Gruntfile.js'].concat(files)
    },
    hw5pack: {
    files: files
    , tasks: ['shell:package']
    , debounceDelay: 5000
    }
    },
    shell: {
    package: {
    command: 'jar cvf HW4kp1108.jar HW4.html HW4.css HW4.js'
    command: 'jar cvf ' + assignment + 'kp1108.jar ' + files.join(' ')
    }
    }
    });
    @@ -36,4 +58,4 @@ module.exports = function (grunt) {
    grunt.registerTask('default', ['shell:package', 'connect', 'watch']);
    // grunt.registerTask('package')

    };
    };
    7 changes: 4 additions & 3 deletions package.json
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    {
    "name": "hw4",
    "name": "hw5",
    "version": "1.0.0",
    "description": "cs3744 hw4",
    "description": "cs3744 hw5",
    "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "grunt"
    @@ -13,6 +13,7 @@
    "grunt": "^0.4.5",
    "grunt-contrib-connect": "^0.10.1",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-shell": "^1.1.2"
    "grunt-shell": "^1.1.2",
    "deasync": "0.0.10"
    }
    }
  2. automaticgiant created this gist Apr 4, 2015.
    39 changes: 39 additions & 0 deletions Gruntfile.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    module.exports = function (grunt) {

    // Project configuration.
    grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    connect: {
    server: {
    options: {
    port: 8080,
    base: './'
    }
    }
    },
    watch: {
    options: {
    reload: true,
    livereload: true
    },
    hw4: {
    files: ['Gruntfile.js', 'HW4.*'],
    tasks: ['shell:package']
    }
    },
    shell: {
    package: {
    command: 'jar cvf HW4kp1108.jar HW4.html HW4.css HW4.js'
    }
    }
    });

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-shell');

    // Default task(s).
    grunt.registerTask('default', ['shell:package', 'connect', 'watch']);
    // grunt.registerTask('package')

    };
    18 changes: 18 additions & 0 deletions package.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    {
    "name": "hw4",
    "version": "1.0.0",
    "description": "cs3744 hw4",
    "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "grunt"
    },
    "author": "automaticgiant",
    "license": "GPLv2",
    "dependencies": {
    "connect": "^3.3.5",
    "grunt": "^0.4.5",
    "grunt-contrib-connect": "^0.10.1",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-shell": "^1.1.2"
    }
    }