Sha256: eafb1d6a7c264879e4ff1bcb03eb837347a5ae99231dde837030d14e02385ad9

Contents?: true

Size: 818 Bytes

Versions: 6

Compression:

Stored size: 818 Bytes

Contents

# frozen_string_literal: true

require "dry/monads"
require "pathname"
require "spek"

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

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

          def call content
            content.fetch(key) { spec_loader.call(path).summary }
                   .then { |value| Success content.merge!(key => value) }
          end

          private

          attr_reader :key, :path
        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/gems/description.rb
milestoner-17.5.0 lib/milestoner/configuration/transformers/gems/description.rb
milestoner-17.4.0 lib/milestoner/configuration/transformers/gems/description.rb
milestoner-17.3.0 lib/milestoner/configuration/transformers/gems/description.rb
milestoner-17.2.0 lib/milestoner/configuration/transformers/gems/description.rb
milestoner-17.1.0 lib/milestoner/configuration/transformers/gems/description.rb