This gem will help you if you need to store and read user configurations on environments, global or local files.
Installation
Add this line to your application's Gemfile:
gem 'user-configurations'
And then execute:
$ bundle
Or install it yourself as:
$ gem install user-configurations
Usage
Precedence
ENV > local > global
Writing
configs = UserConfigurations::Configuration.new('project')
configs.store(user_name: 'stupied4ever')
Will store on a local file placed on ~/.project
a YAML file
with user_name
.
Reading
configs = UserConfigurations::Configuration.new('project')
configs['user_name'] # 'stupied4ever'
If you had a global file (/etc/project
) with the user_name
configurations, or an ENV
var it would be readable too, just pay
attention on precendences.
Contributing
- Fork it ( https://github.com/stupie4ever/user-configurations/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request