select a new config by name
174234
function select(name, outfilename) {
        var regex = /\$tiapp\.(.*)\$/;

        if (!name) {
            if (fs.existsSync('./app/config.json')) {
                var alloyCfg = JSON.parse(fs.readFileSync("./app/config.json", "utf-8"));
                if (alloyCfg.global.theme) {
                    console.log('\nFound a theme in config.json, trying ' + chalk.cyan(alloyCfg.global.theme));
                    select(alloyCfg.global.theme);
                } else {
                    status();
                }
            }
        } else {
            // find the config name specified
            cfg.configs.forEach(function(config) {

                if (config.name === name) {
                    console.log('\nFound a config for ' + chalk.cyan(config.name) + '\n');
                    if (fs.existsSync('./app/config.json')) {
                        var alloyCfg = JSON.parse(fs.readFileSync("./app/config.json", "utf-8"));
                        if (alloyCfg.global.theme) {
                          var original = alloyCfg.global.theme;
                          alloyCfg.global.theme = name;
                          fs.writeFile("./app/config.json", JSON.stringify(alloyCfg, null, 2), function (err) {
                              if (err) return console.log(err);
                              console.log('\nChanging theme value in config.json from ' + chalk.cyan(original) + ' to ' + chalk.cyan(name));
                          });
                        }
                    }

                    for (var setting in config.settings) {

                        if (!config.settings.hasOwnProperty(setting)) continue;

                        if (setting != "properties" && setting != "raw") {

							var now = new Date();
                            var replaceWith = config.settings[setting]
                                .replace('$DATE$', now.toLocaleDateString())
                                .replace('$TIME$', now.toLocaleTimeString())
                                .replace('$DATETIME$', now.toLocaleString())
                                .replace('$TIME_EPOCH$', now.getTime().toString());

                            var matches = regex.exec(replaceWith);

                            if (matches && matches[1]) {
                                var propName = matches[1];
                                replaceWith = replaceWith.replace(regex, tiapp[propName]);
                            }

                            tiapp[setting] = replaceWith;

                            console.log('Changing ' + chalk.cyan(setting) + ' to ' + chalk.yellow(replaceWith));
                        }

                    }

                    if (config.settings.properties) {
                        for (var property in config.settings.properties) {

                            if (!config.settings.properties.hasOwnProperty(property)) continue;

                            var replaceWith = config.settings.properties[property]
                                .replace('$DATE$', new Date().toLocaleDateString())
                                .replace('$TIME$', new Date().toLocaleTimeString())
                                .replace('$DATETIME$', new Date().toLocaleString())
                                .replace('$TIME_EPOCH$', new Date().getTime().toString());


                            var matches = regex.exec(replaceWith);
                            if (matches && matches[1]) {
                                var propName = matches[1];
                                replaceWith = replaceWith.replace(regex, tiapp[propName]);
                            }

                            tiapp.setProperty(property, replaceWith);

                            console.log('Changing App property ' + chalk.cyan(property) + ' to ' + chalk.yellow(replaceWith));

                        }
                    }

                    if (config.settings.raw) {
                        var doc = tiapp.doc;
                        var select = xpath.useNamespaces({
                            "ti": "http://ti.appcelerator.org",
                            "android": "http://schemas.android.com/apk/res/android"
                        });
                        for (var path in config.settings.raw) {

                            if (!config.settings.raw.hasOwnProperty(path)) continue;

                            var node = select(path, doc, true);
                            if (!node) {
                                console.log(chalk.yellow('Could not find ' + path + ", skipping"));
                                continue;
                            }

                            var replaceWith = config.settings.raw[path]
                                .replace('$DATE$', new Date().toLocaleDateString())
                                .replace('$TIME$', new Date().toLocaleTimeString())
                                .replace('$DATETIME$', new Date().toLocaleString())
                                .replace('$TIME_EPOCH$', new Date().getTime().toString());


                            var matches = regex.exec(replaceWith);
                            if (matches && matches[1]) {
                                var propName = matches[1];
                                replaceWith = replaceWith.replace(regex, tiapp[propName]);
                            }



                            if (typeof(node.value) === 'undefined'){
                                node.firstChild.data = replaceWith;
                            }
                            else{
                                node.value = replaceWith;
                            }

                            console.log('Changing Raw property ' + chalk.cyan(path) + ' to ' + chalk.yellow(replaceWith));

                        }
                    }

                    if (fs.existsSync("./app/themes/" + name + "/assets/iphone/DefaultIcon.png")) {
                        // if it exists in the themes folder, in a platform subfolder
                        console.log(chalk.blue('Found a DefaultIcon.png in the theme\'s assets/iphone folder\n'));
                        copyFile("./app/themes/" + name + "/assets/iphone/DefaultIcon.png", "./DefaultIcon.png")
                    } else if (fs.existsSync("./app/themes/" + name + "/DefaultIcon.png")) {
                        // if it exists in the top level theme folder
                        console.log(chalk.blue('Found a DefaultIcon.png in the theme folder\n'));
                        copyFile("./app/themes/" + name + "/" + "/DefaultIcon.png", "./DefaultIcon.png")
                    }

                    console.log(chalk.green('\n' + outfilename + ' updated\n'));

                    tiapp.write(outfilename);

                }
            });

            //console.log(chalk.red('\nCouldn\'t find a config called: ' + name + '\n'));

        }
    }
