Class: Bcome::Stack::View

Inherits:
Environment show all
Defined in:
lib/stack/view.rb

Constant Summary

Constants included from Functions

Functions::CONFIGS_PATH

Constants included from BecomeObject

BecomeObject::CONFIGS_PATH

Constants included from Orchestrator::Registry

Orchestrator::Registry::CONFIGS_PATH

Constants included from ContextFunctions

ContextFunctions::CONFIGS_PATH

Instance Attribute Summary

Attributes inherited from Environment

#identifier, #meta_data, #platform

Instance Method Summary collapse

Methods inherited from Environment

#child_reference_key, collection_from_config, #collection_key, #collection_klass, #config_path, #do_create_views, #do_describe, #dynamic_network_lookup?, #list_views, #menu_items, #network_lookup, #network_lookup_type, #node_level_klass, #reference_key, #resource_for_identifier, #resource_identifiers, #resource_identifiers_with_views, #sudo

Methods included from Functions

#F, #cmd_config_path, #cmd_for_ref, #cmd_functions, #functions, #has_cmd_functions?, #has_functions_config?, #load_cmd_functions

Methods included from EnvironmentSSH

#bastion_ip_address, #bastion_server, #bootstrap_proxy_command, #dynamic_network_lookup?, #execute_cmd, #execute_command, #execute_scp_download, #execute_scp_upload, #network_lookup, #network_lookup_type, #proxy, #proxy_command, #ssh_key_path, #ssh_mode_type, #ssh_mode_user, #ssh_nat_user, #ssh_user, #valid_ssh_modes

Methods included from FogHelper

#colour_code_for_server_status, #credentials_key, #ec2_filters, #ec2_tags, #filter_by_tags, #fog_client, #instance_matches_tags?, #reload!, #render_servers_not_returned_by_filtered_lookup, #servers, #servers_not_returned_by_filtered_lookup, #show_all_unfiltered_status?, #unfiltered_fog_lookup, #unfiltered_search_params, #unfiltered_servers

Methods included from Bcome::Selections

#add, #add!, #add_object, #clear!, #find_resource_by_identifier, #get, #in_resources?, #manage_object, #no_selections?, #no_selections_error, #object_in_selections?, #put, #remove, #remove_object, #run, #selections

Methods included from BecomeObject

#all_items, #become_identifier, #context_breadcrumb, #has_main_context?, #has_potential_resources?, #identifier, #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, #menu_items, #method_missing, #node_level_klass, #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

#run_local

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(meta_data, parent, encapsulating_environment, sub_view_data) ⇒ View

Returns a new instance of View.



4
5
6
7
8
9
10
# File 'lib/stack/view.rb', line 4

def initialize(, parent, encapsulating_environment, sub_view_data)
  @meta_data = 
  @identifier = sub_view_data[:id]
  @platform = parent
  @sub_view_data = sub_view_data
  @encapsulating_environment = encapsulating_environment  
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Bcome::Stack::Base

Instance Method Details

#descriptionObject



37
38
39
40
41
# File 'lib/stack/view.rb', line 37

def description
  desc = "\tidentifier:".menu_item_cyan + "\s#{identifier}".menu_item_green + "\n"
  desc += "\tselectors:".menu_item_cyan + "\s#{pretty_selectors}" + "\n"
  return desc + "\n"
end

#do_load_resourcesObject



20
21
22
# File 'lib/stack/view.rb', line 20

def do_load_resources
  @filtered_resources ||= filter_resources
end

#has_views?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/stack/view.rb', line 16

def has_views?
  false
end

#nodeObject



24
25
26
# File 'lib/stack/view.rb', line 24

def node
  @encapsulating_environment.node
end

#pretty_selectorsObject



28
29
30
31
32
33
34
35
# File 'lib/stack/view.rb', line 28

def pretty_selectors
  raw = @sub_view_data[:selectors]
  return raw.collect{|key, values|  
     values.collect{|value|
       "\s(node.#{key} == '#{value}')"
     }  
  }.join("\sOR".friendly)
end

#viewsObject



12
13
14
# File 'lib/stack/view.rb', line 12

def views
  []
end