README.md in dsc-0.0.1 vs README.md in dsc-0.1.0
- old
+ new
@@ -1,5 +1,9 @@
+[![Gem Version](https://badge.fury.io/rb/dsc.svg)](http://badge.fury.io/rb/dsc)
+[![Travis CI](https://api.travis-ci.org/wimdu/dsc.svg?branch=master)](https://travis-ci.org/wimdu/dsc)
+[![Code Climate](https://codeclimate.com/github/wimdu/dsc/badges/gpa.svg)](https://codeclimate.com/github/wimdu/dsc)
+
# Dead simple configuration
Read configuration from a YAML/JSON file and expose the keys as methods.
## Installation
@@ -18,31 +22,41 @@
$ gem install dsc
## Usage
-Create a config file:
+Create a config file (you can use ERB):
```yaml
development:
username: dev
password:
production:
username: hugo
password: secret
pool: 42
+ url: <%= ENV["DATABASE_URL"] %>
```
Open the file and use it:
```ruby
require 'dsc'
database_config = Dsc.load_file('config/database.yml', env: 'production')
database_config.username # => 'hugo'
+database_config.url # => 'adapter://hostname:4567/database'
```
That's it!
+
+### Optional attributes
+
+If you want to be able to not specify some of the configuration options:
+
+```ruby
+config = Dsc.load_file('config/config.yml', env: 'production', optional: [:pool, :password])
+```
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)