Sha256: 956171b1360ef3b54985784fbee07113da2610ac10f4906a275a43ecb69c09a7

Contents?: true

Size: 844 Bytes

Versions: 3

Compression:

Stored size: 844 Bytes

Contents

# frozen_string_literal: true

require "dry/monads"
require "pathname"
require "runcom"

module Milestoner
  module Configuration
    module Transformers
      module Build
        # Ensures XDG configuration and gem template paths are configured.
        class TemplatePaths
          include Dry::Monads[:result]

          def initialize key = :build_template_paths,
                         default: Pathname(__dir__).join("../../../templates"),
                         xdg_config: Runcom::Config.new("milestoner/templates")
            @key = key
            @default = default
            @xdg_config = xdg_config
          end

          def call(attributes) = Success attributes.merge!(key => xdg_config.all.append(default))

          private

          attr_reader :key, :default, :xdg_config
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
milestoner-17.11.0 lib/milestoner/configuration/transformers/build/template_paths.rb
milestoner-17.10.0 lib/milestoner/configuration/transformers/build/template_paths.rb
milestoner-17.9.0 lib/milestoner/configuration/transformers/build/template_paths.rb