Process initial config to make it safe to extend by file comment config
@param  {Object} config Initial config
@returns {Object}        Processed config
969844
function prepareConfig(config) {

		config.globals = config.globals || config.global || {};
		delete config.global;

		var copiedRules = {},
			parserOptions = {},
			preparedConfig;

		if (typeof config.rules === "object") {
			Object.keys(config.rules).forEach(function(k) {
				var rule = config.rules[k];

				if (rule === null) {
					throw new Error("Invalid config for rule '" + k + "'\.");
				}
				if (Array.isArray(rule)) {
					copiedRules[k] = rule.slice();
				} else {
					copiedRules[k] = rule;
				}
			});
		}

		// merge in environment parserOptions
		if (typeof config.env === "object") {
			Object.keys(config.env).forEach(function(envName) {
				var env = Environments.get(envName);

				if (config.env[envName] && env && env.parserOptions) {
					parserOptions = ConfigOps.merge(parserOptions, env.parserOptions);
				}
			});
		}

		preparedConfig = {
			rules: copiedRules,
			parser: config.parser || DEFAULT_PARSER,

			globals: ConfigOps.merge({}, config.globals),
			env: ConfigOps.merge({}, config.env || {}),
			settings: ConfigOps.merge({}, config.settings || {}),
			parserOptions: ConfigOps.merge(parserOptions, config.parserOptions || {}),
			tern: config.tern // ORION
		};

		if (preparedConfig.parserOptions.sourceType === "module") {
			if (!preparedConfig.parserOptions.ecmaFeatures) {
				preparedConfig.parserOptions.ecmaFeatures = {};
			}

			// can't have global return inside of modules
			preparedConfig.parserOptions.ecmaFeatures.globalReturn = false;

			// also need at least ES6 for modules
			if (!preparedConfig.parserOptions.ecmaVersion || preparedConfig.parserOptions.ecmaVersion < 6) {
				preparedConfig.parserOptions.ecmaVersion = 6;
			}
		}

		return preparedConfig;
	}
4294
function config(name, options) {
    if (isObject(name)) {
      extend(global, name);
      return;
    }
    var previous = (registry[name] && registry[name].$config) ? registry[name].$config() : null,
        base = extend({}, previous ? extend({}, previous) : extend({}, DEFAULTS, DEFAULT_METHODS));

    options = deepExtend(copy(base), options);

    if (!options.url) {
      options.url = global.base.replace(/\/$/, '') + '/' + hyphenate(name);
    }
    registry[name] = new ModelClass(options);
  }
425496
function process(){
		if (!conf.configured) that.configure();
		var args = command.args.slice(0);
		for(var i in args){
			var arg = args[i];
			if(conf.regexp.test(arg)){
				var catchWord = RegExp.$2;
				switch(RegExp.$1){
					case '-': 
						processShortKey(catchWord, i, args);
						break;
					case '--':
						processKey(catchWord, i, args);
						break;
				}
			} else {
				addArgument(arg);
			}
		}
		conf.processed = true
	}
395813
function Config(conf){
  try{
    if(typeof conf === 'string'){
      this.confPath = conf;
      conf = ini.parse(fs.readFileSync(conf, 'utf8'));
    }
  }catch(e){
    conf = {}
  }
  this.conf= conf || {};
}
1041131
function init(config) {
            var property;

            for (property in config) {
                if (config.hasOwnProperty(property)) {
                    this[property] = config[property];
                }
            }

            if(this.processors instanceof Array === false){
                this.processors = [].concat(this.constructor.processors);
            }
			if(this.preprocessors instanceof Array === false){
                this.preprocessors = [].concat(this.constructor.preprocessors);
            }
        }
506463
function init(config) {
        exports.config = config;
        MainViewManager
            .on("currentFileChange", _onFileChange);
        DocumentManager
            .on("documentSaved", _onDocumentSaved)
            .on("dirtyFlagChange", _onDirtyFlagChange);
        ProjectManager
            .on("beforeProjectClose beforeAppClose", close);

        // Default transport for live connection messages - can be changed
        setTransport(NodeSocketTransport);

        // Default launcher for preview browser - can be changed
        setLauncher(DefaultLauncher);

        // Initialize exports.status
        _setStatus(STATUS_INACTIVE);
    }
