gitconfigio 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/mocchit/gitconfigio.svg?branch=master)](https://travis-ci.org/mocchit/gitconfigio)
4
4
  [![Code Climate](https://codeclimate.com/github/mocchit/gitconfigio/badges/gpa.svg)](https://codeclimate.com/github/mocchit/gitconfigio)
5
-
5
+ [![Gem Version](https://badge.fury.io/rb/gitconfigio.svg)](http://badge.fury.io/rb/gitconfigio)
6
6
  #### test:
7
7
 
8
8
  [![Build Status](https://travis-ci.org/mocchit/gitconfigio.svg?branch=test)](https://travis-ci.org/mocchit/gitconfigio)
@@ -38,7 +38,26 @@ conf['color'] = color.merge conf['color'] || {}
38
38
  # dump file
39
39
  GitConfigIO::dump('~/.gitconfig.bak',conf)
40
40
  ```
41
+ otherwise
42
+ ```
43
+ #!/bin/usr/env ruby
41
44
 
45
+ require 'gitconfigio'
46
+
47
+ GitConfigIO::merge!('~/.gitconfig',<<-EOS)
48
+ [color]
49
+ ui = true
50
+ diff = ture
51
+ EOS
52
+
53
+ # before:
54
+ # [color]
55
+ # ui = true
56
+ # after:
57
+ # [color]
58
+ # ui = true
59
+ # diff = true
60
+ ```
42
61
 
43
62
  ## Contributing
44
63
 
data/lib/gitconfigio.rb CHANGED
@@ -63,4 +63,14 @@ module GitConfigIO
63
63
  dump(path,merge(path,source))
64
64
  end
65
65
 
66
+ def self.delete(source,subject)
67
+ source = source.class == String ? parse(source) : source.dup
68
+ source.delete(subject)
69
+ generate(source)
70
+ end
71
+
72
+ def self.delete!(path,subject)
73
+ config = load(path)
74
+ dump(path,delete(config,subject))
75
+ end
66
76
  end
@@ -1,3 +1,3 @@
1
1
  module GitConfigIO
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -51,4 +51,8 @@ EOS
51
51
  test_data = GitConfigIO::concat(ext_cp,color_str)
52
52
  expect(test_data).to eq(g_code)
53
53
  end
54
+
55
+ it 'delete method' do
56
+ expect(GitConfigIO::delete(color_hash,'color')).to eq('')
57
+ end
54
58
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitconfigio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: