Configstruct
This gem is a lib for managing configfile for cli applications, including
- call a setup of the config file if it does not exist
- edit configuration and update the config file
It's for now totally experimental, please do not use yet.
Installation
Add this line to your application's Gemfile:
gem 'configstruct'
Usage
require 'cliprompt'
class Config < ConfigStruct
include Cliprompt
def set_defaults
super
default :name, 'default'
default :url, 'http://greenruby.org'
end
def setup
values = {}
output.puts Paint['Applicaton configuration.', :blue]
values['api_id'] = guess 'API_CLIENT', 'What is your Client ID?'
values['api_secret'] = guess 'API_SECRET', 'What is your Secret Key?'
write values
end
end
Contributing
- Fork it
- 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
Copyright
(c) Copy is right, 2014 - mose - this code is distributed under MIT license