module Fig::Command::Action::Role::ListVariablesAsGraphviz

Public Instance Methods

apply_config?() click to toggle source
# File lib/fig/command/action/role/list_variables_as_graphviz.rb, line 23
def apply_config?()
  return nil # don't care
end
descriptor_requirement() click to toggle source
# File lib/fig/command/action/role/list_variables_as_graphviz.rb, line 11
def descriptor_requirement()
  return nil
end
load_base_package?() click to toggle source
# File lib/fig/command/action/role/list_variables_as_graphviz.rb, line 15
def load_base_package?()
  return true
end
register_base_package?() click to toggle source
# File lib/fig/command/action/role/list_variables_as_graphviz.rb, line 19
def register_base_package?()
  return nil # don't care
end

Private Instance Methods

format_variable_statement(statement) click to toggle source
# File lib/fig/command/action/role/list_variables_as_graphviz.rb, line 67
def format_variable_statement(statement)
  string = '<tr><td align="right">'
  string << statement.statement_type
  string << '</td><td align="left">$'
  string << CGI.escape_html(statement.name)
  string << '</td><td align="left">'
  string << CGI.escape_html(statement.tokenized_value.to_escaped_string)
  string << '</td></tr>'

  return string
end
node_content(package, config_name) click to toggle source
# File lib/fig/command/action/role/list_variables_as_graphviz.rb, line 29
def node_content(package, config_name)
  style = ''
  color = ''
  if package == @execution_context.base_package
    if base_display_config_names.include?(config_name)
      style = ' style = "rounded, bold"'
    end
    if config_name == @execution_context.base_config
      color = ' color = blue'
    end
  end

  name = node_name package, config_name
  rows = variable_statement_rows package, config_name
  label = nil
  if rows.empty?
    label = %Q<"#{name}">
  else
    label = %Q[<<table border="0"><tr><td border="0" colspan="3"><b>#{name}</b></td></tr>#{rows}</table>>]
  end

  return %Q<"#{name}" [label = #{label}#{style}#{color}];>
end
variable_statement_rows(package, config_name) click to toggle source
# File lib/fig/command/action/role/list_variables_as_graphviz.rb, line 53
def variable_statement_rows(package, config_name)
  string = ''

  package[config_name].walk_statements do
    |statement|

    if statement.is_environment_variable?
      string << format_variable_statement(statement)
    end
  end

  return string
end