From a8bb23099064fea5cc1a626c4da565c0f8b38fb5 Mon Sep 17 00:00:00 2001 From: Tim Kang Date: Fri, 20 Feb 2015 20:48:30 -0800 Subject: [PATCH] Make it more clear that the server is listening on INADDR_ANY --- tasks/lib/livereload.js | 4 ++-- test/tasks/livereload_test.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tasks/lib/livereload.js b/tasks/lib/livereload.js index a1f0010..6999ac0 100644 --- a/tasks/lib/livereload.js +++ b/tasks/lib/livereload.js @@ -27,7 +27,7 @@ module.exports = function(grunt) { options = _.defaults(options, defaults); } - var host = (options.hostname || '') + ':' + options.port; + var host = (options.host || '*') + ':' + options.port; if (servers[host]) { this.server = servers[host]; @@ -42,7 +42,7 @@ module.exports = function(grunt) { } process.exit(1); }); - this.server.listen(options.port, options.hostname, function (err) { + this.server.listen(options.port, options.host, function(err) { if (err) { return grunt.fatal(err); } grunt.log.verbose.writeln('Live reload server started on ' + host); }); diff --git a/test/tasks/livereload_test.js b/test/tasks/livereload_test.js index dcc0039..67c8328 100644 --- a/test/tasks/livereload_test.js +++ b/test/tasks/livereload_test.js @@ -56,7 +56,7 @@ exports.livereload = { result = helper.unixify(result); helper.verboseLog(result); test.ok(result.indexOf('I ran before livereload.') !== -1, 'task should have ran before live reload.'); - test.ok(result.indexOf('Live reload server started on :35729') !== -1, + test.ok(result.indexOf('Live reload server started on *:35729') !== -1, 'live reload server should have been started on port 35729.'); test.ok(result.indexOf('Live reloading lib/one.js...') !== -1, 'live reload should have triggered on lib/one.js'); resultData = JSON.parse(resultData); @@ -119,7 +119,7 @@ exports.livereload = { result = helper.unixify(result); helper.verboseLog(result); test.ok(result.indexOf('I ran before livereload.') !== -1, 'task should have ran before live reload.'); - test.ok(result.indexOf('Live reload server started on :9876') !== -1, + test.ok(result.indexOf('Live reload server started on *:9876') !== -1, 'live reload server should have been started on port 9876.'); test.ok(/Live reloading (lib\/one\.js, lib\/two.js|lib\/two.js, lib\/one.js)\.\.\./.test(result), 'live reload should have triggered on lib/one.js and lib/two.js'); @@ -142,7 +142,7 @@ exports.livereload = { result = helper.unixify(result); helper.verboseLog(result); test.ok(result.indexOf('I ran before livereload.') !== -1, 'task should have ran before live reload.'); - test.ok(result.indexOf('Live reload server started on :1337') !== -1, + test.ok(result.indexOf('Live reload server started on *:1337') !== -1, 'live reload server should have been started on port 1337.'); test.ok(result.indexOf('Live reloading lib/one.js...') !== -1, 'live reload should have triggered on lib/one.js'); resultData = JSON.parse(resultData); @@ -163,7 +163,7 @@ exports.livereload = { }], function(result) { result = helper.unixify(result); helper.verboseLog(result); - test.ok(result.indexOf('Live reload server started on :35729') !== -1, + test.ok(result.indexOf('Live reload server started on *:35729') !== -1, 'live reload server should have been started on port 35729.'); test.ok(result.indexOf('Live reloading lib/one.js...') !== -1, 'live reload should have triggered on lib/one.js'); resultData = JSON.parse(resultData);