Sha256: 7d43a5940f10da16bce9764a418ff81b0f56faa757e90a05442bbdcc57a5531f

Contents?: true

Size: 854 Bytes

Versions: 13

Compression:

Stored size: 854 Bytes

Contents

# frozen_string_literal: true

require "dry/monads"
require "pathname"

module Milestoner
  module Configuration
    module Transformers
      module Gems
        # Conditionally updates project label based on specification label.
        class Label
          include Import[:spec_loader]
          include Dry::Monads[:result]

          def initialize(key = :project_label, path: "#{Pathname.pwd.basename}.gemspec", **)
            @key = key
            @path = path
            super(**)
          end

          def call attributes
            attributes.fetch key do
              value = spec_loader.call(path).label
              attributes.merge! key => value unless value == "Undefined"
            end

            Success attributes
          end

          private

          attr_reader :key, :path
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
milestoner-18.11.0 lib/milestoner/configuration/transformers/gems/label.rb
milestoner-18.10.0 lib/milestoner/configuration/transformers/gems/label.rb
milestoner-18.9.0 lib/milestoner/configuration/transformers/gems/label.rb
milestoner-18.8.0 lib/milestoner/configuration/transformers/gems/label.rb
milestoner-18.7.0 lib/milestoner/configuration/transformers/gems/label.rb
milestoner-18.6.0 lib/milestoner/configuration/transformers/gems/label.rb
milestoner-18.5.0 lib/milestoner/configuration/transformers/gems/label.rb
milestoner-18.4.0 lib/milestoner/configuration/transformers/gems/label.rb
milestoner-18.3.0 lib/milestoner/configuration/transformers/gems/label.rb
milestoner-18.2.0 lib/milestoner/configuration/transformers/gems/label.rb
milestoner-18.1.0 lib/milestoner/configuration/transformers/gems/label.rb
milestoner-18.0.1 lib/milestoner/configuration/transformers/gems/label.rb
milestoner-18.0.0 lib/milestoner/configuration/transformers/gems/label.rb