debian-mirror-gitlab/lib/gitlab/import_export/version_saver.rb

39 lines
953 B
Ruby
Raw Normal View History

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-13 15:44:24 +05:30
File.write(gitlab_version_file, Gitlab::VERSION, mode: 'w')
File.write(gitlab_revision_file, Gitlab.revision, mode: 'w')
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