/*
 * livereloadx
 * https://github.com/nitoyon/livereloadx
 *
 * Copyright (c) 2013 nitoyon
 * Licensed under the MIT license.
 */

'use strict';

module.exports = function(grunt) {

  grunt.registerTask('livereloadx', 'LiveReloadX server', function() {
    // initialize log
    var log_mod = require('../lib/log')
      , config_mod = require('../lib/config');
    log_mod.cli = true;
    if (grunt.option('debug') || grunt.option('verbose')) {
      log_mod.verbose = true;
    }

    // get config
    var log = log_mod('grunt');
    try {
      var config = config_mod.setDefaultValue(grunt.config(this.name));
      config_mod.dump(log.info.bind(log), config);
    } catch (e) {
      grunt.log.error(e);
      return false;
    }

    // start server
    var server = require('../')(config);
    server.listen().watch();
    grunt.log.writeln('LiveReloadX started.');
  });
};

@@ -474,24 +474,314 @@
 rue;%0A    %7D%0A%0A
+    // initialize wait%0A    var config = grunt.config(this.name);%0A    if ('wait' in config) %7B%0A      if (config%5B'wait'%5D) %7B%0A        // never go to next task%0A        this.async();%0A      %7D%0A      // delete wait property because config_mod report it as invalid%0A      delete config%5B'wait'%5D;%0A    %7D%0A%0A
     // get c
@@ -830,28 +830,24 @@
 try %7B%0A      
-var 
 config = con
@@ -870,39 +870,22 @@
 ltValue(
-grunt.config(this.name)
+config
 );%0A     

grunt task: add `wait` parameter