class EnvLint::Formatter

Public Class Methods

new(out = Formatador) click to toggle source
# File lib/env_lint/formatter.rb, line 5
def initialize(out = Formatador)
  @out = out
end

Public Instance Methods

error(message) click to toggle source
# File lib/env_lint/formatter.rb, line 31
def error(message)
  @out.display_line("* [red]#{message}[/]")
end
missing_variables(dot_env_file, variables) click to toggle source
# File lib/env_lint/formatter.rb, line 9
def missing_variables(dot_env_file, variables)
  error("Missing env variables:\n")

  variables.each do |variable|
    @out.display_line("  [yellow]#{variable.name}[/] - #{variable.comment}")
  end

  new_line
  info("Either set the variable or make it optional in the #{dot_env_file.name} file.")
end
ok(message) click to toggle source
# File lib/env_lint/formatter.rb, line 35
def ok(message)
  @out.display_line("* [green]#{message}[/]")
end
unknown_variables(dot_env_file, variable_names) click to toggle source
# File lib/env_lint/formatter.rb, line 20
def unknown_variables(dot_env_file, variable_names)
  error("Unknown env variables:\n")

  variable_names.each do |name|
    @out.display_line("  [yellow]#{name}[/]")
  end

  new_line
  info("Only variables descibred in #{dot_env_file.name} can be used.")
end

Private Instance Methods

info(message) click to toggle source
# File lib/env_lint/formatter.rb, line 41
def info(message)
  @out.display_line("  #{message}")
end
new_line() click to toggle source
# File lib/env_lint/formatter.rb, line 45
def new_line
  @out.display_line('')
end