#778: remove unnecessary code

This commit is contained in:
Vokhmin Alexey V 2012-12-17 16:29:57 +04:00
parent 8757724acc
commit eaa2659abd
3 changed files with 0 additions and 70 deletions

View File

@ -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

View File

@ -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

View File

@ -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