Class: Gitlab::ImportExport::Group::TreeRestorer
- Inherits:
-
Object
- Object
- Gitlab::ImportExport::Group::TreeRestorer
- Includes:
- Utils::StrongMemoize
- Defined in:
- lib/gitlab/import_export/group/tree_restorer.rb
Instance Attribute Summary collapse
-
#groups_mapping ⇒ Object
readonly
Returns the value of attribute groups_mapping.
-
#shared ⇒ Object
readonly
Returns the value of attribute shared.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(user:, shared:, group:) ⇒ TreeRestorer
constructor
A new instance of TreeRestorer.
- #restore ⇒ Object
Constructor Details
#initialize(user:, shared:, group:) ⇒ TreeRestorer
Returns a new instance of TreeRestorer.
11 12 13 14 15 16 |
# File 'lib/gitlab/import_export/group/tree_restorer.rb', line 11 def initialize(user:, shared:, group:) @user = user @shared = shared @top_level_group = group @groups_mapping = {} end |
Instance Attribute Details
#groups_mapping ⇒ Object (readonly)
Returns the value of attribute groups_mapping.
9 10 11 |
# File 'lib/gitlab/import_export/group/tree_restorer.rb', line 9 def groups_mapping @groups_mapping end |
#shared ⇒ Object (readonly)
Returns the value of attribute shared.
9 10 11 |
# File 'lib/gitlab/import_export/group/tree_restorer.rb', line 9 def shared @shared end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
9 10 11 |
# File 'lib/gitlab/import_export/group/tree_restorer.rb', line 9 def user @user end |
Instance Method Details
#restore ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gitlab/import_export/group/tree_restorer.rb', line 18 def restore group_ids = relation_reader.consume_relation('groups', '_all').map { |value, _idx| Integer(value) } root_group_id = group_ids.delete_at(0) process_root(root_group_id) group_ids.each do |group_id| process_child(group_id) end true rescue StandardError => e shared.error(e) false end |