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

52 lines
1.1 KiB
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
2019-03-02 22:35:43 +05:30
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-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: