lib/milestoner/container.rb in milestoner-17.4.0 vs lib/milestoner/container.rb in milestoner-17.5.0
- old
+ new
@@ -1,41 +1,41 @@
# frozen_string_literal: true
require "cogger"
-require "dry-container"
+require "containable"
require "etcher"
require "gitt"
require "lode"
require "runcom"
require "sanitize"
require "spek"
module Milestoner
# Provides a global gem container for injection into other objects.
module Container
- extend Dry::Container::Mixin
+ extend Containable
namespace :xdg do
- register(:cache, memoize: true) { Runcom::Cache.new "milestoner/database.store" }
- register(:config, memoize: true) { Runcom::Config.new "milestoner/configuration.yml" }
+ register(:cache) { Runcom::Cache.new "milestoner/database.store" }
+ register(:config) { Runcom::Config.new "milestoner/configuration.yml" }
end
- register :cache, memoize: true do
+ register :cache do
# :nocov:
Lode.new self["xdg.cache"].passive do |config|
config.mode = :max
config.table = Lode::Tables::Value
config.register :users, model: Models::User, primary_key: :name
end
end
- register :configuration, memoize: true do
+ register :configuration do
self[:defaults].add_loader(Etcher::Loaders::YAML.new(self["xdg.config"].active))
.then { |registry| Etcher.call registry }
end
- register :defaults, memoize: true do
+ 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::Build::Root)
.add_transformer(Configuration::Transformers::Build::TemplatePaths.new)
.add_transformer(Configuration::Transformers::Gems::Label.new)
@@ -55,21 +55,15 @@
.add_transformer(Configuration::Transformers::URI::Profile)
.add_transformer(Configuration::Transformers::URI::Review)
.add_transformer(Configuration::Transformers::URI::Tracker)
end
- register :specification, memoize: true do
- self[:spec_loader].call "#{__dir__}/../../milestoner.gemspec"
- end
-
- register :sanitizer, memoize: true do
- -> content { Sanitize.fragment content, Sanitize::Config::BASIC }
- end
-
- register(:spec_loader, memoize: true) { Spek::Loader.new }
- register(:git, memoize: true) { Gitt::Repository.new }
- register(:input, memoize: true) { self[:configuration].dup }
- register(:defaults_path, memoize: true) { Pathname(__dir__).join("configuration/defaults.yml") }
- register(:logger, memoize: true) { Cogger.new id: :milestoner }
+ register(:specification) { self[:spec_loader].call "#{__dir__}/../../milestoner.gemspec" }
+ register(:sanitizer) { -> content { Sanitize.fragment content, Sanitize::Config::BASIC } }
+ register(:spec_loader) { Spek::Loader.new }
+ register(:git) { Gitt::Repository.new }
+ register(:input) { self[:configuration].dup }
+ register(:defaults_path) { Pathname(__dir__).join("configuration/defaults.yml") }
+ register(:logger) { Cogger.new id: :milestoner }
register :kernel, Kernel
end
end