1083737
function initConfig(sitePathOrConfig) {
  [
    // Check exact path
    sitePathOrConfig + '.js',
    path.join(sitePathOrConfig, 'config.js'),
    sitePathOrConfig,

    // Check under the working directory
    path.join(process.cwd(), sitePathOrConfig + '.js'),
    path.join(process.cwd(), sitePathOrConfig, 'config.js'),
    path.join(process.cwd(), sitePathOrConfig),

    // Check under the directory where gulp was started
    path.join(process.env.INIT_CWD, sitePathOrConfig + '.js'),
    path.join(process.env.INIT_CWD, sitePathOrConfig, 'config.js'),
    path.join(process.env.INIT_CWD, sitePathOrConfig),
  ]
  .some(function(configFile) {
    var stat;
    try {
      stat = fs.lstatSync(configFile);
    } catch(err) {}
    if ( stat && stat.isFile() ) {
      gutil.log('Using configuration in ', configFile);
      siteConfig = require(path.resolve(configFile));
      siteConfig.configFile = configFile;
      siteConfig.rootPath = path.dirname(siteConfig.configFile);
      return true;
    }
  });
  if ( !siteConfig || !siteConfig.paths ) {
    gutil.log('Invalid site configuration in ', sitePathOrConfig);
    process.exit(1);
  }
}
425670
function setConfig(newConf, isClearPrevious) {
    checkIsObject(newConf);
    config = isClearPrevious ? Immutable.fromJS(newConf) : config.merge(newConf);
}
385252
function Builder (config) {
  if (!(config instanceof Config)) {
    config = new Config(config)
  }
  this.config = config
  // TODO: check for root.val
  if (!this.config.native.root) {
    // TODO: simplify this set
    this.config.native.set({
      root: {
        val: process.cwd()
      }
    })
  }
}
715694
function (config) {
  this.globals = config.globals || {};
  this.templates = {};
  this.config = _.extend({}, defaults, config);
  this.config.optionsRegex = new RegExp("^" + this.config.optionsDelimiter + "([\\S\\s]+)" + this.config.optionsDelimiter + "([\\S\\s]+)");
}
1031536
function _load() {
  if (!existsSync(exports.configFile)) {
    _initFile();
  }

  try {
    return JSON.parse(fs.readFileSync(exports.configFile, 'utf8'));
  }
  catch (e) {
    console.error('JSON parse error');
    console.error('See and edit', exports.configFile);
    console.error('or exec `confy clean`');
    process.exit();
  }
}
1088759
function handleConfigObject(oCfg, mHandlers) {

		function processConfig(key, value) {
			var handler = mHandlers[key];
			if ( typeof handler === 'function' ) {
				if ( handler.length === 1) {
					handler(value);
				} else if ( value != null ) {
					forEach(value, handler);
				}
			} else {
				log.warning("configuration option " + key + " not supported (ignored)");
			}
		}

		// Make sure the 'baseUrl' handler is called first as
		// other handlers (e.g. paths) depend on it
		if (oCfg.baseUrl) {
			processConfig("baseUrl", oCfg.baseUrl);
		}

		forEach(oCfg, function(key, value) {
			// Ignore "baseUrl" here as it will be handled above
			if (key !== "baseUrl") {
				processConfig(key, value);
			}
		});
	}
183812
function (config) {
        config = config || {};
        this.api_key = config.api_key;
        this.host = config.host || undefined;
        this.api_version = config.api_version || undefined;
        this.dev_mode = config.dev_mode || false;
        return this;
    }
777825
function extendConfig(defaults, config) {

        var key;

        // plugins
        if (config.plugins) {

            config.plugins.forEach(function(item) {

                // {}
                if (typeof item === 'object') {

                    key = Object.keys(item)[0];

                    // custom
                    if (typeof item[key] === 'object' && item[key].fn && typeof item[key].fn === 'function') {
                        defaults.plugins.push(setupCustomPlugin(key, item[key]));

                    } else {
                        defaults.plugins.forEach(function(plugin) {

                            if (plugin.name === key) {
                                // name: {}
                                if (typeof item[key] === 'object') {
                                    plugin.params = EXTEND({}, plugin.params || {}, item[key]);
                                    plugin.active = true;

                                // name: false
                                } else if (item[key] === false) {
                                   plugin.active = false;

                                // name: true
                                } else if (item[key] === true) {
                                   plugin.active = true;
                                }
                            }
                        });
                    }

                }

            });

        }

        defaults.multipass = config.multipass;

        // svg2js
        if (config.svg2js) {
            defaults.svg2js = config.svg2js;
        }

        // js2svg
        if (config.js2svg) {
            defaults.js2svg = config.js2svg;
        }

        return defaults;

    }
