module EnvChecker

Constants

VERSION

Public Class Methods

check(file = nil) click to toggle source
# File lib/env_checker.rb, line 6
def self.check(file = nil)
  missing_variables = []
  variables(file).each do |env_v|
    missing_variables << "#{env_v[:name]} #{env_v[:desc]}" if ENV[env_v[:name]].nil?
  end
  send_error(missing_variables) if missing_variables.any?
end

Private Class Methods

send_error(missing_variables) click to toggle source
# File lib/env_checker.rb, line 16
def self.send_error(missing_variables)
  # Do nothing, override this to send to anywhere you want
end
variables(file) click to toggle source
# File lib/env_checker.rb, line 20
def self.variables(file)
  file ||= "lib/constants/env_variables.yml"
  YAML.load_file(file) || []
end