Sha256: cc6e064f5e991ed83ef404ea4752683deabdcacf4b9f14405576c62a0ea60fee
Contents?: true
Size: 1.88 KB
Versions: 8
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 formatter: :emoji } register :kernel, Kernel end end
Version data entries
8 entries across 8 versions & 1 rubygems