Sha256: 0f277e919b3a087f436f6760984f4edf3651e51e29271321d58e6d21de88f2ff
Contents?: true
Size: 1.59 KB
Versions: 4
Compression:
Stored size: 1.59 KB
Contents
# frozen_string_literal: true require "cogger" require "dry-container" require "etcher" require "gitt" require "runcom" require "spek" module Rubysmith # Provides a global gem container for injection into other objects. module Container extend Dry::Container::Mixin register :configuration do self[:defaults].add_loader(Etcher::Loaders::YAML.new(self[:xdg_config].active)) .then { |registry| Etcher.call registry } end register :defaults do Etcher::Registry.new(contract: Configuration::Contract, model: Configuration::Model) .add_loader(Etcher::Loaders::YAML.new(self[:defaults_path])) .add_transformer(Configuration::Transformers::CurrentTime) .add_transformer(Configuration::Transformers::GitHubUser.new) .add_transformer(Configuration::Transformers::GitEmail.new) .add_transformer(Configuration::Transformers::GitUser.new) .add_transformer(Configuration::Transformers::TemplateRoot.new) .add_transformer(Configuration::Transformers::TargetRoot) end register(:input, memoize: true) { self[:configuration].dup } register(:defaults_path) { Pathname(__dir__).join("configuration/defaults.yml") } register(:xdg_config) { Runcom::Config.new "rubysmith/configuration.yml" } register(:specification) { Spek::Loader.call "#{__dir__}/../../rubysmith.gemspec" } register(:git) { Gitt::Repository.new } register(:kernel) { Kernel } register(:logger) { Cogger.new formatter: :emoji } end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rubysmith-5.4.0 | lib/rubysmith/container.rb |
rubysmith-5.3.0 | lib/rubysmith/container.rb |
rubysmith-5.2.0 | lib/rubysmith/container.rb |
rubysmith-5.1.0 | lib/rubysmith/container.rb |