Class: Bcome::Stack::Platform
- Includes:
- BecomeObject
- Defined in:
- lib/stack/platform.rb
Constant Summary
Constants included from BecomeObject
Constants included from Orchestrator::Registry
Orchestrator::Registry::CONFIGS_PATH
Constants included from ContextFunctions
ContextFunctions::CONFIGS_PATH
Instance Attribute Summary collapse
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#meta_data ⇒ Object
readonly
Returns the value of attribute meta_data.
-
#quick_contexts ⇒ Object
readonly
Returns the value of attribute quick_contexts.
Class Method Summary collapse
Instance Method Summary collapse
- #child_reference_key ⇒ Object
- #collection_key ⇒ Object
- #collection_klass ⇒ Object
- #config_path ⇒ Object
- #do_describe ⇒ Object
- #has_quick_contexts? ⇒ Boolean
-
#initialize(identifier, meta_data) ⇒ Platform
constructor
A new instance of Platform.
- #menu_items ⇒ Object
- #node_level_klass ⇒ Object
- #quick_context_for_reference(context_reference) ⇒ Object
- #reference_key ⇒ Object
Methods included from BecomeObject
#all_items, #become_identifier, #context_breadcrumb, #do_load_resources, #has_main_context?, #has_potential_resources?, #identifier_for, #is_stack_level_resource?, #list, #local_download_path, #main_context, #main_context=, #mini_list, #namespace, #previous_workspace_object, #previous_workspace_object=, #resource_for_identifier, #resource_identifiers, #resources, #responds_to_list?
Methods inherited from Base
#available_resources_options_string, #become, #become_identifier, const_missing, #construct_node, #describe, #has_sub_nodes?, #highlight?, #init, #interactive, #machines, #menu, #method_missing, #node, #recipes, #respond_to_bcome_context_method?, #workon
Methods included from Orchestrator::Registry
#config_for_registry, #do_load_recipes, #has_registry_config?, #load_recipe_registry, #recipe_registry, #registry_configs_path
Methods included from CommandHelper
Methods included from ContextFunctions
#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, ) @identifier = identifier @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 (readonly)
Returns the value of attribute identifier.
17 18 19 |
# File 'lib/stack/platform.rb', line 17 def identifier @identifier end |
#meta_data ⇒ Object (readonly)
Returns the value of attribute meta_data.
17 18 19 |
# File 'lib/stack/platform.rb', line 17 def @meta_data end |
#quick_contexts ⇒ Object (readonly)
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
50 51 52 |
# File 'lib/stack/platform.rb', line 50 def child_reference_key :platform end |
#collection_key ⇒ Object
54 55 56 |
# File 'lib/stack/platform.rb', line 54 def collection_key :environments end |
#collection_klass ⇒ Object
42 43 44 |
# File 'lib/stack/platform.rb', line 42 def collection_klass ::ENV_STACK_KLASS end |
#config_path ⇒ Object
38 39 40 |
# File 'lib/stack/platform.rb', line 38 def config_path "#{CONFIGS_PATH}/network.yml" end |
#do_describe ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/stack/platform.rb', line 29 def do_describe description = "\tPlatform Name:". + "\s#{identifier.}\n" description += "\t" + "Description:". + "\s#{@meta_data[:description].}" + "\n" description += "\t" + "Location:". + "\s#{@meta_data[:location].}" + "\n" if @meta_data[:location] description += "\n" return description end |
#has_quick_contexts? ⇒ Boolean
58 59 60 |
# File 'lib/stack/platform.rb', line 58 def has_quick_contexts? return !quick_contexts.nil? end |
#menu_items ⇒ Object
25 26 27 |
# File 'lib/stack/platform.rb', line 25 def super end |
#node_level_klass ⇒ Object
69 70 71 |
# File 'lib/stack/platform.rb', line 69 def node_level_klass ::Bcome::Node::Platform end |
#quick_context_for_reference(context_reference) ⇒ Object
62 63 64 65 66 67 |
# File 'lib/stack/platform.rb', line 62 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
46 47 48 |
# File 'lib/stack/platform.rb', line 46 def reference_key :platforms end |