Sha256: 886e2e7ca16a9f0dd39b61a7300946162a86f41d26e91becfa054e7695a84ec5

Contents?: true

Size: 791 Bytes

Versions: 6

Compression:

Stored size: 791 Bytes

Contents

# frozen_string_literal: true

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

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

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

          def call content
            content.fetch(key) { spec_loader.call(path).name }
                   .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/name.rb
milestoner-17.5.0 lib/milestoner/configuration/transformers/gems/name.rb
milestoner-17.4.0 lib/milestoner/configuration/transformers/gems/name.rb
milestoner-17.3.0 lib/milestoner/configuration/transformers/gems/name.rb
milestoner-17.2.0 lib/milestoner/configuration/transformers/gems/name.rb
milestoner-17.1.0 lib/milestoner/configuration/transformers/gems/name.rb