Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
covalence / lib / covalence.rb
Size: Mime:
require "covalence/version"
require "logger"
require 'active_support/core_ext/object/blank'

if %w(development test).include?(ENV['RAKE_ENV'])
  require 'byebug'
  require 'awesome_print'
end

# :reek:TooManyConstants
module Covalence
  # Configurable constants
  #TODO: look into how WORKSPACE is being used, maybe this can just be an internal ROOT and make CONFIG not depend on WORKSPACE
  WORKSPACE = File.absolute_path((ENV['COVALENCE_WORKSPACE'] || '.'))
  CONFIG = File.join(WORKSPACE, (ENV['COVALENCE_CONFIG'] || 'covalence.yaml'))
  # TODO: could use better naming
  PACKER = File.absolute_path(File.join(WORKSPACE, (ENV['COVALENCE_PACKER_DIR'] || '.')))
  TERRAFORM =  File.absolute_path(File.join(WORKSPACE, (ENV['COVALENCE_TERRAFORM_DIR'] || '.')))
  TEST_ENVS = (ENV['COVALENCE_TEST_ENVS'] || "").split(',')

  # should be able to deprecate this with covalence bundled inside the container
  TERRAFORM_IMG = ENV['TERRAFORM_IMG'] || ""
  TERRAFORM_CMD = ENV['TERRAFORM_CMD'] || "terraform"
  TERRAFORM_VERSION = ENV['TERRAFORM_VERSION'] || `#{TERRAFORM_CMD} #{TERRAFORM_IMG} version`.split("\n", 2)[0].gsub('Terraform v','')

  PACKER_IMG = ENV['PACKER_IMG'] || ""
  PACKER_CMD = ENV['PACKER_CMD'] || "packer"

  # No-op shell command. Should not need to modify for most unix shells.
  DRY_RUN_CMD = (ENV['COVALENCE_DRY_RUN_CMD'] || ":")
  DEBUG_CLI = (ENV['COVALENCE_DEBUG'] || 'false') =~ (/(true|t|yes|y|1)$/i)

  #DOCKER_ENV_FILE

  # Internal constants
  GEM_ROOT = File.expand_path('covalence', File.dirname(__FILE__)).freeze
  # look into logger-colors
  LOGGER = Logger.new(STDOUT)
  LOG_LEVEL = String(ENV['COVALENCE_LOG'] || "warn").upcase
  LOGGER.level = Logger.const_get(LOG_LEVEL)
end