corl 0.4.0 → 0.4.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.
Files changed (122) hide show
  1. data/Gemfile +5 -10
  2. data/Gemfile.lock +13 -11
  3. data/README.rdoc +1 -1
  4. data/Rakefile +3 -3
  5. data/VERSION +1 -1
  6. data/bin/corl +2 -54
  7. data/bootstrap/bootstrap.sh +91 -0
  8. data/bootstrap/lib/shell/LICENSE.txt +674 -0
  9. data/bootstrap/lib/shell/command.sh +214 -0
  10. data/bootstrap/lib/shell/filesystem.sh +139 -0
  11. data/bootstrap/lib/shell/load.sh +73 -0
  12. data/bootstrap/lib/shell/os.sh +67 -0
  13. data/bootstrap/lib/shell/script.sh +160 -0
  14. data/bootstrap/lib/shell/starter.sh +64 -0
  15. data/bootstrap/lib/shell/validators.sh +50 -0
  16. data/bootstrap/os/ubuntu/00_base.sh +5 -0
  17. data/bootstrap/os/ubuntu/01_git.sh +5 -0
  18. data/bootstrap/os/ubuntu/05_ruby.sh +7 -0
  19. data/bootstrap/os/ubuntu/06_puppet.sh +38 -0
  20. data/bootstrap/os/ubuntu/10_corl.sh +9 -0
  21. data/corl.gemspec +61 -124
  22. data/lib/{corl → CORL}/action/bootstrap.rb +13 -7
  23. data/lib/CORL/action/exec.rb +39 -0
  24. data/lib/CORL/action/image.rb +31 -0
  25. data/lib/{corl → CORL}/action/images.rb +1 -1
  26. data/lib/CORL/action/lookup.rb +34 -0
  27. data/lib/{corl → CORL}/action/machines.rb +1 -1
  28. data/lib/CORL/action/provision.rb +31 -0
  29. data/lib/{corl → CORL}/action/seed.rb +3 -3
  30. data/lib/{corl → CORL}/action/spawn.rb +2 -2
  31. data/lib/CORL/action/start.rb +31 -0
  32. data/lib/CORL/action/stop.rb +31 -0
  33. data/lib/{corl → CORL}/configuration/file.rb +1 -1
  34. data/lib/{corl → CORL}/event/puppet.rb +1 -1
  35. data/lib/{corl → CORL}/extension/puppetloader.rb +1 -1
  36. data/lib/{corl → CORL}/machine/fog.rb +3 -3
  37. data/lib/{corl → CORL}/machine/physical.rb +2 -2
  38. data/lib/{corl → CORL}/network/default.rb +1 -1
  39. data/lib/{corl → CORL}/node/aws.rb +0 -4
  40. data/lib/{corl → CORL}/node/google.rb +0 -4
  41. data/lib/{corl → CORL}/node/local.rb +1 -1
  42. data/lib/{corl → CORL}/node/rackspace.rb +0 -4
  43. data/lib/{corl → CORL}/provisioner/puppetnode.rb +1 -14
  44. data/lib/{corl → CORL}/provisioner/puppetnode/resource.rb +0 -0
  45. data/lib/{corl → CORL}/provisioner/puppetnode/resource_group.rb +0 -0
  46. data/lib/{corl → CORL}/template/environment.rb +1 -1
  47. data/lib/core/facade.rb +49 -0
  48. data/lib/{corl_core → core}/mixin/action/keypair.rb +10 -10
  49. data/lib/{corl_core → core}/mixin/lookup.rb +0 -0
  50. data/lib/{corl_core → core}/mod/hiera_backend.rb +0 -0
  51. data/lib/{corl_core/mixin/action/node.rb → core/plugin/action.rb} +66 -33
  52. data/lib/{corl_core → core}/plugin/configuration.rb +2 -2
  53. data/lib/{corl/node → core/plugin}/fog.rb +5 -1
  54. data/lib/{corl_core → core}/plugin/machine.rb +2 -2
  55. data/lib/{corl_core → core}/plugin/network.rb +4 -4
  56. data/lib/{corl_core → core}/plugin/node.rb +11 -9
  57. data/lib/{corl_core → core}/plugin/provisioner.rb +2 -2
  58. data/lib/{corl_core → core}/util/ssh.rb +1 -1
  59. data/lib/corl.rb +53 -112
  60. data/lib/puppet/parser/functions/ensure.rb +0 -4
  61. data/locales/en.yml +55 -148
  62. metadata +84 -222
  63. data/lib/corl/action/add.rb +0 -69
  64. data/lib/corl/action/clone.rb +0 -40
  65. data/lib/corl/action/create.rb +0 -55
  66. data/lib/corl/action/exec.rb +0 -41
  67. data/lib/corl/action/extract.rb +0 -49
  68. data/lib/corl/action/image.rb +0 -30
  69. data/lib/corl/action/lookup.rb +0 -35
  70. data/lib/corl/action/provision.rb +0 -37
  71. data/lib/corl/action/remove.rb +0 -51
  72. data/lib/corl/action/save.rb +0 -53
  73. data/lib/corl/action/start.rb +0 -37
  74. data/lib/corl/action/stop.rb +0 -30
  75. data/lib/corl/action/update.rb +0 -37
  76. data/lib/corl/command/shell.rb +0 -164
  77. data/lib/corl/event/regex.rb +0 -52
  78. data/lib/corl/project/git.rb +0 -465
  79. data/lib/corl/project/github.rb +0 -108
  80. data/lib/corl/template/json.rb +0 -16
  81. data/lib/corl/template/wrapper.rb +0 -16
  82. data/lib/corl/template/yaml.rb +0 -16
  83. data/lib/corl/translator/json.rb +0 -27
  84. data/lib/corl/translator/yaml.rb +0 -27
  85. data/lib/corl_core/codes.rb +0 -107
  86. data/lib/corl_core/config.rb +0 -337
  87. data/lib/corl_core/config/collection.rb +0 -57
  88. data/lib/corl_core/config/options.rb +0 -70
  89. data/lib/corl_core/core.rb +0 -59
  90. data/lib/corl_core/corl.rb +0 -254
  91. data/lib/corl_core/errors.rb +0 -84
  92. data/lib/corl_core/facade.rb +0 -126
  93. data/lib/corl_core/gems.rb +0 -72
  94. data/lib/corl_core/manager.rb +0 -425
  95. data/lib/corl_core/mixin/action/commit.rb +0 -58
  96. data/lib/corl_core/mixin/action/project.rb +0 -53
  97. data/lib/corl_core/mixin/action/push.rb +0 -52
  98. data/lib/corl_core/mixin/config/collection.rb +0 -53
  99. data/lib/corl_core/mixin/config/ops.rb +0 -53
  100. data/lib/corl_core/mixin/config/options.rb +0 -39
  101. data/lib/corl_core/mixin/macro/object_interface.rb +0 -361
  102. data/lib/corl_core/mixin/macro/plugin_interface.rb +0 -380
  103. data/lib/corl_core/mixin/settings.rb +0 -46
  104. data/lib/corl_core/mixin/sub_config.rb +0 -148
  105. data/lib/corl_core/mod/hash.rb +0 -29
  106. data/lib/corl_core/plugin/action.rb +0 -381
  107. data/lib/corl_core/plugin/base.rb +0 -374
  108. data/lib/corl_core/plugin/command.rb +0 -98
  109. data/lib/corl_core/plugin/event.rb +0 -53
  110. data/lib/corl_core/plugin/extension.rb +0 -12
  111. data/lib/corl_core/plugin/project.rb +0 -927
  112. data/lib/corl_core/plugin/template.rb +0 -80
  113. data/lib/corl_core/plugin/translator.rb +0 -38
  114. data/lib/corl_core/util/cli.rb +0 -352
  115. data/lib/corl_core/util/data.rb +0 -404
  116. data/lib/corl_core/util/disk.rb +0 -114
  117. data/lib/corl_core/util/git.rb +0 -47
  118. data/lib/corl_core/util/interface.rb +0 -319
  119. data/lib/corl_core/util/liquid.rb +0 -17
  120. data/lib/corl_core/util/package.rb +0 -93
  121. data/lib/corl_core/util/shell.rb +0 -239
  122. data/spec/corl_core/interface_spec.rb +0 -489
