class Milestoner::Tags::Creator
Handles the creation of project repository tags.
Attributes
categorizer[R]
container[R]
presenter[R]
Public Class Methods
new(categorizer: Commits::Categorizer.new, presenter: Presenters::Commit, container: Container)
click to toggle source
# File lib/milestoner/tags/creator.rb, line 12 def initialize categorizer: Commits::Categorizer.new, presenter: Presenters::Commit, container: Container @categorizer = categorizer @presenter = presenter @container = container end
Public Instance Methods
call(configuration = CLI::Configuration::Loader.call)
click to toggle source
# File lib/milestoner/tags/creator.rb, line 21 def call configuration = CLI::Configuration::Loader.call return false if local? configuration fail Error, "Unable to tag without commits." if categorizer.call.empty? sign configuration rescue Versionaire::Errors::Cast, GitPlus::Error => error raise Error, error.message end
Private Instance Methods
local?(configuration)
click to toggle source
# File lib/milestoner/tags/creator.rb, line 34 def local? configuration version = Version configuration.git_tag_version if repository.tag_local? version logger.warn "Local tag exists: #{version}. Skipped." true else false end end
logger(= container[__method__])
click to toggle source
# File lib/milestoner/tags/creator.rb, line 68 def logger = container[__method__] end
message(configuration)
click to toggle source
# File lib/milestoner/tags/creator.rb, line 58 def message configuration categorizer.call(configuration) .map { |record| presenter.new(record).line_item } .then do |line_items| %(Version #{configuration.git_tag_version}\n\n#{line_items.join "\n"}\n\n) end end
repository(= container[__method__])
click to toggle source
# File lib/milestoner/tags/creator.rb, line 66 def repository = container[__method__] def logger = container[__method__] end end
sign(configuration)
click to toggle source
# File lib/milestoner/tags/creator.rb, line 45 def sign configuration version = configuration.git_tag_version content = message configuration if configuration.git_tag_sign repository.tag_sign version, content else repository.tag_unsign version, content end logger.debug "Local tag created: #{version}." end