0.0
No commit activity in last 3 years
No release in over 3 years
RockConfig allows you to use custom config files easily.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.9.10
~> 0.2.2
~> 13.0.1
~> 2.11.0
 Project Readme

RockConfig Build Status Code Climate

RockConfig is a simple convention based library for reading and accessing config files.

Installation

Add this line to your application's Gemfile:

gem "rock_config"

And then execute:

$ bundle

Or install it yourself as:

$ gem install rock_config

Usage

Given the file elastic_search.yml:

development:
  host: 127.0.0.1
  port: 9200

production:
  host: 192.168.1.10
  port: 9200

RockConfig allows you to read these settings with an API like this:

elastic_config = RockConfig.for "elastic_search"
elastic_config.host # > 127.0.0.1

RockConfig automatically chooses the current application environment. You can select the environment yourself with:

RockConfig.for "elastic_search", "production"

RockConfig scans predefined directories for config files. By default, it tries to scan directory config in the project root. You can add more directories:

RockConfig.configure do |config|
  config.scanned_directories << "custom_path"
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request