Class: Bcome::Stack::Platform
Constant Summary
BecomeObject::CONFIGS_PATH
ContextFunctions::CONFIGS_PATH
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#all_items, #become_identifier, #context_breadcrumb, #do_load_resources, #has_main_context?, #list, #local_download_path, #main_context, #main_context=, #namespace, #previous_workspace_object, #previous_workspace_object=, #resource_for_identifier, #resources, #responds_to_list?
Methods inherited from Base
#available_resources_options_string, #become, #become_identifier, #construct_node, #describe, #highlight?, #init, #machines, #menu, #method_missing, #node, #recipes, #workon
#run_local
#command_for_context, #context_cmd_config_path, #context_cmd_functions, #context_commands, #execute_command_for_context, #has_context_cmd_functions?, #has_context_functions_config?, #load_context_cmd_functions
Constructor Details
#initialize(identifier, meta_data) ⇒ Platform
Returns a new instance of Platform.
19
20
21
22
23
|
# File 'lib/stack/platform.rb', line 19
def initialize(identifier, meta_data)
@identifier = identifier
@meta_data = meta_data
@quick_contexts = @meta_data[:quick_contexts]
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Bcome::Stack::Base
Instance Attribute Details
#identifier ⇒ Object
Returns the value of attribute identifier.
17
18
19
|
# File 'lib/stack/platform.rb', line 17
def identifier
@identifier
end
|
Returns the value of attribute meta_data.
17
18
19
|
# File 'lib/stack/platform.rb', line 17
def meta_data
@meta_data
end
|
#quick_contexts ⇒ Object
Returns the value of attribute quick_contexts.
17
18
19
|
# File 'lib/stack/platform.rb', line 17
def quick_contexts
@quick_contexts
end
|
Class Method Details
.collection_from_config(parent, configuration) ⇒ Object
7
8
9
10
11
12
13
14
|
# File 'lib/stack/platform.rb', line 7
def collection_from_config(parent, configuration)
return unless configuration
collection = []
configuration.each do |conf_data|
collection << new(conf_data[:name], conf_data)
end
return collection
end
|
Instance Method Details
#child_reference_key ⇒ Object
45
46
47
|
# File 'lib/stack/platform.rb', line 45
def child_reference_key
:platform
end
|
#collection_key ⇒ Object
49
50
51
|
# File 'lib/stack/platform.rb', line 49
def collection_key
:environments
end
|
#collection_klass ⇒ Object
37
38
39
|
# File 'lib/stack/platform.rb', line 37
def collection_klass
::ENV_STACK_KLASS
end
|
#config_path ⇒ Object
33
34
35
|
# File 'lib/stack/platform.rb', line 33
def config_path
"#{CONFIGS_PATH}/network.yml"
end
|
#do_describe ⇒ Object
29
30
31
|
# File 'lib/stack/platform.rb', line 29
def do_describe
"#{identifier}\n - #{@meta_data[:description]}\n"
end
|
#has_quick_contexts? ⇒ Boolean
53
54
55
|
# File 'lib/stack/platform.rb', line 53
def has_quick_contexts?
return !quick_contexts.nil?
end
|
25
26
27
|
# File 'lib/stack/platform.rb', line 25
def
super
end
|
#node_level_klass ⇒ Object
64
65
66
|
# File 'lib/stack/platform.rb', line 64
def node_level_klass
::Bcome::Node::Platform
end
|
#quick_context_for_reference(context_reference) ⇒ Object
57
58
59
60
61
62
|
# File 'lib/stack/platform.rb', line 57
def quick_context_for_reference(context_reference)
return nil unless has_quick_contexts?
matches = quick_contexts.select{|qc| qc[:ref] == context_reference }
raise "Multiple quick context matches found on platform #{@identifier} for context key #{context_reference}. Cannot load quick context - selection is ambiguous." if matches.size > 1
return matches.first
end
|
#reference_key ⇒ Object
41
42
43
|
# File 'lib/stack/platform.rb', line 41
def reference_key
:platforms
end
|