2016-04-15 16:14:28 +00:00
|
|
|
module Gitlab
|
|
|
|
module ImportExport
|
|
|
|
class Importer
|
|
|
|
include Gitlab::ImportExport::CommandLineUtil
|
|
|
|
|
|
|
|
def self.import(*args)
|
|
|
|
new(*args).import
|
|
|
|
end
|
|
|
|
|
2016-05-11 15:22:45 +00:00
|
|
|
def initialize(archive_file: , shared:)
|
2016-04-15 16:14:28 +00:00
|
|
|
@archive_file = archive_file
|
2016-05-11 15:22:45 +00:00
|
|
|
@shared = shared
|
2016-04-15 16:14:28 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def import
|
2016-05-11 15:22:45 +00:00
|
|
|
FileUtils.mkdir_p(@shared.storage_path)
|
2016-04-22 10:45:20 +00:00
|
|
|
decompress_archive
|
2016-05-11 15:22:45 +00:00
|
|
|
rescue => e
|
|
|
|
@shared.error(e.message)
|
|
|
|
false
|
2016-04-15 16:14:28 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2016-04-22 10:45:20 +00:00
|
|
|
def decompress_archive
|
2016-05-11 15:22:45 +00:00
|
|
|
untar_zxf(archive: @archive_file, dir: @shared.storage_path)
|
2016-04-15 16:14:28 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|