cog-rb 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cog/config.rb +7 -7
- data/lib/cog/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d075ef035a49147b6624dcfdcb9742ea1280dd81
|
4
|
+
data.tar.gz: 7c2a8373eeff100276c7dbfd2f0440672b70ef39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d622a0bbf4f226828dc9b63002f30047b56f058c2eaa5f5fb3a65415411621d1f049444c8146637b486d6c5cde0eb31581f57a5983fd6987b039838afd8a078
|
7
|
+
data.tar.gz: 24e451eca4a10d8d8ad5e8e6a8ec548683cfd476030b3d11e181516b1f34a99d2bbdb46073af656e16d51f0818e624687094467bf8c9771f998773a296fb1015
|
data/lib/cog/config.rb
CHANGED
@@ -3,12 +3,12 @@ require "yaml"
|
|
3
3
|
|
4
4
|
class Cog
|
5
5
|
class Config
|
6
|
-
attr_reader :config_file, :
|
6
|
+
attr_reader :config_file, :yaml, :data
|
7
7
|
|
8
8
|
def initialize(config_file)
|
9
9
|
@config_file = config_file
|
10
|
-
@
|
11
|
-
@
|
10
|
+
@yaml = File.read(@config_file)
|
11
|
+
@data = YAML.load(@yaml)
|
12
12
|
end
|
13
13
|
|
14
14
|
def dump
|
@@ -21,7 +21,6 @@ class Cog
|
|
21
21
|
|
22
22
|
def []=(key, value)
|
23
23
|
@data[key.to_s] = value
|
24
|
-
@stale = true
|
25
24
|
end
|
26
25
|
|
27
26
|
def update_version(version = nil)
|
@@ -32,20 +31,21 @@ class Cog
|
|
32
31
|
segments[-1] = segments.last.to_i + 1
|
33
32
|
@data['version'] = segments.join('.')
|
34
33
|
end
|
34
|
+
|
35
|
+
@data['version']
|
35
36
|
end
|
36
37
|
|
37
38
|
def save
|
38
|
-
return unless
|
39
|
+
return unless self.stale?
|
39
40
|
|
40
41
|
contents = YAML.dump(@data)
|
41
42
|
File.open(@config_file, 'w') do |out|
|
42
43
|
out.write(contents)
|
43
|
-
@stale = false
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
47
|
def stale?
|
48
|
-
@
|
48
|
+
@yaml != YAML.dump(@data)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
data/lib/cog/version.rb
CHANGED