Sha256: 0c3cf743b4b8c4f9920873230f34e20877ee1117f67f20c4d8ae3c77347422c2
Contents?: true
Size: 1.88 KB
Versions: 12
Compression:
Stored size: 1.88 KB
Contents
# frozen_string_literal: true require "cogger" require "dry-container" require "etcher" require "runcom" require "spek" module Hanamismith # 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 registry = Etcher::Registry.new contract: Rubysmith::Configuration::Contract, model: Rubysmith::Configuration::Model registry.add_loader(Etcher::Loaders::YAML.new(self[:defaults_path])) .add_transformer(Rubysmith::Configuration::Transformers::CurrentTime) .add_transformer(Rubysmith::Configuration::Transformers::GitHubUser.new) .add_transformer(Rubysmith::Configuration::Transformers::GitEmail.new) .add_transformer(Rubysmith::Configuration::Transformers::GitUser.new) .add_transformer(Rubysmith::Configuration::Transformers::TemplateRoot.new) .add_transformer( Rubysmith::Configuration::Transformers::TemplateRoot.new( default: Pathname(__dir__).join("templates") ) ) .add_transformer(Rubysmith::Configuration::Transformers::TargetRoot) end register :specification, memoize: true do Spek::Loader.call "#{__dir__}/../../hanamismith.gemspec" end register(:input, memoize: true) { self[:configuration].dup } register(:defaults_path) { Rubysmith::Container[:defaults_path] } register(:xdg_config, memoize: true) { Runcom::Config.new "hanamismith/configuration.yml" } register(:logger, memoize: true) { Cogger.new id: :hanamismith } register :kernel, Kernel end end
Version data entries
12 entries across 12 versions & 1 rubygems