Coder Social home page Coder Social logo

config_files's Introduction

Description

Since it no longer just deals with yaml files as an input, blackrat_yaml_config has been renamed to config_files Configuration file manager.

Features

Searches for first match in multiple directories for configuration file Allows for dynamically updated or static config files

Example

require 'config_files'

class Dummy
  include ConfigFiles #mixin the config_directories and config_files generators

  #search directories (in order). The system will search for the file in the following directories
  config_directories :etc=>['~/.dummy','/opt/dummy/config','/etc/default/dummy','/etc']

  #The dummy.yml and another_yaml_file.yml will be pre-loaded.
  static_config_files :dummy, :another_yaml_file

  #yet_another_yaml_file.yml will be read every time the .yet_another_yaml_file method is accessed.
  dynamic_config_files :yet_another_yaml_file

  def use_config
    some_method(Dummy.dummy[:key]) #extract the constant values from the :key in dummy.yml
    another_method(Dummy.yet_another_yaml_file[:another_key]) #extract the constant value from the :another_key in yet_another_yaml_file.yml
  end

end

Todo

Allow for different keys to be stored in files in different subdirectories to allow for overridable defaults

config_files's People

Contributors

blackrat avatar

Stargazers

Roman avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.