Class: BulkImports::Pipeline::Context
- Inherits:
-
Object
- Object
- BulkImports::Pipeline::Context
- Defined in:
- lib/bulk_imports/pipeline/context.rb
Instance Attribute Summary collapse
-
#extra ⇒ Object
Returns the value of attribute extra.
-
#tracker ⇒ Object
readonly
Returns the value of attribute tracker.
Instance Method Summary collapse
- #bulk_import ⇒ Object
- #bulk_import_id ⇒ Object
- #configuration ⇒ Object
- #current_user ⇒ Object
- #entity ⇒ Object
- #group ⇒ Object
- #import_export_config ⇒ Object
- #importer_user_mapping_enabled? ⇒ Boolean
-
#initialize(tracker, extra = {}) ⇒ Context
constructor
A new instance of Context.
- #portable ⇒ Object
- #source_user_mapper ⇒ Object
Constructor Details
#initialize(tracker, extra = {}) ⇒ Context
Returns a new instance of Context.
10 11 12 13 |
# File 'lib/bulk_imports/pipeline/context.rb', line 10 def initialize(tracker, extra = {}) @tracker = tracker @extra = extra end |
Instance Attribute Details
#extra ⇒ Object
Returns the value of attribute extra.
6 7 8 |
# File 'lib/bulk_imports/pipeline/context.rb', line 6 def extra @extra end |
#tracker ⇒ Object (readonly)
Returns the value of attribute tracker.
8 9 10 |
# File 'lib/bulk_imports/pipeline/context.rb', line 8 def tracker @tracker end |
Instance Method Details
#bulk_import ⇒ Object
31 32 33 |
# File 'lib/bulk_imports/pipeline/context.rb', line 31 def bulk_import @bulk_import ||= entity.bulk_import end |
#bulk_import_id ⇒ Object
35 36 37 |
# File 'lib/bulk_imports/pipeline/context.rb', line 35 def bulk_import_id @bulk_import_id ||= bulk_import.id end |
#configuration ⇒ Object
43 44 45 |
# File 'lib/bulk_imports/pipeline/context.rb', line 43 def configuration @configuration ||= bulk_import.configuration end |
#current_user ⇒ Object
39 40 41 |
# File 'lib/bulk_imports/pipeline/context.rb', line 39 def current_user @current_user ||= bulk_import.user end |
#entity ⇒ Object
15 16 17 |
# File 'lib/bulk_imports/pipeline/context.rb', line 15 def entity @entity ||= tracker.entity end |
#group ⇒ Object
27 28 29 |
# File 'lib/bulk_imports/pipeline/context.rb', line 27 def group @group ||= entity.group end |
#import_export_config ⇒ Object
23 24 25 |
# File 'lib/bulk_imports/pipeline/context.rb', line 23 def import_export_config @import_export_config ||= ::BulkImports::FileTransfer.config_for(portable) end |
#importer_user_mapping_enabled? ⇒ Boolean
55 56 57 |
# File 'lib/bulk_imports/pipeline/context.rb', line 55 def importer_user_mapping_enabled? Import::BulkImports::EphemeralData.new(bulk_import_id).importer_user_mapping_enabled? end |
#portable ⇒ Object
19 20 21 |
# File 'lib/bulk_imports/pipeline/context.rb', line 19 def portable @portable ||= entity.group || entity.project end |
#source_user_mapper ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/bulk_imports/pipeline/context.rb', line 47 def source_user_mapper @source_user_mapper ||= Gitlab::Import::SourceUserMapper.new( namespace: portable.root_ancestor, import_type: Import::SOURCE_DIRECT_TRANSFER, source_hostname: configuration.url ) end |