Sha256: dbdb5a0120946e5efe51b8841055565d1e10725a7e294d65500caaa0ea6e43f1

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

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

<% namespace do %>
  # Provides a global gem container for injection into other objects.
  module Container
    extend Containable

    register :configuration do
      self[:defaults].add_loader(:yaml, self[:xdg_config].active)
                     .then { |registry| Etcher.call registry }
    end

    register :defaults do
      Etcher::Registry.new(contract: Configuration::Contract, model: Configuration::Model)
                      .add_loader(:yaml, self[:defaults_path])
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gemsmith-21.10.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/container.rb.erb
gemsmith-21.9.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/container.rb.erb