2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-22 15:30:34 +05:30
|
|
|
module Gitlab
|
|
|
|
module ImportExport
|
|
|
|
class VersionSaver
|
2016-11-03 12:29:30 +05:30
|
|
|
include Gitlab::ImportExport::CommandLineUtil
|
|
|
|
|
2016-06-22 15:30:34 +05:30
|
|
|
def initialize(shared:)
|
|
|
|
@shared = shared
|
|
|
|
end
|
|
|
|
|
|
|
|
def save
|
2016-11-03 12:29:30 +05:30
|
|
|
mkdir_p(@shared.export_path)
|
2016-06-22 15:30:34 +05:30
|
|
|
|
|
|
|
File.write(version_file, Gitlab::ImportExport.version, mode: 'w')
|
2020-03-09 13:42:32 +05:30
|
|
|
File.write(gitlab_version_file, Gitlab::VERSION, mode: 'w')
|
|
|
|
File.write(gitlab_revision_file, Gitlab.revision, mode: 'w')
|
2016-06-22 15:30:34 +05:30
|
|
|
rescue => e
|
|
|
|
@shared.error(e)
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
def gitlab_version_file
|
|
|
|
File.join(@shared.export_path, Gitlab::ImportExport.gitlab_version_filename)
|
|
|
|
end
|
|
|
|
|
|
|
|
def gitlab_revision_file
|
|
|
|
File.join(@shared.export_path, Gitlab::ImportExport.gitlab_revision_filename)
|
|
|
|
end
|
|
|
|
|
2016-06-22 15:30:34 +05:30
|
|
|
def version_file
|
|
|
|
File.join(@shared.export_path, Gitlab::ImportExport.version_filename)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|