52039
def get_by_name(config=None, name=None, name_label='name'):
        

        if name is None:
            raise SyntaxError(
                'Deployment: name: [ {0} ] cannot be None.'.format(name))
        if not isinstance(name, str):
            raise SyntaxError(
                'Deployment: name: [ {0} ] must be a string.'.format(name))

        if config is not None and not isinstance(config, K8sConfig):
            raise SyntaxError(
                'Deployment: config: [ {0} ] must be a K8sConfig'.format(config))

        deps = K8sDeployment(config=config, name=name).list(labels={
            name_label: name
        })

        return deps
537585
def config(name, config):
    '''
    
    '''
    # setup return structure
    ret = {
        'name': name,
        'changes': {},
        'result': False,
        'comment': '',
    }

    # get existing config if job is present
    existing_config = None
    if __salt__['chronos.has_job'](name):
        existing_config = __salt__['chronos.job'](name)['job']

    # compare existing config with defined config
    if existing_config:
        update_config = copy.deepcopy(existing_config)
        salt.utils.configcomparer.compare_and_update_config(
            config,
            update_config,
            ret['changes'],
        )
    else:
        # the job is not configured--we need to create it from scratch
        ret['changes']['job'] = {
            'new': config,
            'old': None,
        }
        update_config = config

    if ret['changes']:
        # if the only change is in schedule, check to see if patterns are equivalent
        if 'schedule' in ret['changes'] and len(ret['changes']) == 1:
            if 'new' in ret['changes']['schedule'] and 'old' in ret['changes']['schedule']:
                new = ret['changes']['schedule']['new']
                log.debug('new schedule: %s', new)
                old = ret['changes']['schedule']['old']
                log.debug('old schedule: %s', old)
                if new and old:
                    _new = new.split('/')
                    log.debug('_new schedule: %s', _new)
                    _old = old.split('/')
                    log.debug('_old schedule: %s', _old)
                    if len(_new) == 3 and len(_old) == 3:
                        log.debug('_new[0] == _old[0]: %s',
                                  six.text_type(_new[0]) == six.text_type(_old[0]))
                        log.debug('_new[2] == _old[2]: %s',
                                  six.text_type(_new[2]) == six.text_type(_old[2]))
                        if six.text_type(_new[0]) == six.text_type(_old[0]) and \
                                six.text_type(_new[2]) == six.text_type(_old[2]):
                            log.debug('schedules match--no need for changes')
                            ret['changes'] = {}

    # update the config if we registered any changes
    log.debug('schedules match--no need for changes')
    if ret['changes']:
        # if test report there will be an update
        if __opts__['test']:
            ret['result'] = None
            ret['comment'] = 'Chronos job {0} is set to be updated'.format(
                name
            )
            return ret

        update_result = __salt__['chronos.update_job'](name, update_config)
        if 'exception' in update_result:
            ret['result'] = False
            ret['comment'] = 'Failed to update job config for {0}: {1}'.format(
                name,
                update_result['exception'],
            )
            return ret
        else:
            ret['result'] = True
            ret['comment'] = 'Updated job config for {0}'.format(name)
            return ret
    ret['result'] = True
    ret['comment'] = 'Chronos job {0} configured correctly'.format(name)
    return ret
680080
def _config(name, key=None, **kwargs):
    '''
    
    '''
    if key is None:
        key = name
    if name in kwargs:
        value = kwargs[name]
    else:
        value = __salt__['config.option']('ddns.{0}'.format(key))
        if not value:
            value = None
    return value
1344062
def set_name(self, name):
        """"""
        if not name:
            name = ''
        self._client['config']['name'] = name
        yield from self._server.client_name(self.identifier, name)
1031006
function getConfigElement(name) {
    checkIsString('name', name);
    if (config.has(name)) {
        return config.get(name);
    }
}
550137
function (name, value) {
                if (typeof name === 'string') {
                    Boot.config[name] = value;
                } else {
                    for (var s in name) {
                        Boot.setConfig(s, name[s]);
                    }
                }
                return Boot;
            }
562371
function(config, name) {
            if (config && config !== Object(config)) {
                throw new Error('Config object should be a key/value object.');
            }

            var defaultConfig = {
                loop: false,
                maxLoops: Infinity
            };

            var instance = Object.create(Queue);

            this.queues.push(name ? {
                name: name,
                instance: instance
            } : {
                instance: instance
            });

            merge(instance, {
                config: merge({}, defaultConfig, config),
                steps: []
            });

            return instance;
        }
