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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
818 B
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
2020-11-24 15:15:51 +05:30
# To make a call happen in a new Sidekiq job, add `.async` before the call. For
# instance:
#
# PagesTransfer.new.async.move_namespace(...)
#
2017-08-17 22:00:37 +05:30
module Gitlab
class PagesTransfer < ProjectTransfer
2021-03-11 19:13:27 +05:30
METHODS = %w[move_namespace move_project rename_project rename_namespace].freeze
2020-11-24 15:15:51 +05:30
2021-03-11 19:13:27 +05:30
class Async
2020-11-24 15:15:51 +05:30
METHODS.each do |meth|
define_method meth do |*args|
2021-04-29 21:17:54 +05:30
next unless Settings.pages.local_store.enabled
2021-03-11 19:13:27 +05:30
2020-11-24 15:15:51 +05:30
PagesTransferWorker.perform_async(meth, args)
end
end
end
2021-03-11 19:13:27 +05:30
METHODS.each do |meth|
define_method meth do |*args|
2021-04-29 21:17:54 +05:30
next unless Settings.pages.local_store.enabled
2021-03-11 19:13:27 +05:30
super(*args)
end
end
2020-11-24 15:15:51 +05:30
def async
@async ||= Async.new
end
2017-08-17 22:00:37 +05:30
def root_dir
Gitlab.config.pages.path
end
end
end