Sha256: dfd5d108fa38251f6389ee5bd47773bdf4215d48f0724f9a6ec3f3319be4e523

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

require "cogger"
require "containable"
require "etcher"
require "runcom"
require "spek"

module Tocer
  # Provides a global gem container for injection into other objects.
  module Container
    extend Containable

    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]))
    end

    register(:input) { self[:configuration].dup }
    register(:defaults_path) { Pathname(__dir__).join("configuration/defaults.yml") }
    register(:xdg_config) { Runcom::Config.new "tocer/configuration.yml" }
    register(:specification) { Spek::Loader.call "#{__dir__}/../../tocer.gemspec" }
    register(:logger) { Cogger.new id: :tocer }
    register :kernel, Kernel
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tocer-17.3.0 lib/tocer/container.rb