gitlab-org--gitlab-foss/lib/gitlab/seeder.rb

52 lines
1.1 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
# :nocov:
module DeliverNever
def deliver_later
self
end
end
module MuteNotifications
def new_note(note)
end
end
2012-11-13 15:11:56 -05:00
module Gitlab
class Seeder
def self.quiet
mute_notifications
mute_mailer
2012-11-13 15:11:56 -05:00
SeedFu.quiet = true
yield
2012-11-13 15:11:56 -05:00
SeedFu.quiet = false
puts "\nOK".color(:green)
2012-11-13 15:11:56 -05:00
end
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
def self.mute_notifications
NotificationService.prepend(MuteNotifications)
end
def self.mute_mailer
ActionMailer::MessageDelivery.prepend(DeliverNever)
end
2012-11-13 15:11:56 -05:00
end
end
# :nocov: