Sha256: 24d2be20e19b962c3a2d8ad68369a280abfec239a96db16a6137a8b23f433cb1

Contents?: true

Size: 1.73 KB

Versions: 30

Compression:

Stored size: 1.73 KB

Contents

require 'cgi'

module  Fig; end
class   Fig::Command; end
module  Fig::Command::Action; end
module  Fig::Command::Action::Role; end

module Fig::Command::Action::Role::ListVariablesAsGraphviz
  def descriptor_requirement()
    return nil
  end

  def load_base_package?()
    return true
  end

  def register_base_package?()
    return nil # don't care
  end

  def apply_config?()
    return nil # don't care
  end

  private

  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

  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

  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
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
fig-1.23.0 lib/fig/command/action/role/list_variables_as_graphviz.rb
fig-1.22.1.beta.1 lib/fig/command/action/role/list_variables_as_graphviz.rb
fig-1.22.0 lib/fig/command/action/role/list_variables_as_graphviz.rb
fig-1.21.1.beta.2 lib/fig/command/action/role/list_variables_as_graphviz.rb
fig-1.21.1.beta.1 lib/fig/command/action/role/list_variables_as_graphviz.rb
fig-1.21.0 lib/fig/command/action/role/list_variables_as_graphviz.rb
fig-1.20.1.beta.1 lib/fig/command/action/role/list_variables_as_graphviz.rb
fig-1.20.0 lib/fig/command/action/role/list_variables_as_graphviz.rb
fig-1.19.0 lib/fig/command/action/role/list_variables_as_graphviz.rb
fig-1.18.0 lib/fig/command/action/role/list_variables_as_graphviz.rb
fig-1.17.0 lib/fig/command/action/role/list_variables_as_graphviz.rb
fig-1.16.1.beta.1 lib/fig/command/action/role/list_variables_as_graphviz.rb
fig-1.16.0 lib/fig/command/action/role/list_variables_as_graphviz.rb
fig-1.15.1.beta.2 lib/fig/command/action/role/list_variables_as_graphviz.rb
fig-1.15.1.beta.1 lib/fig/command/action/role/list_variables_as_graphviz.rb
fig-1.15.0 lib/fig/command/action/role/list_variables_as_graphviz.rb
fig-1.14.0 lib/fig/command/action/role/list_variables_as_graphviz.rb
fig-1.13.0 lib/fig/command/action/role/list_variables_as_graphviz.rb
fig-1.12.0 lib/fig/command/action/role/list_variables_as_graphviz.rb
fig-1.11.0 lib/fig/command/action/role/list_variables_as_graphviz.rb