gitlab-org--gitlab-foss/lib/gitlab/import_export/importer.rb

31 lines
602 B
Ruby
Raw Normal View History

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
def initialize(archive_file: , shared:)
2016-04-15 16:14:28 +00:00
@archive_file = archive_file
@shared = shared
2016-04-15 16:14:28 +00:00
end
def import
FileUtils.mkdir_p(@shared.storage_path)
decompress_archive
rescue => e
@shared.error(e.message)
false
2016-04-15 16:14:28 +00:00
end
private
def decompress_archive
untar_zxf(archive: @archive_file, dir: @shared.storage_path)
2016-04-15 16:14:28 +00:00
end
end
end
end