551298
def set_config_file(name):
    '''
    

    '''
    global __SYSLOG_NG_CONFIG_FILE
    old = __SYSLOG_NG_CONFIG_FILE
    __SYSLOG_NG_CONFIG_FILE = name
    changes = _format_changes(old, name)
    return _format_state_result(name, result=True, changes=changes)
26111
def pass_config(func=None, **config_kw):
    """"""

    def decorate(func):
        def new_func(*args, **kw):
            config = load_config(**config_kw)
            func(config, *args, **kw)

        return functools.update_wrapper(new_func, func)

    if func is None:
        return decorate
    else:
        return decorate(func)
829080
def get_config(name, expand=False):
    
    cfg = Config.instance()
    only_section = "." not in name

    # when only the section is given, print all keys
    if only_section:
        return "\n".join(cfg.keys(name))

    else:
        section, option = name.split(".", 1)
        func = cfg.get_expanded if expand else cfg.get
        return func(section, option)
560012
def add(name, **kwargs):
    
    _CONFIG.add_section(name)

    for (key, value) in kwargs.items():
        _CONFIG.set(name, key, value)

    with open(_CONFIG_FILEPATH, 'w') as configfile:
        _CONFIG.write(configfile)

    info('Configuration updated at %s' % _JUT_HOME)
1162232
def set_config(self, **config):
        """"""
        reinit = False
        if 'stdopt' in config:
            stdopt = config.pop('stdopt')
            reinit = (stdopt != self.stdopt)
            self.stdopt = stdopt
        if 'attachopt' in config:
            attachopt = config.pop('attachopt')
            reinit = reinit or (attachopt != self.attachopt)
            self.attachopt = attachopt
        if 'attachvalue' in config:
            attachvalue = config.pop('attachvalue')
            reinit = reinit or (attachvalue != self.attachvalue)
            self.attachvalue = attachvalue
        if 'auto2dashes' in config:
            self.auto2dashes = config.pop('auto2dashes')
        if 'name' in config:
            name = config.pop('name')
            reinit = reinit or (name != self.name)
            self.name = name
        if 'help' in config:
            self.help = config.pop('help')
            self._set_or_remove_extra_handler(
                self.help, ('--help', '-h'), self.help_handler)
        if 'version' in config:
            self.version = config.pop('version')
            self._set_or_remove_extra_handler(
                self.version is not None,
                ('--version', '-v'),
                self.version_handler)
        if 'case_sensitive' in config:
            case_sensitive = config.pop('case_sensitive')
            reinit = reinit or (case_sensitive != self.case_sensitive)
            self.case_sensitive = case_sensitive
        if 'optionsfirst' in config:
            self.options_first = config.pop('optionsfirst')
        if 'appearedonly' in config:
            self.appeared_only = config.pop('appearedonly')
        if 'namedoptions' in config:
            namedoptions = config.pop('namedoptions')
            reinit = reinit or (namedoptions != self.namedoptions)
            self.namedoptions = namedoptions
        if 'extra' in config:
            self.extra.update(self._formal_extra(config.pop('extra')))

        if config:  # should be empty
            raise ValueError(
                '`%s` %s not accepted key argument%s' % (
                    '`, `'.join(config),
                    'is' if len(config) == 1 else 'are',
                    '' if len(config) == 1 else 's'
                ))

        if self.doc is not None and reinit:
            logger.warning(
                'You changed the config that requires re-initialized'
                ' `Docpie` object. Create a new one instead'
            )
            self._init()
209179
def load_site_config(name):
    """"""
    return _load_config_json(
        os.path.join(
            CONFIG_PATH,
            CONFIG_SITES_PATH,
            name + CONFIG_EXT
        )
    )
1184512
def with_updated_configuration(self, options=None,
                                   attribute_options=None):
        
        new_cfg = self.__configurations[-1].copy()
        if not options is None:
            for o_name, o_value in iteritems_(options):
                new_cfg.set_option(o_name, o_value)
        if not attribute_options is None:
            for attr_name, ao_opts in iteritems_(attribute_options):
                for ao_name, ao_value in iteritems_(ao_opts):
                    new_cfg.set_attribute_option(attr_name, ao_name, ao_value)
#        upd_cfg = type(new_cfg)(options=options,
#                                attribute_options=attribute_options)
#        new_cfg.update(upd_cfg)
        return MappingConfigurationContext(self, new_cfg)
741242
def config(name='EMAIL_URL', default='console://'):
    """"""
    conf = {}
    s = env(name, default)
    if s:
        conf = parse_email_url(s)
    return conf
618985
def auto_config? name
      return auto_config[name] if !auto_config[name].nil?
      Troles::Config.auto_config?(name)
    end