master:
test:
GitConfigIO
gitconfig Input/Output
Installation
Add this line to your application's Gemfile:
gem 'gitconfigio'
And then execute:
$ bundle
Or install it yourself as:
$ gem install gitconfigio
Usage
require 'gitconfigio'
# load gitconfig
conf = GitConfigIO::load('~/.gitconfig')
# create value
color = {'diff' => 'auto' , 'ui' => 'auto'}
# safe merge value
conf['color'] = color.merge conf['color'] || {}
# dump file
GitConfigIO::dump('~/.gitconfig.bak',conf)
otherwise
#!/bin/usr/env ruby
require 'gitconfigio'
GitConfigIO::merge!('~/.gitconfig',<<-EOS)
[color]
ui = true
diff = ture
EOS
# before:
# [color]
# ui = true
# after:
# [color]
# ui = true
# diff = true
Contributing
- Fork it ( https://github.com/mocchit/gitconfigio/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
LICENSE
GNU GPLv3