debian-mirror-gitlab/lib/gitlab/seeder.rb

39 lines
563 B
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
# :nocov:
2017-08-17 22:00:37 +05:30
module DeliverNever
def deliver_later
self
end
end
2018-03-17 18:26:18 +05:30
module MuteNotifications
def new_note(note)
end
end
2014-09-02 18:07:02 +05:30
module Gitlab
class Seeder
def self.quiet
2018-03-17 18:26:18 +05:30
mute_notifications
2014-09-02 18:07:02 +05:30
mute_mailer
2018-03-17 18:26:18 +05:30
2014-09-02 18:07:02 +05:30
SeedFu.quiet = true
2017-08-17 22:00:37 +05:30
2014-09-02 18:07:02 +05:30
yield
2017-08-17 22:00:37 +05:30
2014-09-02 18:07:02 +05:30
SeedFu.quiet = false
puts "\nOK".color(:green)
2014-09-02 18:07:02 +05:30
end
2018-03-17 18:26:18 +05:30
def self.mute_notifications
NotificationService.prepend(MuteNotifications)
end
2014-09-02 18:07:02 +05:30
def self.mute_mailer
2017-08-17 22:00:37 +05:30
ActionMailer::MessageDelivery.prepend(DeliverNever)
2014-09-02 18:07:02 +05:30
end
end
end
2018-03-17 18:26:18 +05:30
# :nocov: