class Rake::Funnel::Integration::TeamCity::ProgressReport

Public Class Methods

new() click to toggle source
# File lib/rake/funnel/integration/teamcity/progress_report.rb, line 12
def initialize # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity
  super do
    task_starting do |task, _args|
      next unless TeamCity.running?

      ServiceMessages.block_opened(name: task.name) unless TeamCity.rake_runner?
    end

    task_finished do |task, _args, error|
      next unless TeamCity.running?

      error = error.inner_exception if error.respond_to?(:inner_exception)

      ServiceMessages.build_problem(description: error.message[0..4000 - 1]) if error

      next if Rake::Funnel::Integration::TeamCity.rake_runner?

      ServiceMessages.block_closed(name: task.name)
    end
  end
end