FIX: Backup script with custom filename needs to include version number.

This commit is contained in:
Guo Xiang Tan 2016-08-08 09:33:50 +08:00
parent 72b321b7b4
commit 02d63d5bc6

View file

@ -41,6 +41,9 @@ class DiscourseCLI < Thor
backup = backuper.run
if filename.present?
puts "Moving '#{backup}' to '#{filename}'"
puts "Including version number into '#{filename}'"
version_string = File.basename(backup)[/-#{BackupRestore::VERSION_PREFIX}\d{14}/]
filename = filename.dup.insert(filename.index('.'), version_string)
FileUtils.mv(backup, filename)
backup = filename
end