#778: remove unnecessary code
This commit is contained in:
parent
8757724acc
commit
eaa2659abd
|
@ -1,15 +0,0 @@
|
|||
module AbfWorker
|
||||
class FileSystemWorker
|
||||
@queue = :file_system_worker
|
||||
|
||||
def self.perform(options)
|
||||
id, action = options['id'], options['action']
|
||||
case options['type']
|
||||
when 'repository'
|
||||
@runner = AbfWorker::Runners::Repository.new id, action
|
||||
end
|
||||
@runner.run
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,20 +0,0 @@
|
|||
module AbfWorker
|
||||
module Runners
|
||||
class Base
|
||||
|
||||
# @param [String] action The action which should be run (create/destroy)
|
||||
def initialize(action)
|
||||
@action = action
|
||||
end
|
||||
|
||||
def run
|
||||
send @action
|
||||
end
|
||||
|
||||
def mk_dir(path)
|
||||
Dir.mkdir(path) unless File.exists?(path)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,35 +0,0 @@
|
|||
module AbfWorker
|
||||
module Runners
|
||||
class Repository < AbfWorker::Runners::Base
|
||||
|
||||
# @param [String] id The id of repository
|
||||
def initialize(id, action)
|
||||
super action
|
||||
@repository = ::Repository.find id
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def destroy
|
||||
platform = @repository.platform
|
||||
repository_path = platform.path
|
||||
repository_path << '/repository'
|
||||
if platform.personal?
|
||||
::Platform.main.pluck(:name).each do |main_platform_name|
|
||||
destroy_repositories "#{repository_path}/#{main_platform_name}"
|
||||
end
|
||||
else
|
||||
destroy_repositories repository_path
|
||||
end
|
||||
end
|
||||
|
||||
def destroy_repositories(repository_path)
|
||||
::Arch.pluck(:name).each do |arch|
|
||||
system("rm -rf #{repository_path}/#{arch}/#{@repository.name}")
|
||||
end
|
||||
system("rm -rf #{repository_path}/SRPMS/#{@repository.name}")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue