Sha256: af6ee7049f3c6b43542cdce00d710bae67e6bc06266618a24ab1119538ea7800
Contents?: true
Size: 1.22 KB
Versions: 3
Compression:
Stored size: 1.22 KB
Contents
require "dry-container" require "logger" require "pastel" require "spek" <% namespace do %> # Provides a global gem container for injection into other objects. module Container extend Dry::Container::Mixin register(:configuration) { Configuration::Loader.call } register(:specification) { Spek::Loader.call "#{__dir__}/<%= Array.new(2 + configuration.project_levels, "../").join %><%= configuration.project_name %>.gemspec" } register(:colorizer) { Pastel.new enabled: $stdout.tty? } register(:kernel) { Kernel } register :log_colors do { "DEBUG" => self[:colorizer].white.detach, "INFO" => self[:colorizer].green.detach, "WARN" => self[:colorizer].yellow.detach, "ERROR" => self[:colorizer].red.detach, "FATAL" => self[:colorizer].white.bold.on_red.detach, "ANY" => self[:colorizer].white.bold.detach } end register :logger do Logger.new $stdout, level: Logger.const_get(ENV.fetch("LOG_LEVEL", "INFO")), formatter: ( lambda do |severity, _at, _name, message| self[:log_colors][severity].call "#{message}\n" end ) end end <% end %>
Version data entries
3 entries across 3 versions & 1 rubygems