2016-04-14 14:57:25 +00:00
|
|
|
module Gitlab
|
2016-03-07 17:26:15 +00:00
|
|
|
module ImportExport
|
|
|
|
extend self
|
|
|
|
|
2016-09-07 15:08:19 +00:00
|
|
|
# For every version update, the version history in import_export.md has to be kept up to date.
|
2017-01-24 11:06:09 +00:00
|
|
|
VERSION = '0.1.6'
|
2016-07-15 10:47:06 +00:00
|
|
|
FILENAME_LIMIT = 50
|
2016-05-16 10:04:31 +00:00
|
|
|
|
2016-03-08 14:53:32 +00:00
|
|
|
def export_path(relative_path:)
|
2016-04-22 10:18:11 +00:00
|
|
|
File.join(storage_path, relative_path)
|
2016-03-07 17:26:15 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def storage_path
|
|
|
|
File.join(Settings.shared['path'], 'tmp/project_exports')
|
|
|
|
end
|
2016-05-13 15:39:03 +00:00
|
|
|
|
2016-08-02 09:32:28 +00:00
|
|
|
def import_upload_path(filename:)
|
|
|
|
File.join(storage_path, 'uploads', filename)
|
|
|
|
end
|
|
|
|
|
2016-05-13 15:39:03 +00:00
|
|
|
def project_filename
|
|
|
|
"project.json"
|
|
|
|
end
|
|
|
|
|
|
|
|
def project_bundle_filename
|
|
|
|
"project.bundle"
|
|
|
|
end
|
2016-05-16 10:04:31 +00:00
|
|
|
|
2016-06-13 07:37:58 +00:00
|
|
|
def config_file
|
2016-06-20 07:17:07 +00:00
|
|
|
Rails.root.join('lib/gitlab/import_export/import_export.yml')
|
2016-06-13 07:37:58 +00:00
|
|
|
end
|
|
|
|
|
2016-05-16 10:04:31 +00:00
|
|
|
def version_filename
|
|
|
|
'VERSION'
|
|
|
|
end
|
2016-05-16 11:28:11 +00:00
|
|
|
|
2016-07-15 10:47:06 +00:00
|
|
|
def export_filename(project:)
|
2017-02-14 14:03:24 +00:00
|
|
|
basename = "#{Time.now.strftime('%Y-%m-%d_%H-%M-%3N')}_#{project.namespace.full_path}_#{project.path}"
|
2016-07-15 10:47:06 +00:00
|
|
|
|
|
|
|
"#{basename[0..FILENAME_LIMIT]}_export.tar.gz"
|
|
|
|
end
|
|
|
|
|
2016-05-16 11:28:11 +00:00
|
|
|
def version
|
|
|
|
VERSION
|
|
|
|
end
|
2016-05-19 13:36:20 +00:00
|
|
|
|
|
|
|
def reset_tokens?
|
|
|
|
true
|
|
|
|
end
|
2016-03-07 17:26:15 +00:00
|
|
|
end
|
|
|
|
end
|