Sha256: c49fad5a6b1885706f8d26ca7d6c15e6883ab546c12c0b7e3e78dba9b32658d5
Contents?: true
Size: 1.12 KB
Versions: 10
Compression:
Stored size: 1.12 KB
Contents
# frozen_string_literal: true require "core" require "dry/monads" module Milestoner module Tags # Handles the creation of project repository tags. class Creator include Import[:git, :logger] include Dry::Monads[:result] def initialize( collector: Commits::Collector.new, builder: Builders::Stream.new(io: StringIO.new), ** ) @collector = collector @builder = builder super(**) end def call version return Success version if local? version collect.bind { create version } end private attr_reader :collector, :builder def local? version if git.tag_local? version logger.warn { "Local tag exists: #{version}. Skipped." } true else false end end def collect = collector.call.alt_map { |message| message.sub("fatal: y", "Y").sub("\n", ".") } def create(version) = build(version).bind { |body| git.tag_create version, body } def build(version) = builder.call.fmap { |body| "Version #{version}\n\n#{body}\n\n" } end end end
Version data entries
10 entries across 10 versions & 1 rubygems