2018-11-17 00:37:17 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-05-16 10:04:31 +00:00
|
|
|
module Gitlab
|
|
|
|
module ImportExport
|
|
|
|
class VersionSaver
|
2016-09-29 15:17:22 +00:00
|
|
|
include Gitlab::ImportExport::CommandLineUtil
|
2022-04-06 15:08:23 +00:00
|
|
|
include DurationMeasuring
|
2016-09-29 15:17:22 +00:00
|
|
|
|
2016-05-16 10:04:31 +00:00
|
|
|
def initialize(shared:)
|
|
|
|
@shared = shared
|
|
|
|
end
|
|
|
|
|
|
|
|
def save
|
2022-04-06 15:08:23 +00:00
|
|
|
with_duration_measuring do
|
|
|
|
mkdir_p(@shared.export_path)
|
2016-05-16 11:28:11 +00:00
|
|
|
|
2022-04-06 15:08:23 +00:00
|
|
|
File.write(version_file, Gitlab::ImportExport.version, mode: 'w')
|
|
|
|
File.write(gitlab_version_file, Gitlab::VERSION, mode: 'w')
|
|
|
|
File.write(gitlab_revision_file, Gitlab.revision, mode: 'w')
|
|
|
|
end
|
2021-04-26 12:09:44 +00:00
|
|
|
rescue StandardError => e
|
2016-05-16 10:39:42 +00:00
|
|
|
@shared.error(e)
|
2016-05-16 10:04:31 +00:00
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2019-12-24 00:07:31 +00:00
|
|
|
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-05-16 10:04:31 +00:00
|
|
|
def version_file
|
|
|
|
File.join(@shared.export_path, Gitlab::ImportExport.version_filename)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|