├── .npmignore ├── CONTRIBUTING.md ├── .gitignore ├── .travis.yml ├── package.json ├── tasks └── weinre.js ├── LICENSE ├── Gruntfile.js └── README.md /.npmignore: -------------------------------------------------------------------------------- 1 | Gruntfile.js 2 | test 3 | .travis.yml 4 | CONTRIBUTING.md -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Reporting issues 2 | 3 | If you are reporting an issue here, please make sure that the issue is with grunt-weinre and not weinre. -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | lib-cov 2 | *.seed 3 | *.log 4 | *.csv 5 | *.dat 6 | *.out 7 | *.pid 8 | *.gz 9 | 10 | pids 11 | logs 12 | results 13 | 14 | npm-debug.log 15 | node_modules 16 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "0.11" 4 | - "0.10" 5 | - "0.8" 6 | before_script: 7 | - npm install -g grunt-cli 8 | notifications: 9 | email: false 10 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "grunt-weinre", 3 | "version": "0.0.3", 4 | "description": "Grunt task to run a weinre server to debug your mobile web site/app.", 5 | "scripts": { 6 | "test": "grunt test" 7 | }, 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/ChrisWren/grunt-weinre.git" 11 | }, 12 | "keywords": [ 13 | "gruntplugin", 14 | "weinre", 15 | "server" 16 | ], 17 | "author": "Chris Wren", 18 | "license": "MIT", 19 | "peerDependencies": { 20 | "grunt": "~0.4.1" 21 | }, 22 | "devDependencies": { 23 | "grunt": "~0.4.1", 24 | "grunt-release": "~0.5.1", 25 | "grunt-contrib-jshint": "~0.6.2", 26 | "matchdep": "~0.1.2", 27 | "grunt-mdlint": "0.0.0" 28 | }, 29 | "dependencies": { 30 | "weinre": "~2.0.0-pre-I0Z7U9OV" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tasks/weinre.js: -------------------------------------------------------------------------------- 1 | /* 2 | * grunt-weinre 3 | * https://github.com/ChrisWren/grunt-weinre 4 | * 5 | * Copyright (c) 2013 Chris Wren 6 | * Licensed under the MIT license. 7 | */ 8 | module.exports = function (grunt) { 9 | 'use strict'; 10 | 11 | grunt.registerMultiTask('weinre', 'Runs a weinre server to debug your mobile web site/app.', function () { 12 | 13 | var options = this.options(); 14 | var done = this.async(); 15 | var args = [require.resolve('weinre/weinre')]; 16 | 17 | [ 18 | 'httpPort', 19 | 'boundHost', 20 | 'verbose', 21 | 'debug', 22 | 'readTimeout', 23 | 'deathTimeout' 24 | ].forEach(function (option) { 25 | if (option in options) { 26 | args.push('--' + option); 27 | args.push(options[option]); 28 | } 29 | }); 30 | 31 | grunt.util.spawn({ 32 | cmd: 'node', 33 | args: args, 34 | opts: { 35 | stdio: 'inherit' 36 | } 37 | }, 38 | function (error) { 39 | if (error) { 40 | grunt.fail.fatal(error); 41 | } 42 | done(); 43 | }); 44 | }); 45 | }; 46 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Chris Wren 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); 3 | grunt.initConfig({ 4 | weinre: { 5 | all: { 6 | options: { 7 | httpPort: 8081, 8 | boundHost: '-all-', 9 | verbose: true, 10 | debug: true, 11 | readTimeout: 10, 12 | deathTimeout: 15 13 | } 14 | }, 15 | empty: {} 16 | }, 17 | mdlint: ['README.md'], 18 | jshint: { 19 | options: { 20 | bitwise: true, 21 | indent: 2, 22 | eqeqeq: true, 23 | immed: true, 24 | latedef: true, 25 | newcap: true, 26 | noarg: true, 27 | nonew: true, 28 | quotmark: 'single', 29 | sub: true, 30 | undef: true, 31 | unused: true, 32 | boss: true, 33 | trailing: true, 34 | eqnull: true, 35 | node: true, 36 | expr: true, 37 | evil: true, 38 | globals: { 39 | describe: true, 40 | it: true, 41 | before: true 42 | } 43 | }, 44 | files: { 45 | src: ['*.js', 'tasks/*.js'] 46 | } 47 | } 48 | }); 49 | 50 | grunt.registerTask('default', ['weinre']); 51 | grunt.registerTask('test', ['jshint', 'mdlint']); 52 | 53 | grunt.loadTasks('tasks'); 54 | 55 | }; 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # grunt-weinre 2 | > Run [weinre](http://people.apache.org/~pmuellr/weinre/) as a grunt task for easy configuration and integration with the rest of your workflow 3 | 4 | [![NPM version](https://badge.fury.io/js/grunt-weinre.png)](http://badge.fury.io/js/grunt-weinre) [![Dependency Status](https://gemnasium.com/ChrisWren/grunt-weinre.png)](https://gemnasium.com/ChrisWren/grunt-weinre) 5 | 6 | ## Getting Started 7 | If you haven't used grunt before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a gruntfile as well as install and use grunt plugins. Once you're familiar with that process, install this plugin with this command: 8 | 9 | ```shell 10 | npm install grunt-weinre --save-dev 11 | ``` 12 | 13 | Then add this line to your project's `Gruntfile.js` gruntfile: 14 | 15 | ```javascript 16 | grunt.loadNpmTasks('grunt-weinre'); 17 | ``` 18 | 19 | ## Documentation 20 | 21 | ### Usage 22 | The minimal usage of weinre runs with no options: 23 | ```js 24 | weinre: { 25 | dev: {} 26 | } 27 | ``` 28 | 29 | ### Recommended Usage 30 | 31 | The default HTTP port of 8080 is pretty popular, so offsetting it by 2 may help you dodge a collision. Also setting the `boundHost` to `-all-` will let your mobile devices connect via your local ip address, since the default `localhost` won't work for them. 32 | 33 | ```js 34 | weinre: { 35 | dev: { 36 | options: { 37 | httpPort: 8082, 38 | boundHost: '-all-' 39 | } 40 | } 41 | } 42 | ``` 43 | 44 | ### Usage with all available options(with their default values): 45 | 46 | ```js 47 | weinre: { 48 | dev: { 49 | options: { 50 | httpPort: 8080, 51 | boundHost: 'localhost', 52 | verbose: false, 53 | debug: false, 54 | readTimeout: 5, 55 | deathTimeout: 15 56 | } 57 | } 58 | } 59 | ``` 60 | 61 | #### Running weinre concurrently 62 | A common use case is to run `weinre` with other tasks concurrently. This can be achieved with the following config for the [grunt-concurrent](https://github.com/sindresorhus/grunt-concurrent) plugin which runs weinre, [nodemon](https://github.com/ChrisWren/grunt-nodemon), [node-inspector](https://github.com/ChrisWren/grunt-node-inspector), and [watch](https://github.com/gruntjs/grunt-contrib-watch) in a single terminal tab: 63 | 64 | ```js 65 | concurrent: { 66 | dev: { 67 | tasks: ['weinre', 'nodemon', 'node-inspector', 'watch'], 68 | options: { 69 | logConcurrentOutput: true 70 | } 71 | } 72 | } 73 | ``` 74 | 75 | ### Options 76 | 77 | #### httpPort 78 | Type: `Number` Default: `8080` 79 | 80 | Port to run the http server on. 81 | 82 | ### boundHost 83 | Type: `String` Default: `'localhost'` 84 | 85 | IP address to bind the server to. 86 | 87 | ### verbose 88 | Type: `Boolean` Default: `false` 89 | 90 | Print more diagnostics. 91 | 92 | ### debug 93 | Type: `Boolean` Default: `false` 94 | 95 | Print even more diagnostics. 96 | 97 | ### readTimeout 98 | Type: `Number` Default: `5` 99 | 100 | Seconds to wait for a client message. 101 | 102 | ### deathTimeout 103 | Type: `Number` Default: `3 * readTimeout` 104 | 105 | Seconds to wait to kill client. 106 | 107 | # Changelog 108 | 109 | **0.0.2** - Fixed error logging, allowed weinre to be listed as an app dependency. 110 | 111 | **0.0.1** - Initial release. 112 | --------------------------------------------------------------------------------