@@ -1,126 +0,0 @@
1
-
2
- module CORL
3
-
4
- #-----------------------------------------------------------------------------
5
- # Core plugin type facade
6
-
7
- def self.extension(provider)
8
- plugin(:extension, provider, {})
9
- end
10
-
11
- #---
12
-
13
- def self.configuration(options, provider = nil)
14
- plugin(:configuration, provider, options)
15
- end
16
-
17
- def self.configurations(data, build_hash = false, keep_array = false)
18
- plugins(:configuration, data, build_hash, keep_array)
19
- end
20
-
21
- #---
22
-
23
- def self.action(provider, options)
24
- plugin(:action, provider, options)
25
- end
26
-
27
- def self.action_config(provider)
28
- action(provider, { :settings => {}, :quiet => true }).configure
29
- end
30
-
31
- def self.actions(data, build_hash = false, keep_array = false)
32
- plugins(:action, data, build_hash, keep_array)
33
- end
34
-
35
- def self.action_run(provider, options = {}, quiet = true)
36
- Plugin::Action.exec(provider, options, quiet)
37
- end
38
-
39
- def self.action_cli(provider, args = [], quiet = false)
40
- Plugin::Action.exec_cli(provider, args, quiet)
41
- end
42
-
43
- #---
44
-
45
- def self.project(options, provider = nil)
46
- plugin(:project, provider, options)
47
- end
48
-
49
- def self.projects(data, build_hash = false, keep_array = false)
50
- plugins(:project, data, build_hash, keep_array)
51
- end
52
-
53
- #-----------------------------------------------------------------------------
54
- # Cluster plugin type facade
55
-
56
- def self.network(name, options = {}, provider = nil)
57
- plugin(:network, provider, Config.ensure(options).import({ :name => name }))
58
- end
59
-
60
- def self.networks(data, build_hash = false, keep_array = false)
61
- plugins(:network, data, build_hash, keep_array)
62
- end
63
-
64
- #---
65
-
66
- def self.node(name, options = {}, provider = nil)
67
- plugin(:node, provider, Config.ensure(options).import({ :name => name }))
68
- end
69
-
70
- def self.nodes(data, build_hash = false, keep_array = false)
71
- plugins(:node, data, build_hash, keep_array)
72
- end
73
-
74
- #---
75
-
76
- def self.provisioner(options, provider = nil)
77
- plugin(:provisioner, provider, options)
78
- end
79
-
80
- #---
81
-
82
- def self.provisioners(data, build_hash = false, keep_array = false)
83
- plugins(:provisioner, data, build_hash, keep_array)
84
- end
85
-
86
- #---
87
-
88
- def self.command(options, provider = nil)
89
- plugin(:command, provider, options)
90
- end
91
-
92
- def self.commands(data, build_hash = false, keep_array = false)
93
- plugins(:command, data, build_hash, keep_array)
94
- end
95
-
96
- #-----------------------------------------------------------------------------
97
- # Utility plugin type facade
98
-
99
- def self.event(options, provider = nil)
100
- plugin(:event, provider, options)
101
- end
102
-
103
- def self.events(data, build_hash = false, keep_array = false)
104
- plugins(:event, data, build_hash, keep_array)
105
- end
106
-
107
- #---
108
-
109
- def self.template(options, provider = nil)
110
- plugin(:template, provider, options)
111
- end
112
-
113
- def self.templates(data, build_hash = false, keep_array = false)
114
- plugins(:template, data, build_hash, keep_array)
115
- end
116
-
117
- #---
118
-
119
- def self.translator(options, provider = nil)
120
- plugin(:translator, provider, options)
121
- end
122
-
123
- def self.translators(data, build_hash = false, keep_array = false)
124
- plugins(:translator, data, build_hash, keep_array)
125
- end
126
- end
@@ -1,72 +0,0 @@
1
-
2
- module CORL
3
- module Gems
4
-
5
- #-----------------------------------------------------------------------------
6
-
7
- @@core = nil
8
- @@gems = {}
9
-
10
- #-----------------------------------------------------------------------------
11
- # Gem interface
12
-
13
- def self.logger
14
- Core.logger
15
- end
16
-
17
- #---
18
-
19
- def self.core
20
- @@core
21
- end
22
-
23
- #---
24
-
25
- def self.registered
26
- @@gems
27
- end
28
-
29
- #---
30
-
31
- def self.register(reset = false)
32
- if reset || Util::Data.empty?(@@gems)
33
- logger.info("Registering external gem defined CORL plugins at #{Time.now}")
34
-
35
- if defined?(Gem)
36
- if ! defined?(Bundler) && Gem::Specification.respond_to?(:latest_specs)
37
- logger.debug("Not using bundler")
38
- Gem::Specification.latest_specs(true).each do |spec|
39
- register_gem(spec)
40
- end
41
- else
42
- logger.debug("Using bundler or Gem specification without latest_specs")
43
- Gem.loaded_specs.each do |name, spec|
44
- register_gem(spec)
45
- end
46
- end
47
- end
48
- end
49
- @@gems
50
- end
51
-
52
- #---
53
-
54
- def self.register_gem(spec)
55
- plugin_path = File.join(spec.full_gem_path, 'lib', 'corl')
56
- if File.directory?(plugin_path)
57
- logger.info("Registering gem #{spec.name} at #{plugin_path} at #{Time.now}")
58
-
59
- @@gems[spec.name] = {
60
- :lib_dir => plugin_path,
61
- :spec => spec
62
- }
63
- if spec.name == 'corl_core'
64
- logger.debug("Setting CORL core gemspec")
65
- @@core = spec
66
- else
67
- Manager.connection.register(plugin_path) # Autoload plugins and related files
68
- end
69
- end
70
- end
71
- end
72
- end
@@ -1,425 +0,0 @@
1
-
2
- module CORL
3
- class Manager
4
-
5
- include Celluloid
6
-
7
- #-----------------------------------------------------------------------------
8
-
9
- @@supervisors = {}
10
-
11
- #-----------------------------------------------------------------------------
12
- # Plugin manager interface
13
-
14
- def self.init_manager(name)
15
- name = name.to_sym
16
-
17
- Manager.supervise_as name
18
- @@supervisors[name] = Celluloid::Actor[name]
19
- end
20
-
21
- #---
22
-
23
- def self.connection(name = :core)
24
- name = name.to_sym
25
-
26
- init_manager(name) unless @@supervisors.has_key?(name)
27
-
28
- begin
29
- @@supervisors[name].test_connection
30
- rescue Celluloid::DeadActorError
31
- retry
32
- end
33
- @@supervisors[name]
34
- end
35
-
36
- #---
37
-
38
- def initialize
39
- @logger = CORL.logger
40
-
41
- @types = {}
42
- @load_info = {}
43
- @plugins = {}
44
- end
45
-
46
- #-----------------------------------------------------------------------------
47
- # Property accessor / modifiers
48
-
49
- attr_reader :logger
50
-
51
- #---
52
-
53
- def types
54
- @types.keys
55
- end
56
-
57
- #---
58
-
59
- def type_default(type)
60
- @types[type.to_sym]
61
- end
62
-
63
- #---
64
-
65
- def loaded_plugins(type = nil, provider = nil)
66
- results = {}
67
- type = type.to_sym if type
68
- provider = provider.to_sym if provider
69
-
70
- if type && @load_info.has_key?(type)
71
- if provider && @load_info.has_key?(provider)
72
- results = @load_info[type][provider]
73
- else
74
- results = @load_info[type]
75
- end
76
- elsif ! type
77
- results = @load_info
78
- end
79
- results
80
- end
81
-
82
- #---
83
-
84
- def plugins(type = nil, provider = nil)
85
- results = {}
86
- type = type.to_sym if type
87
- provider = provider.to_sym if provider
88
-
89
- if type && @plugins.has_key?(type)
90
- if provider && ! @plugins[type].keys.empty?
91
- @plugins[type].each do |instance_name, plugin|
92
- plugin = @plugins[type][instance_name]
93
- results[instance_name] = plugin if plugin.plugin_provider == provider
94
- end
95
- else
96
- results = @plugins[type]
97
- end
98
- elsif ! type
99
- results = @plugins
100
- end
101
- results
102
- end
103
-
104
- #-----------------------------------------------------------------------------
105
- # Operations
106
-
107
- def test_connection
108
- true
109
- end
110
-
111
- #---
112
-
113
- def define_type(type_info)
114
- if type_info.is_a?(Hash)
115
- logger.info("Defining plugin types at #{Time.now}")
116
-
117
- type_info.each do |type, default_provider|
118
- logger.debug("Mapping plugin type #{type} to default provider #{default_provider}")
119
- @types[type.to_sym] = default_provider
120
- end
121
- else
122
- logger.warn("Defined types must be specified as a hash to be registered properly")
123
- end
124
- end
125
-
126
- #---
127
-
128
- def load_plugins(reset_gems = false)
129
- # Register core plugins
130
- unless @core_loaded
131
- logger.info("Initializing core plugins at #{Time.now}")
132
- register(File.join(File.dirname(__FILE__), '..', 'corl'))
133
- @core_loaded = true
134
- end
135
-
136
- # Register external Gem defined plugins
137
- Gems.register(reset_gems)
138
-
139
- # Register any other extension plugins
140
- exec(:register_plugins)
141
-
142
- # Autoload all registered plugins
143
- autoload
144
- end
145
-
146
- #---
147
-
148
- def register(base_path)
149
- if File.directory?(base_path)
150
- logger.info("Loading files from #{base_path} at #{Time.now}")
151
-
152
- Dir.glob(File.join(base_path, '*.rb')).each do |file|
153
- logger.debug("Loading file: #{file}")
154
- require file
155
- end
156
-
157
- logger.info("Loading directories from #{base_path} at #{Time.now}")
158
- Dir.entries(base_path).each do |path|
159
- unless path.match(/^\.\.?$/)
160
- register_type(base_path, path)
161
- end
162
- end
163
- end
164
- end
165
-
166
- #---
167
-
168
- def register_type(base_path, plugin_type)
169
- base_directory = File.join(base_path, plugin_type.to_s)
170
-
171
- if File.directory?(base_directory)
172
- logger.info("Registering #{base_directory} at #{Time.now}")
173
-
174
- Dir.glob(File.join(base_directory, '*.rb')).each do |file|
175
- add_build_info(plugin_type, file)
176
- end
177
- end
178
- end
179
- protected :register_type
180
-
181
- #---
182
-
183
- def add_build_info(type, file)
184
- type = type.to_sym
185
-
186
- @load_info[type] = {} unless @load_info.has_key?(type)
187
-
188
- components = file.split(File::SEPARATOR)
189
- provider = components.pop.sub(/\.rb/, '').to_sym
190
- directory = components.join(File::SEPARATOR)
191
-
192
- logger.info("Loading corl #{type} plugin #{provider} at #{Time.now}")
193
-
194
- unless @load_info[type].has_key?(provider)
195
- data = {
196
- :type => type,
197
- :provider => provider,
198
- :directory => directory,
199
- :file => file
200
- }
201
-
202
- logger.debug("Plugin #{type} loaded: #{data.inspect}")
203
- @load_info[type][provider] = data
204
- end
205
- end
206
- protected :add_build_info
207
-
208
- #---
209
-
210
- def autoload
211
- logger.info("Autoloading registered plugins at #{Time.now}")
212
-
213
- @load_info.keys.each do |type|
214
- logger.debug("Autoloading type: #{type}")
215
-
216
- @load_info[type].each do |provider, plugin|
217
- logger.debug("Autoloading provider #{provider} at #{plugin[:directory]}")
218
-
219
- corl_require(plugin[:directory], provider)
220
-
221
- @load_info[type][provider][:class] = CORL.class_const([ 'CORL', type, provider ])
222
- logger.debug("Updated #{type} #{provider} load info: #{@load_info[type][provider].inspect}")
223
-
224
- # Make sure extensions are listening from the time they are loaded
225
- create(:extension, provider) if type == :extension # Create a persistent instance
226
- end
227
- end
228
- end
229
-
230
- #---
231
-
232
- def create(type, provider, options = {})
233
- type = type.to_sym
234
- provider = provider.to_sym
235
-
236
- unless @types.has_key?(type)
237
- logger.warn("Plugin type #{type} creation requested but it has not been registered yet")
238
- return nil
239
- end
240
-
241
- options = translate_type(type, options)
242
- info = @load_info[type][provider] if Util::Data.exists?(@load_info, [ type, provider ])
243
-
244
- if info
245
- logger.debug("Plugin information for #{provider} #{type} found. Data: #{info.inspect}")
246
-
247
- instance_name = "#{provider}_" + CORL.sha1(options)
248
- options = translate(type, provider, options)
249
-
250
- @plugins[type] = {} unless @plugins.has_key?(type)
251
-
252
- unless instance_name && @plugins[type].has_key?(instance_name)
253
- info[:instance_name] = instance_name
254
- options[:meta] = Config.new(info).import(Util::Data.hash(options[:meta]))
255
-
256
- logger.info("Creating new plugin #{provider} #{type} with #{options.inspect}")
257
-
258
- plugin = CORL.class_const([ 'CORL', type, provider ]).new(type, provider, options)
259
-
260
- @plugins[type][instance_name] = plugin
261
- end
262
- return @plugins[type][instance_name]
263
- end
264
-
265
- logger.warn("Plugin information cannot be found for plugin #{type} #{provider}")
266
- nil
267
- end
268
-
269
- #---
270
-
271
- def get(type, name)
272
- logger.info("Fetching plugin #{type} #{name}")
273
-
274
- if @plugins.has_key?(type)
275
- @plugins[type].each do |instance_name, plugin|
276
- if plugin.plugin_name.to_s == name.to_s
277
- logger.debug("Plugin #{type} #{name} found")
278
- return plugin
279
- end
280
- end
281
- end
282
- logger.debug("Plugin #{type} #{name} not found")
283
- nil
284
- end
285
-
286
- #---
287
-
288
- def remove(plugin)
289
- if plugin && plugin.respond_to?(:plugin_type) && @plugins.has_key?(plugin.plugin_type)
290
- logger.debug("Removing #{plugin.plugin_type} #{plugin.plugin_name}")
291
- @plugins[plugin.plugin_type].delete(plugin.plugin_instance_name)
292
- plugin.terminate if plugin.respond_to?(:terminate)
293
- else
294
- logger.warn("Cannot remove plugin: #{plugin.inspect}")
295
- end
296
- end
297
-
298
- #-----------------------------------------------------------------------------
299
- # Extension hook execution
300
-
301
- def exec(method, options = {})
302
- results = nil
303
-
304
- if CORL.log_level == :hook # To save processing on rendering
305
- logger.hook("Executing extension hook { #{method} } at #{Time.now} with:\n#{PP.pp(options, '')}\n")
306
- end
307
-
308
- extensions = plugins(:extension)
309
-
310
- extensions.each do |name, plugin|
311
- provider = plugin.plugin_provider
312
- result = nil
313
-
314
- logger.debug("Checking extension #{provider}")
315
-
316
- if plugin.respond_to?(method)
317
- results = {} if results.nil?
318
-
319
- result = plugin.send(method, options)
320
- logger.info("Completed hook #{method} at #{Time.now} with: #{result.inspect}")
321
-
322
- if block_given?
323
- results[provider] = yield(:process, result)
324
- logger.debug("Processed extension result into: #{results[provider].inspect}")
325
- end
326
-
327
- if results[provider].nil?
328
- logger.debug("Setting extension result to: #{result.inspect}")
329
- results[provider] = result
330
- end
331
- end
332
- end
333
-
334
- if ! results.nil? && block_given?
335
- results = yield(:reduce, results)
336
- logger.debug("Reducing extension results to: #{results.inspect}")
337
- else
338
- logger.debug("Final extension results: #{results.inspect}")
339
- end
340
- results
341
- end
342
-
343
- #---
344
-
345
- def config(type, options = {})
346
- config = Config.ensure(options)
347
-
348
- logger.debug("Generating #{type} extended configuration from: #{config.export.inspect}")
349
-
350
- exec("#{type}_config", Config.new(config.export)) do |op, data|
351
- if op == :reduce
352
- data.each do |provider, result|
353
- config.defaults(result)
354
- end
355
- nil
356
- else
357
- hash(data)
358
- end
359
- end
360
- config.delete(:extension_type)
361
-
362
- logger.debug("Final extended configuration: #{config.export.inspect}")
363
- config
364
- end
365
-
366
- #---
367
-
368
- def check(method, options = {})
369
- config = Config.ensure(options)
370
-
371
- logger.debug("Checking extension #{method} given: #{config.export.inspect}")
372
-
373
- success = exec(method, config.import({ :extension_type => :check })) do |op, data|
374
- if op == :reduce
375
- ! data.values.include?(false)
376
- else
377
- data ? true : false
378
- end
379
- end
380
-
381
- success = success.nil? || success ? true : false
382
-
383
- logger.debug("Extension #{method} check result: #{success.inspect}")
384
- success
385
- end
386
-
387
- #---
388
-
389
- def value(method, value, options = {})
390
- config = Config.ensure(options)
391
-
392
- logger.debug("Setting extension #{method} value given: #{value.inspect}")
393
-
394
- exec(method, config.import({ :value => value, :extension_type => :value })) do |op, data|
395
- if op == :process
396
- value = data unless data.nil?
397
- end
398
- end
399
-
400
- logger.debug("Extension #{method} retrieved value: #{value.inspect}")
401
- value
402
- end
403
-
404
- #-----------------------------------------------------------------------------
405
- # Utilities
406
-
407
- def translate_type(type, info, method = :translate)
408
- klass = CORL.class_const([ 'CORL', :plugin, type ])
409
- logger.debug("Executing option translation for: #{klass.inspect}")
410
-
411
- info = klass.send(method, info) if klass.respond_to?(method)
412
- info
413
- end
414
-
415
- #---
416
-
417
- def translate(type, provider, info, method = :translate)
418
- klass = CORL.class_const([ 'CORL', type, provider ])
419
- logger.debug("Executing option translation for: #{klass.inspect}")
420
-
421
- info = klass.send(method, info) if klass.respond_to?(method)
422
- info
423
- end
424
- end
425
- end