Sha256: c1b5bfe74780d39e6778b3090f6a4cb7acd64dc19cdbd1e34ee1f8b09de0d774

Contents?: true

Size: 732 Bytes

Versions: 13

Compression:

Stored size: 732 Bytes

Contents

# frozen_string_literal: true

require "dry/monads"

module Milestoner
  module Tags
    # Handles the tagging and pushing of a tag to a remote repository.
    class Publisher
      include Import[:logger]
      include Dry::Monads[:result]

      def initialize(creator: Tags::Creator.new, pusher: Tags::Pusher.new, **)
        super(**)
        @creator = creator
        @pusher = pusher
      end

      def call version
        creator.call(version)
               .bind { pusher.call version }
               .bind { log_info version }
      end

      private

      attr_reader :creator, :pusher

      def log_info version
        logger.info { "Published: #{version}" }
        Success version
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
milestoner-18.11.0 lib/milestoner/tags/publisher.rb
milestoner-18.10.0 lib/milestoner/tags/publisher.rb
milestoner-18.9.0 lib/milestoner/tags/publisher.rb
milestoner-18.8.0 lib/milestoner/tags/publisher.rb
milestoner-18.7.0 lib/milestoner/tags/publisher.rb
milestoner-18.6.0 lib/milestoner/tags/publisher.rb
milestoner-18.5.0 lib/milestoner/tags/publisher.rb
milestoner-18.4.0 lib/milestoner/tags/publisher.rb
milestoner-18.3.0 lib/milestoner/tags/publisher.rb
milestoner-18.2.0 lib/milestoner/tags/publisher.rb
milestoner-18.1.0 lib/milestoner/tags/publisher.rb
milestoner-18.0.1 lib/milestoner/tags/publisher.rb
milestoner-18.0.0 lib/milestoner/tags/publisher.rb