pages_worker.rb 611 Bytes
Newer Older
Kamil Trzcinski's avatar
Kamil Trzcinski committed
1 2 3
class PagesWorker
  include Sidekiq::Worker

4
  sidekiq_options queue: :pages, retry: false
Kamil Trzcinski's avatar
Kamil Trzcinski committed
5

6 7 8 9 10
  def perform(action, *arg)
    send(action, *arg)
  end

  def deploy(build_id)
11
    build = Ci::Build.find_by(id: build_id)
12 13 14 15 16
    result = Projects::UpdatePagesService.new(build.project, build).execute
    if result[:status] == :success
      result = Projects::UpdatePagesConfigurationService.new(build.project).execute
    end
    result
Kamil Trzcinski's avatar
Kamil Trzcinski committed
17
  end
Kamil Trzcinski's avatar
Kamil Trzcinski committed
18

19 20 21 22
  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
Kamil Trzcinski's avatar
Kamil Trzcinski committed
23
end