diff options
author | James Lopez <james@jameslopez.es> | 2016-07-15 13:47:06 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-07-15 13:55:28 +0300 |
commit | 65549a5866da6ceaf7ee4052736077879b5e641d (patch) | |
tree | 9aea20cd1061f8762d50d169a22084a5c1ef3348 /lib | |
parent | 86f83db2b0ebc6d4cf546a71e151bb8552215a3a (diff) |
add project name and namespace to filename on project export
added changelog
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/import_export.rb | 7 | ||||
-rw-r--r-- | lib/gitlab/import_export/saver.rb | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/gitlab/import_export.rb b/lib/gitlab/import_export.rb index 588647e5adb..bab2ea73c4f 100644 --- a/lib/gitlab/import_export.rb +++ b/lib/gitlab/import_export.rb @@ -3,6 +3,7 @@ module Gitlab extend self VERSION = '0.1.1' + FILENAME_LIMIT = 50 def export_path(relative_path:) File.join(storage_path, relative_path) @@ -28,6 +29,12 @@ module Gitlab 'VERSION' end + 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 + def version VERSION end diff --git a/lib/gitlab/import_export/saver.rb b/lib/gitlab/import_export/saver.rb index 6a60b65071f..6130c124dd1 100644 --- a/lib/gitlab/import_export/saver.rb +++ b/lib/gitlab/import_export/saver.rb @@ -7,7 +7,8 @@ module Gitlab new(*args).save end - def initialize(shared:) + def initialize(project:, shared:) + @project = project @shared = shared end @@ -36,7 +37,7 @@ module Gitlab end def archive_file - @archive_file ||= File.join(@shared.export_path, '..', "#{Time.now.strftime('%Y-%m-%d_%H-%M-%3N')}_project_export.tar.gz") + @archive_file ||= File.join(@shared.export_path, '..', Gitlab::ImportExport.export_filename(project: @project)) end end end |