debian-mirror-gitlab/lib/gitlab/import_export.rb

64 lines
1.2 KiB
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
2016-06-22 15:30:34 +05:30
module Gitlab
module ImportExport
extend self
2019-10-12 21:52:04 +05:30
# For every version update the version history in these docs must be kept up to date:
# - development/import_export.md
# - user/project/settings/import_export.md
2018-11-08 19:23:39 +05:30
VERSION = '0.2.4'.freeze
2016-08-24 12:49:21 +05:30
FILENAME_LIMIT = 50
2016-06-22 15:30:34 +05:30
def export_path(relative_path:)
File.join(storage_path, relative_path)
end
def storage_path
File.join(Settings.shared['path'], 'tmp/project_exports')
end
2016-08-24 12:49:21 +05:30
def import_upload_path(filename:)
File.join(storage_path, 'uploads', filename)
end
2016-06-22 15:30:34 +05:30
def project_filename
"project.json"
end
def project_bundle_filename
"project.bundle"
end
2019-10-12 21:52:04 +05:30
def lfs_objects_filename
"lfs-objects.json"
end
def lfs_objects_storage
"lfs-objects"
end
2016-06-22 15:30:34 +05:30
def config_file
Rails.root.join('lib/gitlab/import_export/import_export.yml')
end
def version_filename
'VERSION'
end
2016-08-24 12:49:21 +05:30
def export_filename(project:)
2017-08-17 22:00:37 +05:30
basename = "#{Time.now.strftime('%Y-%m-%d_%H-%M-%3N')}_#{project.full_path.tr('/', '_')}"
2016-08-24 12:49:21 +05:30
"#{basename[0..FILENAME_LIMIT]}_export.tar.gz"
end
2016-06-22 15:30:34 +05:30
def version
VERSION
end
def reset_tokens?
true
end
end
end