Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phoet/confiture
Easy configuration for your Gem.
https://github.com/phoet/confiture
Last synced: 26 days ago
JSON representation
Easy configuration for your Gem.
- Host: GitHub
- URL: https://github.com/phoet/confiture
- Owner: phoet
- Created: 2012-06-11T19:52:33.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2015-10-04T09:29:44.000Z (about 9 years ago)
- Last Synced: 2024-05-01T22:35:51.807Z (6 months ago)
- Language: Ruby
- Homepage:
- Size: 136 KB
- Stars: 10
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
## Infos
![Build](https://travis-ci.org/phoet/confiture.png "Build")
## Installation
```bash
gem install confiture
```or in your Gemfile:
```ruby
gem "confiture"
```## Usage
In order to use confiture, just include it into a configuration klass:
```ruby
module Your
class Configuration
include Confiture::Configuration
confiture_allowed_keys(:secret, :key)
confiture_defaults(secret: 'SECRET_STUFF', key: 'EVEN_MOAR_SECRET')
end
end
```Rails style initializer (config/initializers/asin.rb):
```ruby
Your::Configuration.configure do |config|
config.secret = 'your-secret'
config.key = 'your-key'
end
```YAML style configuration:
```ruby
Your::Configuration.configure yaml: 'config/some.yml'
```Inline style configuration:
```ruby
Your::Configuration.configure secret: 'your-secret', key: 'your-key'
# or
client.configure secret: 'your-secret', key: 'your-key'
```Temporary configuration:
```ruby
Your::Configuration.with_config(key: "temp-key") do
[...]
end
```## License
"THE BEER-WARE LICENSE" (Revision 42):
[[email protected]](mailto:[email protected]) wrote this file. As long as you retain this notice you
can do whatever you want with this stuff. If we meet some day, and you think
this stuff is worth it, you can buy me a beer in return Peter Schröder