Skip to content

Commit

Permalink
Merge pull request #2 from cloud8421/option-not-to-run-indefinitely
Browse files Browse the repository at this point in the history
Adds option not to run indefinitely.
  • Loading branch information
iammerrick committed Feb 16, 2013
2 parents 8823064 + 6e72092 commit 55bb60e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
11 changes: 8 additions & 3 deletions README.md
@@ -1,6 +1,6 @@
# grunt-connect

Run a connect server, indefinitely. The built in Grunt server task is terrific for the great majority of cases, however sometimes you just want to ability to run a web server on a local file system and interact with the files using a web browser.
Run a connect server. The built in Grunt server task is terrific for the great majority of cases, however sometimes you just want to ability to run a web server on a local file system and interact with the files using a web browser. For that reason, grunt-connect's default behaviour is to run indefinitely.

## Getting Started
Install this grunt plugin next to your project's [grunt.js gruntfile][getting_started] with: `npm install grunt-connect`
Expand Down Expand Up @@ -33,12 +33,17 @@ grunt.initConfig({
port: 1337,
base: 'example'
},
meta: {
test: {
port: 1338,
base: 'test',
keepAlive: false
},
meta: {
port: 1339,
base: 'tasks'
},
combined: {
port: 1339,
port: 1340,
combine: [
'example',
'tasks'
Expand Down
3 changes: 2 additions & 1 deletion grunt.js
Expand Up @@ -35,7 +35,8 @@ module.exports = function(grunt) {
},
meta: {
port: 1338,
base: 'tasks'
base: 'tasks',
keepAlive: false
},
combined: {
port: 1339,
Expand Down
8 changes: 6 additions & 2 deletions tasks/connect.js
Expand Up @@ -20,8 +20,12 @@ module.exports = function(grunt) {
// ==========================================================================

grunt.registerMultiTask('connect', 'Run a simple static connect server till you shut it down.', function() {
// Don't ever close this task!
this.async();

var keepAlive = this.data.keepAlive;

if (keepAlive === undefined || keepAlive === true) {
this.async();
}

var port = this.data.port || 1337;
var bases = [];
Expand Down

0 comments on commit 55bb60e

Please sign in to comment.