Sha256: 17cdfd20ed8cb59ad0fdfbce033363a9e2482c91312f88f72c5d1550655b3263

Contents?: true

Size: 1.18 KB

Versions: 8

Compression:

Stored size: 1.18 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, 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
      Etcher::Registry.new(contract: Configuration::Contract, model: Configuration::Model)
                      .add_loader(Etcher::Loaders::YAML.new(self[:defaults_path]))
    end

    register :specification, memoize: true do
      Spek::Loader.call "#{__dir__}/<%= Array.new(2 + configuration.project_levels, "../").join %><%= configuration.project_name %>.gemspec"
    end

    register(:defaults_path, memoize: true) { Pathname(__dir__).join("configuration/defaults.yml") }
    register(:xdg_config, memoize: true) { Runcom::Config.new "<%= configuration.project_path %>/configuration.yml" }
    register(:logger, memoize: true) { Cogger.new id: "<%= configuration.project_name %>" }
    register :kernel, Kernel
  end
<% end %>

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gemsmith-21.4.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/container.rb.erb
gemsmith-21.3.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/container.rb.erb
gemsmith-21.2.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/container.rb.erb
gemsmith-21.1.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/container.rb.erb
gemsmith-21.0.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/container.rb.erb
gemsmith-20.7.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/container.rb.erb
gemsmith-20.6.1 lib/gemsmith/templates/%project_name%/lib/%project_path%/container.rb.erb
gemsmith-20.6.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/container.rb.erb