class Capistrano::Slacky::Facade::Changelog

Attributes

difference[R]

Public Class Methods

for(env:) click to toggle source
# File lib/capistrano/slacky/facade/changelog.rb, line 7
def self.for(env:)
  new(
    previous: env.fetch(:previous_revision),
    current: env.fetch(:current_revision)
  ).call
end
new(previous:, current:) click to toggle source
# File lib/capistrano/slacky/facade/changelog.rb, line 14
def initialize(previous:, current:)
  @difference = ::Capistrano::Slacky::Command::Diff.call(
    previous: previous,
    current: current
  )
end

Public Instance Methods

call() click to toggle source
# File lib/capistrano/slacky/facade/changelog.rb, line 21
def call
  if difference.empty?
    return ::Capistrano::Slacky::Block::Context.new(
      ::I18n.t("slacky.nothing_has_changed_since_the_previous_release", scope: "capistrano")
    )
  end

  difference.map do |message|
    ::Capistrano::Slacky::Block::Context.new(
      *message.to_a
    )
  end
end