|
| 1 | +#jshint node: true, camelcase: false |
| 2 | +"use strict" |
| 3 | +module.exports = (grunt) -> |
| 4 | + grunt.initConfig |
| 5 | + pkg: grunt.file.readJSON("package.json") |
| 6 | + connect: |
| 7 | + demo: |
| 8 | + options: |
| 9 | + hostname: "*" # make accessible from everywhere |
| 10 | + port: 8080 |
| 11 | + base: "./" |
| 12 | + keepalive: true |
| 13 | + |
| 14 | + sauce: |
| 15 | + options: |
| 16 | + hostname: "localhost" |
| 17 | + port: 9999 |
| 18 | + base: "" |
| 19 | + keepalive: false |
| 20 | + |
| 21 | + exec: |
| 22 | + tabfix: |
| 23 | + # Cleanup whitespace according to http://contribute.jquery.org/style-guide/js/ |
| 24 | + # (requires https://github.com/mar10/tabfix) |
| 25 | + cmd: "tabfix -t -r -m *.js,*.css,*.html,*json,*.yaml -i node_modules ." |
| 26 | + |
| 27 | + upload: |
| 28 | + # FTP upload the demo files (requires https://github.com/mar10/pyftpsync) |
| 29 | + cmd: "pyftpsync --progress upload . ftp://www.wwwendt.de/tech/demo/jquery-contextmenu --delete-unmatched --omit dist,node_modules,.*,_* -x" |
| 30 | + |
| 31 | + jshint: |
| 32 | + files: ["Gruntfile.js", "jquery.ui-contextmenu.js", "test/tests.js"] |
| 33 | + options: |
| 34 | + jshintrc: ".jshintrc" |
| 35 | + |
| 36 | + qunit: |
| 37 | + all: ["test/index.html"] |
| 38 | + |
| 39 | + "saucelabs-qunit": |
| 40 | + all: |
| 41 | + options: |
| 42 | + urls: ["http://localhost:9999/test/index.html"] |
| 43 | + |
| 44 | + # username: process.env.SAUCE_USERNAME, |
| 45 | + # key: process.env.SAUCE_ACCESS_KEY, |
| 46 | + tunnelTimeout: 5 |
| 47 | + build: process.env.TRAVIS_JOB_ID |
| 48 | + concurrency: 3 |
| 49 | + browsers: [ |
| 50 | + { browserName: "chrome", platform: "Windows 7" } |
| 51 | + { browserName: "firefox", platform: "Windows 7" } |
| 52 | + { browserName: "firefox", platform: "Windows XP" } |
| 53 | + { browserName: "firefox", platform: "Linux" } |
| 54 | + { browserName: "internet explorer", version: "6", platform: "Windows XP" } |
| 55 | + { browserName: "internet explorer", version: "7", platform: "Windows XP" } |
| 56 | + { browserName: "internet explorer", version: "8", platform: "Windows XP" } |
| 57 | + { browserName: "internet explorer", version: "9", platform: "Windows 7" } |
| 58 | + { browserName: "internet explorer", version: "10", platform: "Windows 8" } |
| 59 | + { browserName: "internet explorer", version: "11", platform: "Windows 8.1" } |
| 60 | + { browserName: "safari", platform: "OS X 10.8" } |
| 61 | + ] |
| 62 | + testname: "jquery.ui-contextmenu qunit tests" |
| 63 | + |
| 64 | + uglify: |
| 65 | + options: |
| 66 | + banner: "/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - " + "<%= grunt.template.today('yyyy-mm-dd') %> | " + "<%= pkg.homepage ? ' ' + pkg.homepage + ' | ' : '' %>" + " Copyright (c) <%= grunt.template.today('yyyy') %> <%= pkg.author.name %>;" + " Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %> */\n" |
| 67 | + report: "gzip" |
| 68 | + |
| 69 | + build: |
| 70 | + src: "jquery.ui-contextmenu.js" |
| 71 | + dest: "jquery.ui-contextmenu.min.js" |
| 72 | + |
| 73 | + |
| 74 | + # Load "grunt*" dependencies |
| 75 | + for key of grunt.file.readJSON("package.json").devDependencies |
| 76 | + grunt.loadNpmTasks key if key isnt "grunt" and key.indexOf("grunt") is 0 |
| 77 | + |
| 78 | + grunt.registerTask "server", ["connect:demo"] |
| 79 | + grunt.registerTask "test", ["jshint", "qunit"] |
| 80 | + grunt.registerTask "sauce", ["connect:sauce", "saucelabs-qunit"] |
| 81 | + grunt.registerTask "travis", ["test", "sauce"] |
| 82 | + grunt.registerTask "default", ["test"] |
| 83 | + |
| 84 | + # "sauce", |
| 85 | + grunt.registerTask "build", ["exec:tabfix", "test", "uglify"] |
| 86 | + grunt.registerTask "upload", ["build", "exec:upload"] |
| 87 | + grunt.registerTask "server", ["connect:demo"] |
0 commit comments