gitlab-org--gitlab-foss/lib/gitlab/import_export/version_saver.rb

39 lines
939 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2016-05-16 06:04:31 -04:00
module Gitlab
module ImportExport
class VersionSaver
include Gitlab::ImportExport::CommandLineUtil
2016-05-16 06:04:31 -04:00
def initialize(shared:)
@shared = shared
end
def save
mkdir_p(@shared.export_path)
2016-05-16 07:28:11 -04:00
2016-06-13 12:24:21 -04: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')
2016-05-16 06:04:31 -04:00
rescue => e
2016-05-16 06:39:42 -04:00
@shared.error(e)
2016-05-16 06:04:31 -04:00
false
end
private
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 06:04:31 -04:00
def version_file
File.join(@shared.export_path, Gitlab::ImportExport.version_filename)
end
end
end
end