gitlab-org--gitlab-foss/app/workers/pages_worker.rb

29 lines
757 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class PagesWorker
include ApplicationWorker
2018-03-05 07:57:48 -05:00
sidekiq_options retry: 3
2015-12-18 07:07:53 -05:00
def perform(action, *arg)
send(action, *arg) # rubocop:disable GitlabSecurity/PublicSend
2015-12-18 07:07:53 -05:00
end
# rubocop: disable CodeReuse/ActiveRecord
2015-12-18 07:07:53 -05:00
def deploy(build_id)
build = Ci::Build.find_by(id: build_id)
2016-02-09 12:06:55 -05:00
result = Projects::UpdatePagesService.new(build.project, build).execute
if result[:status] == :success
result = Projects::UpdatePagesConfigurationService.new(build.project).execute
end
2016-02-09 12:06:55 -05:00
result
2015-12-16 10:29:53 -05:00
end
# rubocop: enable CodeReuse/ActiveRecord
2015-12-18 07:07:53 -05:00
def remove(namespace_path, project_path)
full_path = File.join(Settings.pages.path, namespace_path, project_path)
FileUtils.rm_r(full_path, force: true)
end
end