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

30 lines
778 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 Reader
2018-06-03 19:52:53 +05:30
attr_reader :tree, :attributes_finder
2016-06-22 15:30:34 +05:30
def initialize(shared:)
@shared = shared
2019-12-04 20:38:33 +05:30
@attributes_finder = Gitlab::ImportExport::AttributesFinder.new(
config: ImportExport::Config.new.to_h)
2016-06-22 15:30:34 +05:30
end
# Outputs a hash in the format described here: http://api.rubyonrails.org/classes/ActiveModel/Serializers/JSON.html
# for outputting a project in JSON format, including its relations and sub relations.
def project_tree
2019-12-04 20:38:33 +05:30
attributes_finder.find_root(:project)
2016-06-22 15:30:34 +05:30
rescue => e
@shared.error(e)
false
end
2017-08-17 22:00:37 +05:30
def group_members_tree
2019-12-04 20:38:33 +05:30
attributes_finder.find_root(:group_members)
2016-06-22 15:30:34 +05:30
end
end
end
end