2018-10-22 03:00:50 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-10 19:09:14 -04:00
|
|
|
# :nocov:
|
2017-03-02 18:18:50 -05:00
|
|
|
module DeliverNever
|
|
|
|
def deliver_later
|
|
|
|
self
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-01-26 18:25:05 -05:00
|
|
|
module MuteNotifications
|
|
|
|
def new_note(note)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-11-13 15:11:56 -05:00
|
|
|
module Gitlab
|
|
|
|
class Seeder
|
|
|
|
def self.quiet
|
2018-01-26 18:25:05 -05:00
|
|
|
mute_notifications
|
2017-12-27 08:41:28 -05:00
|
|
|
mute_mailer
|
2017-12-01 15:01:15 -05:00
|
|
|
|
2012-11-13 15:11:56 -05:00
|
|
|
SeedFu.quiet = true
|
2017-03-02 18:18:50 -05:00
|
|
|
|
2014-11-10 09:17:04 -05:00
|
|
|
yield
|
2017-03-02 18:18:50 -05:00
|
|
|
|
2012-11-13 15:11:56 -05:00
|
|
|
SeedFu.quiet = false
|
2016-06-01 18:37:15 -04:00
|
|
|
puts "\nOK".color(:green)
|
2012-11-13 15:11:56 -05:00
|
|
|
end
|
2014-03-15 05:39:35 -04:00
|
|
|
|
2019-01-07 16:05:35 -05:00
|
|
|
def self.without_gitaly_timeout
|
|
|
|
# Remove Gitaly timeout
|
|
|
|
old_timeout = Gitlab::CurrentSettings.current_application_settings.gitaly_timeout_default
|
|
|
|
Gitlab::CurrentSettings.current_application_settings.update_columns(gitaly_timeout_default: 0)
|
|
|
|
# Otherwise we still see the default value when running seed_fu
|
|
|
|
ApplicationSetting.expire
|
|
|
|
|
|
|
|
yield
|
|
|
|
ensure
|
|
|
|
Gitlab::CurrentSettings.current_application_settings.update_columns(gitaly_timeout_default: old_timeout)
|
|
|
|
ApplicationSetting.expire
|
|
|
|
end
|
|
|
|
|
2018-01-26 18:25:05 -05:00
|
|
|
def self.mute_notifications
|
|
|
|
NotificationService.prepend(MuteNotifications)
|
|
|
|
end
|
|
|
|
|
2014-03-15 05:39:35 -04:00
|
|
|
def self.mute_mailer
|
2017-03-02 18:18:50 -05:00
|
|
|
ActionMailer::MessageDelivery.prepend(DeliverNever)
|
2014-03-15 05:39:35 -04:00
|
|
|
end
|
2012-11-13 15:11:56 -05:00
|
|
|
end
|
|
|
|
end
|
2017-08-10 19:09:14 -04:00
|
|
|
# :nocov:
|