Initialize a new `Operation`.

@param {Object} spec
@param {Object} options
@param {Function} fn
@api public
347301
function Operation(spec, options, fn) {
  if (typeof options === 'function') {
    fn = [].slice.call(arguments).slice(1);
    options = {};
  } else if (Array.isArray(options)) {
    fn = options;
    options = {};
  } else if (!Array.isArray(fn)) {
    fn = [].slice.call(arguments).slice(2);
  }

  if (!(this instanceof Operation)) {
    return new Operation(spec, options, fn);
  }

  if (typeof spec !== 'object') {
    throw new Error('operation spec must be an object');
  }

  debug('create operation', spec);

  this.spec = spec;
  this.options = options || {};
  this.fn = fn;
  this.middleware = {};
}
461920
function CLIEngine(options) {

  /**
   * Stored options for this instance
   * @type {Object}
   */
  this.options = assign(Object.create(defaultOptions), options || {});

  // load in additional rules
  if (this.options.rulePaths) {
    this.options.rulePaths.forEach(function(rulesdir) {
      rules.load(rulesdir);
    });
  }
}
348142
function createFunction (test, options) {
    return new DuckType({
      name: options && options.name || null,
      test: test
    });
  }
178376
function Module(options) {
    var module = this;
    options = options || {};

    /**
     * Whether the module is initialized.
     * @property {Boolean} [initialized=false]
     */
    module.initialized = false;
    /**
     * Whether the module is running.
     * @property {Boolean} [running=false]
     */
    module.running = false;

    ['init', 'start', 'stop', 'exit'].forEach(function(name) {
        var method = options[name];
        if (method) {
            var setMethod = 'set' + name[0].toUpperCase() + name.slice(1) + 'Method';
            module[setMethod](method);
        }
    });
}
1069704
public void process(Map<String, String> options) {
        Log.info("Initializing Commands...");
        for (Map.Entry<String, String> entry : options.entrySet()) {
            AbstractCommand command = PreConfigurationContext.getCommandByName(entry.getKey());
            if (null != command) {
                command.setCommands(options);
                try {
                    command.init();
                } catch (InitializationException e) {
                    Log.error("There is a problem in the option you configured: ", entry.getKey(),
                            ErrorGuide.getGuide(ErrorGuide.OPTION_ERROR));
                }
                command.execute();
                command.stop();
            }
            Log.info(entry.getKey() + " Command Initialized.");
        }
    }
1091281
function init(options) {
    self.email = options.email;
    self.key = options.token;
    self.cloudflareClient = new CloudFlareClient(options.email, options.token);
  }
1109039
def first(spec)
      spec.view_parameters = spec.view_parameters.merge({:limit => 1})
      view(spec).first
    end
780726
function(name, fn) {
    // Init options.
    var opts = {
      name: name,
      methods: {}
    };
    _.each(methodNames, function(methodName) {
      opts.methods[methodName] = function() {
        throw new Error('Method not implemented : ' + methodName);
      };
    });
    // Give options to callback function for decoration.
    fn(opts);
    // Return options.
    return opts;
  }
1119036
function init(options){

    return Promise.resolve()
      .then(function() {

        if(!_.get(parameters,'process.source')){
          return;
        }

        return Promise.resolve()
          .then(function() {
            return updateAllKeys(options);
          })
          .then(function() {
            return createMissingFolders(options);
          })
          .then(function() {
            return deleteUnused(options);
          })
          .then(function() {
            return deleteEmptyFolders(options);
          });

      })
      .then(function() {

        if(!_.get(parameters,'process.search')){
          return;
        }

        return require('./search')(util,options);

      })
      .then(function() {
        util.log('Sync is complete');
      });

  }
