Sha256: 49816286965e44b5b0c25a16216e1cc5bed48d46c85d0745777f3ff53b410928

Contents?: true

Size: 826 Bytes

Versions: 18

Compression:

Stored size: 826 Bytes

Contents

# frozen_string_literal: true

module Coverband
  class AtExit
    @semaphore = Mutex.new

    @at_exit_registered = nil
    def self.register
      return if ENV["COVERBAND_DISABLE_AT_EXIT"]
      return if @at_exit_registered

      @semaphore.synchronize do
        return if @at_exit_registered

        @at_exit_registered = true
        at_exit do
          ::Coverband::Background.stop

          if !Coverband.configuration.report_on_exit
            # skip reporting
          else
            Coverband.report_coverage
            # to ensure we track mailer views we now need to report views tracking
            # at exit as well for rake tasks and background tasks that can trigger email
            Coverband.configuration.view_tracker&.report_views_tracked
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
coverband-5.2.3.2 lib/coverband/at_exit.rb
coverband-5.2.3.1 lib/coverband/at_exit.rb
coverband-5.2.6.rc.1 lib/coverband/at_exit.rb
coverband-5.2.5 lib/coverband/at_exit.rb
coverband-5.2.5.rc.3 lib/coverband/at_exit.rb
coverband-5.2.5.rc.2 lib/coverband/at_exit.rb
coverband-5.2.5.rc.1 lib/coverband/at_exit.rb
coverband-5.2.4 lib/coverband/at_exit.rb
coverband-5.2.3 lib/coverband/at_exit.rb
coverband-5.2.2 lib/coverband/at_exit.rb
coverband-5.2.1 lib/coverband/at_exit.rb
coverband-5.2.1.rc.1 lib/coverband/at_exit.rb
coverband-5.2.0 lib/coverband/at_exit.rb
coverband-5.2.0.rc.2 lib/coverband/at_exit.rb
coverband-5.2.0.rc.1 lib/coverband/at_exit.rb
coverband-5.1.1 lib/coverband/at_exit.rb
coverband-5.1.0 lib/coverband/at_exit.rb
coverband-5.1.0.rcmailer.2 lib/coverband/at_exit.rb