2016-04-14 10:57:25 -04:00
|
|
|
module Gitlab
|
2016-03-07 12:26:15 -05:00
|
|
|
module ImportExport
|
|
|
|
extend self
|
|
|
|
|
2016-09-07 11:08:19 -04:00
|
|
|
# For every version update, the version history in import_export.md has to be kept up to date.
|
2016-08-30 04:09:41 -04:00
|
|
|
VERSION = '0.1.4'
|
2016-07-15 06:47:06 -04:00
|
|
|
FILENAME_LIMIT = 50
|
2016-05-16 06:04:31 -04:00
|
|
|
|
2016-03-08 09:53:32 -05:00
|
|
|
def export_path(relative_path:)
|
2016-04-22 06:18:11 -04:00
|
|
|
File.join(storage_path, relative_path)
|
2016-03-07 12:26:15 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def storage_path
|
|
|
|
File.join(Settings.shared['path'], 'tmp/project_exports')
|
|
|
|
end
|
2016-05-13 11:39:03 -04:00
|
|
|
|
2016-08-02 05:32:28 -04:00
|
|
|
def import_upload_path(filename:)
|
|
|
|
File.join(storage_path, 'uploads', filename)
|
|
|
|
end
|
|
|
|
|
2016-05-13 11:39:03 -04:00
|
|
|
def project_filename
|
|
|
|
"project.json"
|
|
|
|
end
|
|
|
|
|
|
|
|
def project_bundle_filename
|
|
|
|
"project.bundle"
|
|
|
|
end
|
2016-05-16 06:04:31 -04:00
|
|
|
|
2016-06-13 03:37:58 -04:00
|
|
|
def config_file
|
2016-06-20 03:17:07 -04:00
|
|
|
Rails.root.join('lib/gitlab/import_export/import_export.yml')
|
2016-06-13 03:37:58 -04:00
|
|
|
end
|
|
|
|
|
2016-05-16 06:04:31 -04:00
|
|
|
def version_filename
|
|
|
|
'VERSION'
|
|
|
|
end
|
2016-05-16 07:28:11 -04:00
|
|
|
|
2016-07-15 06:47:06 -04:00
|
|
|
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-05-16 07:28:11 -04:00
|
|
|
def version
|
|
|
|
VERSION
|
|
|
|
end
|
2016-05-19 09:36:20 -04:00
|
|
|
|
|
|
|
def reset_tokens?
|
|
|
|
true
|
|
|
|
end
|
2016-03-07 12:26:15 -05:00
|
|
|
end
|
|
|
|
end
|