Sha256: 3772a9daa345de7a28e040df1ca2c41a78c782469668245287e8fae5d315c364

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 KB

Contents

require "cogger"
require "dry/container"
require "etcher"
require "runcom"
require "spek"

<% namespace do %>
  # 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]))
    end

    register(:defaults_path) { Pathname(__dir__).join("configuration/defaults.yml") }
    register(:xdg_config) { Runcom::Config.new "<%= configuration.project_path %>/configuration.yml" }
    register(:specification) { Spek::Loader.call "#{__dir__}/<%= Array.new(2 + configuration.project_levels, "../").join %><%= configuration.project_name %>.gemspec" }
    register(:kernel) { Kernel }
    register(:logger) { Cogger.new formatter: :emoji }
  end
<% end %>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gemsmith-20.2.1 lib/gemsmith/templates/%project_name%/lib/%project_path%/container.rb.erb
gemsmith-20.2.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/container.rb.erb
gemsmith-20.1.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/container.rb.erb
gemsmith-20.0.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/container.rb.erb