gitconfigio 1.1.0 → 1.1.1

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/.gitignore CHANGED
@@ -12,4 +12,3 @@
12
12
  *.o
13
13
  *.a
14
14
  mkmf.log
15
- *.gem
data/lib/gitconfigio.rb CHANGED
@@ -1,4 +1,5 @@
1
- require_relative "gitconfigio/version"
1
+ require_relative 'gitconfigio/version'
2
+ require_relative './util'
2
3
 
3
4
  module GitConfigIO
4
5
 
@@ -49,28 +50,4 @@ module GitConfigIO
49
50
  File.write(File.expand_path(path),source)
50
51
  end
51
52
 
52
- def self.concat(hash,source = '')
53
- source = parse(source) if source.class == String
54
- hash.merge source
55
- end
56
-
57
- def self.merge(path,source = '')
58
- config = load(path)
59
- concat(config, source)
60
- end
61
-
62
- def self.merge!(path,source = '')
63
- dump(path,merge(path,source))
64
- end
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
76
53
  end
@@ -1,3 +1,3 @@
1
1
  module GitConfigIO
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
data/lib/util.rb ADDED
@@ -0,0 +1,43 @@
1
+ module GitConfigIO
2
+
3
+ def self.concat(hash,source = '')
4
+ source = parse(source) if source.class == String
5
+ hash.merge source
6
+ end
7
+
8
+ def self.merge(path,source = '')
9
+ config = load(path)
10
+ concat(config, source)
11
+ end
12
+
13
+ def self.merge!(path,source = '')
14
+ dump(path,merge(path,source))
15
+ end
16
+
17
+ def self.delete(source,subject)
18
+ source = source.class == String ? parse(source) : source.dup
19
+ source.delete(subject)
20
+ generate(source)
21
+ end
22
+
23
+ def self.delete!(path,subject)
24
+ config = load(path)
25
+ dump(path,delete(config,subject))
26
+ end
27
+
28
+ def self.write(config,source)
29
+ config = parse(config) if config.class == String
30
+ source = parse(source) if source.class == String
31
+ source.each do |k,v|
32
+ config[k] = v
33
+ end
34
+ config
35
+ end
36
+
37
+ def self.write!(path,source)
38
+ config = load(config)
39
+ config = write(config,source)
40
+ dump(path,config)
41
+ end
42
+
43
+ end
@@ -55,4 +55,9 @@ EOS
55
55
  it 'delete method' do
56
56
  expect(GitConfigIO::delete(color_hash,'color')).to eq('')
57
57
  end
58
+
59
+ it 'write method' do
60
+ expect(GitConfigIO::write({},color_str)).to eq(color_hash)
61
+ end
62
+
58
63
  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.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-22 00:00:00.000000000 Z
12
+ date: 2015-02-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -75,6 +75,7 @@ files:
75
75
  - gitconfigio.gemspec
76
76
  - lib/gitconfigio.rb
77
77
  - lib/gitconfigio/version.rb
78
+ - lib/util.rb
78
79
  - spec/gitconfigio_spec.rb
79
80
  - spec/spec_helper.rb
80
81
  homepage: https://github.com/mocchit/gitconfigio