Sha256: 887d7bd118886bf7bcc1f6039c6f74a83f2c7b1d2f24aa98c6892508ca17c9f4
Contents?: true
Size: 1.14 KB
Versions: 7
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true require "cogger" require "dry-container" require "etcher" require "runcom" require "spek" module Pragmater # Provides a global gem container for injection into other objects. module Container extend Dry::Container::Mixin register :configuration, memoize: true do self[:defaults].add_loader(Etcher::Loaders::YAML.new(self[:xdg_config].active)) .then { |registry| Etcher.call registry } end register :defaults, memoize: true do Etcher::Registry.new(contract: Configuration::Contract, model: Configuration::Model) .add_loader(Etcher::Loaders::YAML.new(self[:defaults_path])) end register :specification, memoize: true do Spek::Loader.call "#{__dir__}/../../pragmater.gemspec" end register(:input, memoize: true) { self[:configuration].dup } register(:defaults_path, memoize: true) { Pathname(__dir__).join("configuration/defaults.yml") } register(:xdg_config, memoize: true) { Runcom::Config.new "pragmater/configuration.yml" } register(:logger, memoize: true) { Cogger.new id: :pragmater } register :kernel, Kernel end end
Version data entries
7 entries across 7 versions & 1 rubygems