Sha256: 78445c9aac619341618a285951afccda1ad648f25041089a8cb200ffdde1c19b

Contents?: true

Size: 764 Bytes

Versions: 3

Compression:

Stored size: 764 Bytes

Contents

# frozen_string_literal: true

require "dry/monads"
require "refinements/hash"

module Milestoner
  module Configuration
    module Transformers
      module Project
        # Conditionally updates version based on last Git tag.
        class Version
          include Dry::Monads[:result]

          using Refinements::Hash

          def initialize key = :project_version, versioner: Commits::Versioner.new
            @key = key
            @versioner = versioner
          end

          def call attributes
            attributes.fetch_value(key) { versioner.call }
                      .then { |value| Success attributes.merge!(key => value) }
          end

          private

          attr_reader :key, :versioner
        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/project/version.rb
milestoner-17.10.0 lib/milestoner/configuration/transformers/project/version.rb
milestoner-17.9.0 lib/milestoner/configuration/transformers/project/version.rb