688945
function init(configuration){
    var self = {
        config : configuration,
        adapters : [],
        getWhenCurrentWritesDone : getWhenCurrentWritesDone
    };

    _.each(self.config.adapters, function(adapter){
        var adapterInstance;

        try {
            adapterInstance = require('./adapters/' + adapter.type).init(adapter);
        } catch (e) {
            console.log(chalk.red('Initialization Error: '), e);
            throw e;
        }

        adapterInstance.writeQueue = BB.resolve();

        self.adapters.push(adapterInstance);
    });

    [
        'error',
        'info',
        'debug',
        'warn',
        'trace',
        'critical'
    ].forEach(function (type) {
        /**
         * Create a TYPE log entry
         * @param category Categorize your error with a user defined label
         * @param args Include your customized messages. This should be a comma separated list just like `console.log`
         */
        self[type] = function () {
            // If we are still logging and there are messages to write
            if(arguments.length > 0){
                var category = (arguments.length > 1 && _.isString(arguments[0])) ? arguments[0] : '',
                    startIdx = (arguments.length > 1) ? 1 : 0;

                _write.call(self, type, category, Array.prototype.slice.call(arguments, startIdx));
            }
        };
    });

    return self;
}
190944
function overrideConfig(config) {
    if (fs.existsSync(config.config)) {
        var content = fs.readFileSync(config.config, {
            encoding: "utf8"
        });
        var configFile = JSON.parse(content);
        for (var key in configFile) {
            if (configFile.hasOwnProperty(key)) {
                config[key] = configFile[key];
            }
        }
    }
    return config;
}
377631
function (config) {
		if (typeof config === 'undefined') { config = {}; }
		/**
		 * the "memory" where the language parts go
		 */
		this.memory = {};
		/**
		 * If you want to delimit the generated parts
		 */
		this.separator = (config.separator) ? config.separator : '';
		/**
		 * How many... something... to something.... oh it's been too long I don't remember how this works...
		 */
		this.order = (config.order) ? config.order : 2;
		/**
		 * Feed text to memory
		 * @param {String} key key for the chain (so we can store multiple memories)
		 * @param {String} txt word or phrase
		 * @return {null} null
		 */
		this.learn = function (key, txt) {
			const mem = (this.memory[key]) ? this.memory[key] : {};
			// split up text then add the calculated parts to the memory for this ket
			this.breakText(txt, (key, value) => {
				// console.log(key);
				if (!mem[key]) {
					mem[key] = [];
				}
				mem[key].push(value);
				return mem;
			});
			this.memory[key] = mem;
		};
		/**
		 * Return a generated response
		 * @param {String} key key for the chain (so we can store multiples
		 * @param {Array} seed letters to start the response (?)
		 */
		this.generate = function (key, seed) {
			if (!seed) {
				seed = this.genInitial();
			}
			this.cur_key = key;
			return seed.concat(this.step(seed, [])).join(this.separator);
		};
		/**
		 * iterate through, calls self
		 * @param {Array} state array of most recent x(x=order) elements in chain
		 * @param {Array} ret the chain
		 * @return {Array}
		 */
		this.step = function (state, ret) {
			const nextAvailable = this.memory[this.cur_key][state] || [''];
			const next = this.getRandomValue(nextAvailable);
			// we don't have anywhere to go
			if (!next) {
				return ret;
			}
			ret.push(next);
			var nextState = state.slice(1);
			nextState.push(next);
			return this.step(nextState, ret);
		};
		/**
		 * Chunk the word or phrase
		 * @param {String} txt the text to chunk
		 * @param {Function} cb callback function
		 * @return {null} null
		 */
		this.breakText = function (txt, cb) {
			const parts = txt.split(this.separator);
			const prev = this.genInitial();
			
			parts.forEach((v) => {
				v = v.toLowerCase();
				cb(prev, v);
				prev.shift();
				prev.push(v);
			});
			cb(prev, '');
		};
		/**
		 * Generate a starting array for the chain based on the order number
		 * @return {Array} just an empty array of length=order
		 */
		this.genInitial = function () {
			const ret = [];
			for (
				let i = 0;
				i < this.order;
				ret.push(''),
				i++
			);
			return ret;
		};
		/**
		 * Get a random array element
		 * @param {Array} arr an array
		 * @return {String|Object}	random value
		 */
		this.getRandomValue = function (arr) {
			return arr[Math.floor(Math.random() * arr.length)];
		};
	}