Sha256: 369e03fe916a942e98e9ab28b75b8b3f193bee74b0c6291be0a955514d0656b5

Contents?: true

Size: 752 Bytes

Versions: 6

Compression:

Stored size: 752 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 content
            content.fetch_value(key) { versioner.call }
                   .then { |value| Success content.merge!(key => value) }
          end

          private

          attr_reader :key, :versioner
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
milestoner-17.6.0 lib/milestoner/configuration/transformers/project/version.rb
milestoner-17.5.0 lib/milestoner/configuration/transformers/project/version.rb
milestoner-17.4.0 lib/milestoner/configuration/transformers/project/version.rb
milestoner-17.3.0 lib/milestoner/configuration/transformers/project/version.rb
milestoner-17.2.0 lib/milestoner/configuration/transformers/project/version.rb
milestoner-17.1.0 lib/milestoner/configuration/transformers/project/version.rb