Class: Proctor::Command::RenderServiceCmd

Inherits:
Object
  • Object
show all
Includes:
Helpers::Command, Resource::Erb, Resource::Lookup
Defined in:
lib/proctor/command/render_service_cmd.rb

Instance Method Summary collapse

Methods included from Resource::Lookup

#lookup_valid_group_template, #lookup_valid_manager, #lookup_valid_node, #lookup_valid_service, #lookup_valid_service_template, #lookup_valid_services, #lookup_valid_services_hash

Methods included from Resource::Erb

#erb_ify, #erb_ify_hash, #erb_ify_services, #generate_group_erb, #generate_group_header, #generate_service_erb, #generate_service_header, #render_group_template, #render_service_template

Methods included from Helpers::Command

#check_number_of_args, #options_msg

Constructor Details

#initialize(global, options, args) ⇒ RenderServiceCmd

Returns a new instance of RenderServiceCmd.



13
14
15
16
17
18
19
# File 'lib/proctor/command/render_service_cmd.rb', line 13

def initialize(global, options, args)
  @manager = args[0]
  @service = args[1]
  @env     = options['env']
  opts = {'MANAGERS' => @env.managers.names, 'SERVICES' => @env.services.names}
  check_number_of_args(args, 2, 'render_service MANAGER SERVICE', opts)
end

Instance Method Details

#renderObject



21
22
23
# File 'lib/proctor/command/render_service_cmd.rb', line 21

def render
  puts render_string
end

#render_stringObject



25
26
27
28
29
30
# File 'lib/proctor/command/render_service_cmd.rb', line 25

def render_string
  manager  = lookup_valid_manager(@manager, @env)
  service  = lookup_valid_service(@service, @env)
  template = lookup_valid_service_template(@manager, @service, @env)
  render_service_template(manager, service, template, @env)
end