2016-06-22 15:30:34 +05:30
|
|
|
module Gitlab
|
|
|
|
module ImportExport
|
|
|
|
extend self
|
|
|
|
|
2016-08-24 12:49:21 +05:30
|
|
|
VERSION = '0.1.3'
|
|
|
|
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
|
|
|
|
|
|
|
|
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:)
|
|
|
|
basename = "#{Time.now.strftime('%Y-%m-%d_%H-%M-%3N')}_#{project.namespace.path}_#{project.path}"
|
|
|
|
|
|
|
|
"#{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
|