coral_core 0.2.26 → 0.2.30
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/Gemfile +7 -2
- data/Gemfile.lock +84 -15
- data/VERSION +1 -1
- data/coral_core.gemspec +51 -16
- data/lib/{coral_core/command.rb → coral/command/shell.rb} +12 -116
- data/lib/coral/machine/fog.rb +215 -0
- data/lib/coral/network/default.rb +26 -0
- data/lib/coral/node/rackspace.rb +23 -0
- data/lib/coral_core.rb +249 -134
- data/lib/coral_core/config.rb +233 -275
- data/lib/coral_core/config/collection.rb +57 -0
- data/lib/coral_core/config/options.rb +70 -0
- data/lib/coral_core/config/project.rb +225 -0
- data/lib/coral_core/core.rb +19 -173
- data/lib/coral_core/event/puppet_event.rb +98 -0
- data/lib/coral_core/mixin/config_collection.rb +52 -0
- data/lib/coral_core/mixin/config_ops.rb +51 -0
- data/lib/coral_core/mixin/config_options.rb +38 -0
- data/lib/coral_core/mixin/lookup.rb +211 -0
- data/lib/coral_core/mixin/macro/object_interface.rb +292 -0
- data/lib/coral_core/mixin/macro/plugin_interface.rb +277 -0
- data/lib/coral_core/mixin/settings.rb +46 -0
- data/lib/coral_core/mixin/sub_config.rb +208 -0
- data/lib/coral_core/mod/hash.rb +29 -0
- data/lib/{hiera_backend.rb → coral_core/mod/hiera_backend.rb} +0 -0
- data/lib/coral_core/plugin.rb +261 -0
- data/lib/coral_core/plugin/command.rb +95 -0
- data/lib/coral_core/plugin/machine.rb +152 -0
- data/lib/coral_core/plugin/network.rb +24 -0
- data/lib/coral_core/plugin/node.rb +184 -0
- data/lib/coral_core/plugin_base.rb +147 -0
- data/lib/coral_core/repository.rb +471 -82
- data/lib/coral_core/util/cli.rb +293 -0
- data/lib/coral_core/util/data.rb +178 -8
- data/lib/coral_core/util/disk.rb +13 -0
- data/lib/coral_core/util/git.rb +35 -10
- data/lib/coral_core/{interface.rb → util/interface.rb} +31 -21
- data/lib/coral_core/util/process.rb +43 -0
- data/locales/en.yml +8 -0
- data/spec/coral_core/interface_spec.rb +45 -45
- metadata +109 -34
- data/.gitmodules +0 -12
- data/lib/coral_core/memory.rb +0 -226
- data/lib/coral_core/util/git/base.rb +0 -65
- data/lib/coral_core/util/git/lib.rb +0 -89
- data/lib/coral_core/util/git/remote.rb +0 -12
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: coral_core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.30
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,11 +9,11 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2014-01-15 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: log4r
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &19626620 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ~>
|
|
@@ -21,10 +21,21 @@ dependencies:
|
|
|
21
21
|
version: '1.1'
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *19626620
|
|
25
|
+
- !ruby/object:Gem::Dependency
|
|
26
|
+
name: i18n
|
|
27
|
+
requirement: &19625940 !ruby/object:Gem::Requirement
|
|
28
|
+
none: false
|
|
29
|
+
requirements:
|
|
30
|
+
- - ~>
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0.6'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: *19625940
|
|
25
36
|
- !ruby/object:Gem::Dependency
|
|
26
37
|
name: deep_merge
|
|
27
|
-
requirement: &
|
|
38
|
+
requirement: &19625060 !ruby/object:Gem::Requirement
|
|
28
39
|
none: false
|
|
29
40
|
requirements:
|
|
30
41
|
- - ~>
|
|
@@ -32,32 +43,76 @@ dependencies:
|
|
|
32
43
|
version: '1.0'
|
|
33
44
|
type: :runtime
|
|
34
45
|
prerelease: false
|
|
35
|
-
version_requirements: *
|
|
46
|
+
version_requirements: *19625060
|
|
36
47
|
- !ruby/object:Gem::Dependency
|
|
37
|
-
name:
|
|
38
|
-
requirement: &
|
|
48
|
+
name: multi_json
|
|
49
|
+
requirement: &19624060 !ruby/object:Gem::Requirement
|
|
39
50
|
none: false
|
|
40
51
|
requirements:
|
|
41
|
-
- -
|
|
52
|
+
- - ~>
|
|
42
53
|
- !ruby/object:Gem::Version
|
|
43
|
-
version: '1.
|
|
54
|
+
version: '1.7'
|
|
44
55
|
type: :runtime
|
|
45
56
|
prerelease: false
|
|
46
|
-
version_requirements: *
|
|
57
|
+
version_requirements: *19624060
|
|
47
58
|
- !ruby/object:Gem::Dependency
|
|
48
|
-
name:
|
|
49
|
-
requirement: &
|
|
59
|
+
name: grit
|
|
60
|
+
requirement: &19727240 !ruby/object:Gem::Requirement
|
|
50
61
|
none: false
|
|
51
62
|
requirements:
|
|
52
|
-
- -
|
|
63
|
+
- - ~>
|
|
64
|
+
- !ruby/object:Gem::Version
|
|
65
|
+
version: '2.5'
|
|
66
|
+
type: :runtime
|
|
67
|
+
prerelease: false
|
|
68
|
+
version_requirements: *19727240
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: fog
|
|
71
|
+
requirement: &19726220 !ruby/object:Gem::Requirement
|
|
72
|
+
none: false
|
|
73
|
+
requirements:
|
|
74
|
+
- - ~>
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
version: '1'
|
|
77
|
+
type: :runtime
|
|
78
|
+
prerelease: false
|
|
79
|
+
version_requirements: *19726220
|
|
80
|
+
- !ruby/object:Gem::Dependency
|
|
81
|
+
name: rgen
|
|
82
|
+
requirement: &19725360 !ruby/object:Gem::Requirement
|
|
83
|
+
none: false
|
|
84
|
+
requirements:
|
|
85
|
+
- - ~>
|
|
86
|
+
- !ruby/object:Gem::Version
|
|
87
|
+
version: '0.6'
|
|
88
|
+
type: :runtime
|
|
89
|
+
prerelease: false
|
|
90
|
+
version_requirements: *19725360
|
|
91
|
+
- !ruby/object:Gem::Dependency
|
|
92
|
+
name: facter
|
|
93
|
+
requirement: &19724360 !ruby/object:Gem::Requirement
|
|
94
|
+
none: false
|
|
95
|
+
requirements:
|
|
96
|
+
- - ~>
|
|
97
|
+
- !ruby/object:Gem::Version
|
|
98
|
+
version: '1.7'
|
|
99
|
+
type: :runtime
|
|
100
|
+
prerelease: false
|
|
101
|
+
version_requirements: *19724360
|
|
102
|
+
- !ruby/object:Gem::Dependency
|
|
103
|
+
name: puppet
|
|
104
|
+
requirement: &19723320 !ruby/object:Gem::Requirement
|
|
105
|
+
none: false
|
|
106
|
+
requirements:
|
|
107
|
+
- - ~>
|
|
53
108
|
- !ruby/object:Gem::Version
|
|
54
|
-
version:
|
|
109
|
+
version: '3.2'
|
|
55
110
|
type: :runtime
|
|
56
111
|
prerelease: false
|
|
57
|
-
version_requirements: *
|
|
112
|
+
version_requirements: *19723320
|
|
58
113
|
- !ruby/object:Gem::Dependency
|
|
59
114
|
name: bundler
|
|
60
|
-
requirement: &
|
|
115
|
+
requirement: &19722080 !ruby/object:Gem::Requirement
|
|
61
116
|
none: false
|
|
62
117
|
requirements:
|
|
63
118
|
- - ~>
|
|
@@ -65,10 +120,10 @@ dependencies:
|
|
|
65
120
|
version: '1.2'
|
|
66
121
|
type: :development
|
|
67
122
|
prerelease: false
|
|
68
|
-
version_requirements: *
|
|
123
|
+
version_requirements: *19722080
|
|
69
124
|
- !ruby/object:Gem::Dependency
|
|
70
125
|
name: jeweler
|
|
71
|
-
requirement: &
|
|
126
|
+
requirement: &19721460 !ruby/object:Gem::Requirement
|
|
72
127
|
none: false
|
|
73
128
|
requirements:
|
|
74
129
|
- - ~>
|
|
@@ -76,10 +131,10 @@ dependencies:
|
|
|
76
131
|
version: '1.8'
|
|
77
132
|
type: :development
|
|
78
133
|
prerelease: false
|
|
79
|
-
version_requirements: *
|
|
134
|
+
version_requirements: *19721460
|
|
80
135
|
- !ruby/object:Gem::Dependency
|
|
81
136
|
name: rspec
|
|
82
|
-
requirement: &
|
|
137
|
+
requirement: &19720980 !ruby/object:Gem::Requirement
|
|
83
138
|
none: false
|
|
84
139
|
requirements:
|
|
85
140
|
- - ~>
|
|
@@ -87,10 +142,10 @@ dependencies:
|
|
|
87
142
|
version: '2.10'
|
|
88
143
|
type: :development
|
|
89
144
|
prerelease: false
|
|
90
|
-
version_requirements: *
|
|
145
|
+
version_requirements: *19720980
|
|
91
146
|
- !ruby/object:Gem::Dependency
|
|
92
147
|
name: rdoc
|
|
93
|
-
requirement: &
|
|
148
|
+
requirement: &19720360 !ruby/object:Gem::Requirement
|
|
94
149
|
none: false
|
|
95
150
|
requirements:
|
|
96
151
|
- - ~>
|
|
@@ -98,10 +153,10 @@ dependencies:
|
|
|
98
153
|
version: '3.12'
|
|
99
154
|
type: :development
|
|
100
155
|
prerelease: false
|
|
101
|
-
version_requirements: *
|
|
156
|
+
version_requirements: *19720360
|
|
102
157
|
- !ruby/object:Gem::Dependency
|
|
103
158
|
name: yard
|
|
104
|
-
requirement: &
|
|
159
|
+
requirement: &19719880 !ruby/object:Gem::Requirement
|
|
105
160
|
none: false
|
|
106
161
|
requirements:
|
|
107
162
|
- - ~>
|
|
@@ -109,7 +164,7 @@ dependencies:
|
|
|
109
164
|
version: '0.8'
|
|
110
165
|
type: :development
|
|
111
166
|
prerelease: false
|
|
112
|
-
version_requirements: *
|
|
167
|
+
version_requirements: *19719880
|
|
113
168
|
description: ! "= coral_core\n\nThis library provides core data elements and utilities
|
|
114
169
|
used in other Coral gems.\n\nThe Coral core library contains functionality that
|
|
115
170
|
is utilized by other\nCoral gems by providing basic utilities like Git, Shell, Disk,
|
|
@@ -135,7 +190,6 @@ extra_rdoc_files:
|
|
|
135
190
|
- README.rdoc
|
|
136
191
|
files:
|
|
137
192
|
- .document
|
|
138
|
-
- .gitmodules
|
|
139
193
|
- Gemfile
|
|
140
194
|
- Gemfile.lock
|
|
141
195
|
- LICENSE.txt
|
|
@@ -143,14 +197,35 @@ files:
|
|
|
143
197
|
- Rakefile
|
|
144
198
|
- VERSION
|
|
145
199
|
- coral_core.gemspec
|
|
200
|
+
- lib/coral/command/shell.rb
|
|
201
|
+
- lib/coral/machine/fog.rb
|
|
202
|
+
- lib/coral/network/default.rb
|
|
203
|
+
- lib/coral/node/rackspace.rb
|
|
146
204
|
- lib/coral_core.rb
|
|
147
|
-
- lib/coral_core/command.rb
|
|
148
205
|
- lib/coral_core/config.rb
|
|
206
|
+
- lib/coral_core/config/collection.rb
|
|
207
|
+
- lib/coral_core/config/options.rb
|
|
208
|
+
- lib/coral_core/config/project.rb
|
|
149
209
|
- lib/coral_core/core.rb
|
|
150
210
|
- lib/coral_core/event.rb
|
|
211
|
+
- lib/coral_core/event/puppet_event.rb
|
|
151
212
|
- lib/coral_core/event/regexp_event.rb
|
|
152
|
-
- lib/coral_core/
|
|
153
|
-
- lib/coral_core/
|
|
213
|
+
- lib/coral_core/mixin/config_collection.rb
|
|
214
|
+
- lib/coral_core/mixin/config_ops.rb
|
|
215
|
+
- lib/coral_core/mixin/config_options.rb
|
|
216
|
+
- lib/coral_core/mixin/lookup.rb
|
|
217
|
+
- lib/coral_core/mixin/macro/object_interface.rb
|
|
218
|
+
- lib/coral_core/mixin/macro/plugin_interface.rb
|
|
219
|
+
- lib/coral_core/mixin/settings.rb
|
|
220
|
+
- lib/coral_core/mixin/sub_config.rb
|
|
221
|
+
- lib/coral_core/mod/hash.rb
|
|
222
|
+
- lib/coral_core/mod/hiera_backend.rb
|
|
223
|
+
- lib/coral_core/plugin.rb
|
|
224
|
+
- lib/coral_core/plugin/command.rb
|
|
225
|
+
- lib/coral_core/plugin/machine.rb
|
|
226
|
+
- lib/coral_core/plugin/network.rb
|
|
227
|
+
- lib/coral_core/plugin/node.rb
|
|
228
|
+
- lib/coral_core/plugin_base.rb
|
|
154
229
|
- lib/coral_core/repository.rb
|
|
155
230
|
- lib/coral_core/resource.rb
|
|
156
231
|
- lib/coral_core/template.rb
|
|
@@ -158,14 +233,14 @@ files:
|
|
|
158
233
|
- lib/coral_core/template/json.rb
|
|
159
234
|
- lib/coral_core/template/wrapper.rb
|
|
160
235
|
- lib/coral_core/template/yaml.rb
|
|
236
|
+
- lib/coral_core/util/cli.rb
|
|
161
237
|
- lib/coral_core/util/data.rb
|
|
162
238
|
- lib/coral_core/util/disk.rb
|
|
163
239
|
- lib/coral_core/util/git.rb
|
|
164
|
-
- lib/coral_core/util/
|
|
165
|
-
- lib/coral_core/util/
|
|
166
|
-
- lib/coral_core/util/git/remote.rb
|
|
240
|
+
- lib/coral_core/util/interface.rb
|
|
241
|
+
- lib/coral_core/util/process.rb
|
|
167
242
|
- lib/coral_core/util/shell.rb
|
|
168
|
-
-
|
|
243
|
+
- locales/en.yml
|
|
169
244
|
- spec/coral_core/interface_spec.rb
|
|
170
245
|
- spec/coral_mock_input.rb
|
|
171
246
|
- spec/coral_test_kernel.rb
|
data/.gitmodules
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
[submodule "lib/dependency/git"]
|
|
2
|
-
path = lib/dependency/git
|
|
3
|
-
url = git://github.com/schacon/ruby-git.git
|
|
4
|
-
[submodule "lib/dependency/json"]
|
|
5
|
-
path = lib/dependency/json
|
|
6
|
-
url = git://github.com/flori/json.git
|
|
7
|
-
[submodule "lib/dependency/log4r"]
|
|
8
|
-
path = lib/dependency/log4r
|
|
9
|
-
url = git://github.com/colbygk/log4r.git
|
|
10
|
-
[submodule "lib/dependency/deep_merge"]
|
|
11
|
-
path = lib/dependency/deep_merge
|
|
12
|
-
url = git://github.com/danielsdeleo/deep_merge.git
|
data/lib/coral_core/memory.rb
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
require 'json'
|
|
3
|
-
|
|
4
|
-
module Coral
|
|
5
|
-
class Memory < Repository
|
|
6
|
-
|
|
7
|
-
#-----------------------------------------------------------------------------
|
|
8
|
-
# Constructor / Destructor
|
|
9
|
-
|
|
10
|
-
def initialize(options = {})
|
|
11
|
-
config = Config.ensure(options)
|
|
12
|
-
|
|
13
|
-
super(config)
|
|
14
|
-
|
|
15
|
-
@absolute_config_file = ''
|
|
16
|
-
@config_file = ''
|
|
17
|
-
|
|
18
|
-
@properties = config.get(:properties, {})
|
|
19
|
-
|
|
20
|
-
@autoload = config.get(:autoload, true)
|
|
21
|
-
@autosave = config.get(:autosave, true)
|
|
22
|
-
@autocommit = config.get(:autocommit, true)
|
|
23
|
-
@commit_message = config.get(:commit_message, 'Saving state')
|
|
24
|
-
|
|
25
|
-
self.config_file = config.get(:config_file, '')
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
#---
|
|
29
|
-
|
|
30
|
-
def self.finalize(file_name)
|
|
31
|
-
proc do
|
|
32
|
-
Coral::Util::Disk.close(file_name)
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
#-----------------------------------------------------------------------------
|
|
37
|
-
# Property accessors / modifiers
|
|
38
|
-
|
|
39
|
-
attr_accessor :autoload, :autosave, :autocommit, :commit_message
|
|
40
|
-
attr_reader :config_file, :absolute_config_file
|
|
41
|
-
|
|
42
|
-
#---
|
|
43
|
-
|
|
44
|
-
def set_absolute_config_file
|
|
45
|
-
if @directory.empty? || @config_file.empty?
|
|
46
|
-
@absolute_config_file = ''
|
|
47
|
-
else
|
|
48
|
-
@absolute_config_file = ( ! @submodule.empty? ? File.join(@directory, @submodule, @config_file) : File.join(@directory, @config_file) )
|
|
49
|
-
ObjectSpace.define_finalizer(self, self.class.finalize(@absolute_config_file))
|
|
50
|
-
end
|
|
51
|
-
return self
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
#---
|
|
55
|
-
|
|
56
|
-
def config_file=file
|
|
57
|
-
unless Util::Data.empty?(file)
|
|
58
|
-
@config_file = ( file.is_a?(Array) ? file.join(File::SEPARATOR) : string(file) )
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
set_absolute_config_file
|
|
62
|
-
load if @autoload
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
#-----------------------------------------------------------------------------
|
|
66
|
-
|
|
67
|
-
def get(key, default = '', format = false)
|
|
68
|
-
value = default
|
|
69
|
-
key = string(key)
|
|
70
|
-
|
|
71
|
-
if ! @properties || ! @properties.is_a?(Hash)
|
|
72
|
-
@properties = {}
|
|
73
|
-
end
|
|
74
|
-
if @properties.has_key?(key)
|
|
75
|
-
value = @properties[key]
|
|
76
|
-
end
|
|
77
|
-
return filter(value, format)
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
#---
|
|
81
|
-
|
|
82
|
-
def set(key, value = '')
|
|
83
|
-
key = string(key)
|
|
84
|
-
|
|
85
|
-
if ! @properties || ! @properties.is_a?(Hash)
|
|
86
|
-
@properties = {}
|
|
87
|
-
end
|
|
88
|
-
@properties[key] = value
|
|
89
|
-
save if @autosave
|
|
90
|
-
return self
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
#---
|
|
94
|
-
|
|
95
|
-
def delete(key)
|
|
96
|
-
key = string(key)
|
|
97
|
-
|
|
98
|
-
if ! @properties || ! @properties.is_a?(Hash)
|
|
99
|
-
@properties = {}
|
|
100
|
-
end
|
|
101
|
-
@properties.delete(key)
|
|
102
|
-
save if @autosave
|
|
103
|
-
return self
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
#---
|
|
107
|
-
|
|
108
|
-
def get_group(group, name = '', key = nil, default = {}, format = false)
|
|
109
|
-
info = get(group, {})
|
|
110
|
-
value = info
|
|
111
|
-
|
|
112
|
-
if name
|
|
113
|
-
name = string(name)
|
|
114
|
-
if info.has_key?(name) && info[name].is_a?(Hash)
|
|
115
|
-
if key && ! key.empty?
|
|
116
|
-
key = string(key)
|
|
117
|
-
if info[name].has_key?(key)
|
|
118
|
-
value = info[name][key]
|
|
119
|
-
else
|
|
120
|
-
value = default
|
|
121
|
-
end
|
|
122
|
-
else
|
|
123
|
-
value = info[name]
|
|
124
|
-
end
|
|
125
|
-
else
|
|
126
|
-
value = default
|
|
127
|
-
end
|
|
128
|
-
end
|
|
129
|
-
return filter(value, format)
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
#---
|
|
133
|
-
|
|
134
|
-
def set_group(group, name, key = nil, value = {})
|
|
135
|
-
group = string(group)
|
|
136
|
-
name = string(name)
|
|
137
|
-
|
|
138
|
-
if ! @properties || ! @properties.is_a?(Hash)
|
|
139
|
-
@properties = {}
|
|
140
|
-
end
|
|
141
|
-
if ! @properties[group] || ! @properties[group].is_a?(Hash)
|
|
142
|
-
@properties[group] = {}
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
if key && ! key.empty?
|
|
146
|
-
key = string(key)
|
|
147
|
-
if ! @properties[group][name] || ! @properties[group][name].is_a?(Hash)
|
|
148
|
-
@properties[group][name] = {}
|
|
149
|
-
end
|
|
150
|
-
@properties[group][name][key] = value
|
|
151
|
-
|
|
152
|
-
else
|
|
153
|
-
@properties[group][name] = value
|
|
154
|
-
end
|
|
155
|
-
save if @autosave
|
|
156
|
-
return self
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
#---
|
|
160
|
-
|
|
161
|
-
def delete_group(group, name, key = nil)
|
|
162
|
-
group = string(group)
|
|
163
|
-
name = string(name)
|
|
164
|
-
|
|
165
|
-
if ! @properties || ! @properties.is_a?(Hash)
|
|
166
|
-
@properties = {}
|
|
167
|
-
end
|
|
168
|
-
if ! @properties[group] || ! @properties[group].is_a?(Hash)
|
|
169
|
-
@properties[group] = {}
|
|
170
|
-
end
|
|
171
|
-
|
|
172
|
-
if key && ! key.empty?
|
|
173
|
-
key = string(key)
|
|
174
|
-
if @properties[group][name] && @properties[group][name].is_a?(Hash)
|
|
175
|
-
@properties[group][name].delete(key)
|
|
176
|
-
end
|
|
177
|
-
else
|
|
178
|
-
@properties[group].delete(name)
|
|
179
|
-
end
|
|
180
|
-
save if @autosave
|
|
181
|
-
return self
|
|
182
|
-
end
|
|
183
|
-
|
|
184
|
-
#-----------------------------------------------------------------------------
|
|
185
|
-
# Import / Export
|
|
186
|
-
|
|
187
|
-
def export
|
|
188
|
-
return @properties
|
|
189
|
-
end
|
|
190
|
-
|
|
191
|
-
#-----------------------------------------------------------------------------
|
|
192
|
-
# Configuration loading / saving
|
|
193
|
-
|
|
194
|
-
def load
|
|
195
|
-
if can_persist?
|
|
196
|
-
config = Coral::Util::Disk.read(@absolute_config_file)
|
|
197
|
-
if config && ! config.empty?
|
|
198
|
-
@properties = JSON.parse(config)
|
|
199
|
-
end
|
|
200
|
-
end
|
|
201
|
-
return self
|
|
202
|
-
end
|
|
203
|
-
|
|
204
|
-
#---
|
|
205
|
-
|
|
206
|
-
def save(options = {})
|
|
207
|
-
if can_persist?
|
|
208
|
-
config = JSON.generate(@properties)
|
|
209
|
-
if config && ! config.empty?
|
|
210
|
-
Coral::Util::Disk.write(@absolute_config_file, config)
|
|
211
|
-
commit(@absolute_config_file, options) if @autocommit
|
|
212
|
-
end
|
|
213
|
-
end
|
|
214
|
-
return self
|
|
215
|
-
end
|
|
216
|
-
|
|
217
|
-
#-----------------------------------------------------------------------------
|
|
218
|
-
# Checks
|
|
219
|
-
|
|
220
|
-
def can_persist?
|
|
221
|
-
success = super
|
|
222
|
-
success = false if success && @absolute_config_file.empty?
|
|
223
|
-
return success
|
|
224
|
-
end
|
|
225
|
-
end
|
|
226
|
-
end
|