Skip to content

Commit

Permalink
added 'app' parameter and error support. Updated gruntfile to open ch…
Browse files Browse the repository at this point in the history
…rome and firefox
  • Loading branch information
GabLeRoux committed Jul 18, 2013
1 parent 4850333 commit 6f2c706
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 4 additions & 2 deletions Gruntfile.js
Expand Up @@ -12,10 +12,12 @@ module.exports = function(grunt) {
},
open : {
dev : {
path : 'http://127.0.0.1/~jsoverson/'
path : 'http://127.0.0.1/~jsoverson/',
app : 'firefox'
},
google : {
url : 'http://google.com/'
url : 'http://google.com/',
app : 'Google Chrome'
},
file : {
file : '/etc/hosts'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -30,7 +30,7 @@
"test": "grunt test"
},
"dependencies": {
"open": "~0.0.2"
"open": "~0.0.3"
},
"devDependencies": {
"grunt": "~0.4.0",
Expand Down
8 changes: 7 additions & 1 deletion tasks/open.js
Expand Up @@ -13,8 +13,14 @@ var open = require('open');
module.exports = function(grunt) {
grunt.registerMultiTask('open', 'Open urls and files from a grunt task', function() {
var dest = this.data.url || this.data.file || this.data.path;
var application = this.data.app || this.data.application;

open(dest);
function callback(error){
if (error !== null)
grunt.fail.warn(error);
}

open(dest, application, callback);

// give the spawn some time before its parent (us) dies
// https://github.com/onehealth/grunt-open/issues/6
Expand Down

0 comments on commit 6f2c706

Please sign in to comment.