176158
function load (spec, callback) {
    if ((spec instanceof Array) ||
        Object.prototype.toString.call(spec) === "[object Array]") {
      if (callback) {
        // load multiple and join on callback
        var countdown = spec.length;
        for (var i=0;i<spec.length;++i) {(function(u){
          load(u, function (err) {
            if (err) {
              countdown = 0;
              //throw err;
              callback(err);
            } else if (--countdown === 0) {
              callback();
            }
          });
        })(spec[i]);}
      } else {
        // load multiple (blocking) -- don't use this for network resources
        for (var i=0;i<spec.length;++i) {
          load(spec[i]);
        }
      }
      return;
    } else if (typeof spec === 'string') {
      spec = {url:spec};
    }
    if (!spec.url && spec.id) {
      spec.url = spec.id + '.js';
    } else if (spec.url && !spec.id) {
      var m = /^[^\/]+\/\/[^\/]+\/(.+)$/.exec(spec.url);
      if (m) {
        spec.id = m[1];
      } else {
        spec.id = spec.url;
      }
      spec.id = spec.id.replace(/\.[^\.]+$/, '');
    } else if (!spec.url && !spec.id) {
      throw new TypeError('missing both "url" and "id"');
    }
    // normalize url
    spec.url = normalizeUrl(spec.url, window.location);
    var xhr = new XMLHttpRequest();
    var async = !!callback;
    function evalResponse() {
      try {
        eval('require.define("'+spec.id+'",'+
             ' "'+spec.url.replace(/"/g, '\\"')+'"'+
             ', function (require, module, exports) {'+xhr.responseText+'});');
      } catch (err) {
        err.message += ' in '+spec.url;
        throw err;
      }
    }
    xhr.open('GET', spec.url, async);
    if (async) {
      xhr.onreadystatechange = function (ev) {  
        if (xhr.readyState == 4) {
          if ((xhr.status < 300 && xhr.status >= 200)
            || (xhr.status === 0 && !spec.url.match(/^(?:https?|ftp):\/\//i))) {
            try {
              evalResponse();
              callback(null);
            } catch (err) {
              callback(err);
            }
          } else {
            callback(new Error('failed to load remote module with HTTP'+
                               ' response status '+xhr.status+' '+
                               xhr.responseText));
          }
        }
      };
    }
    xhr.send(null);
    if (!async) {
      evalResponse();
    }
  }
541248
function main(option, parser, force) {
  if(typeof option === 'function') {
    parser = option;
    option = null;
  }
  if(option !== false) {
    option = option || parse.option;
    parser = parser || parse;
  }
  //var mode = parse.auto;
  if(typeof parser === 'function') {
    module.exports.mode = parser(parse.modes, option, process.argv.slice(2));
  }
  initialize(force);
  return module.exports;
}
199939
function Resource(spec, options) {
  if (!(this instanceof Resource)) {
    return new Resource(spec, options);
  }

  if (typeof spec !== 'object') {
    throw new Error('resource spec must be an object');
  }

  debug('create resource %s', spec.path, spec);

  this.spec = spec;
  this.list = [];
  this.options = options || {};

  this.middleware = {};
  this.operations = {};
}
98866
function init (model) {
    if (model.__ttl) return;

    var distinct_ = model.distinct;
    model.distinct = function distinct (field, cond, cb) {
      applyTTL(cond);
      return distinct_.call(model, field, cond, cb);
    }

    'findOne find count'.split(' ').forEach(function (method) {
      var fn = model[method];

      model[method] = function (cond, fields, opts, cb) {
        if (!cond) {
          cond = {};
        } else if ('function' == typeof cond) {
          cb = cond;
          cond = {};
        }

        applyTTL(cond);
        return fn.call(model, cond, fields, opts, cb);
      }
    });

    'where $where'.split(' ').forEach(function (method) {
      var fn = model[method];
      model[method] = function () {
        var query = fn.apply(this, arguments)
          , cond = {};
        applyTTL(cond);
        return query.find(cond);
      }
    });

    if (reap) {
      model.startTTLReaper();
    }
  }
231602
function executeSpecs(specs, done, isVerbose, showColors) {
  global.jasmine = jasmine;

  for (var i = 0; i < specs.length; i++) {
    var filename = specs[i];
    require(filename.replace(/\.\w+$/, ""));
  }

  var env = jasmine.getEnv();
  var consoleReporter = new jasmine.ConsoleReporter({
    print: util.print,
    onComplete: done,
    showColors: showColors,
    timer: new jasmine.Timer()
  });

  env.addReporter(consoleReporter);
  env.execute();
}
949687
function startSpec (n, allSpecs, cfg, done) {
        var printId = n + 1;
        var specPath = allSpecs[n];
        var nSpecs = allSpecs.length;
        var msg = "Running spec file " + specPath + " [" + printId + "/" + nSpecs + "]";

        var bar = Array(process.stdout.columns).join("*");
        console.log("\n" + bar.cyan);
        console.log(alignCenter(msg).cyan);
        console.log(bar.cyan + "\n");

        var cb = getPhantomExitCb(n, allSpecs, cfg, done);
        startPhantom(specPath, cfg, cb);
    }
331512
function GENERATE_METHOD(name, spec) {
  var doc = {};
  doc[name] = {
    '!type': 'fn(' + GENERATE_PARAMS(spec.params) + ')' + GENERATE_RETURN(spec.return),
    '!doc': spec.description
  }
  return doc;
}
226822
function initPerfMonitor(options) {
        if (!initialized) {
            if (options.container) {
                container = options.container;
            }
            initialized = true;
        }
    }