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
|
2022-06-21 17:19:12 +05:30
|
|
|
include DurationMeasuring
|
2016-11-03 12:29:30 +05:30
|
|
|
|
2016-06-22 15:30:34 +05:30
|
|
|
def initialize(shared:)
|
|
|
|
@shared = shared
|
|
|
|
end
|
|
|
|
|
|
|
|
def save
|
2022-06-21 17:19:12 +05:30
|
|
|
with_duration_measuring do
|
|
|
|
mkdir_p(@shared.export_path)
|
2016-06-22 15:30:34 +05:30
|
|
|
|
2022-06-21 17:19:12 +05:30
|
|
|
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-06-08 01:23:25 +05:30
|
|
|
rescue StandardError => e
|
2016-06-22 15:30:34 +05:30
|
|
|
@shared.error(e)
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2020-03-13 15:44:24 +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
|