Class: BulkImports::Projects::Pipelines::SnippetsRepositoryPipeline
- Inherits:
-
Object
- Object
- BulkImports::Projects::Pipelines::SnippetsRepositoryPipeline
- Includes:
- BulkImports::Pipeline
- Defined in:
- lib/bulk_imports/projects/pipelines/snippets_repository_pipeline.rb
Constant Summary
Constants included from BulkImports::Pipeline
BulkImports::Pipeline::CACHE_KEY_EXPIRATION, BulkImports::Pipeline::EMPTY_EXPORT_STATUS_TIMEOUT, BulkImports::Pipeline::ExpiredError, BulkImports::Pipeline::FailedError, BulkImports::Pipeline::NDJSON_EXPORT_TIMEOUT, BulkImports::Pipeline::NotAllowedError
Constants included from BulkImports::Pipeline::Runner
BulkImports::Pipeline::Runner::MarkedAsFailedError
Instance Method Summary collapse
Methods included from BulkImports::Pipeline
#current_user, #import_export_config, #initialize, #portable, #tracker
Methods included from BulkImports::Pipeline::Runner
Instance Method Details
#load(context, data) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/bulk_imports/projects/pipelines/snippets_repository_pipeline.rb', line 17 def load(context, data) return unless data['httpUrlToRepo'].present? oauth2_url = oauth2(data['httpUrlToRepo']) validate_url(oauth2_url) matched_snippet = find_matched_snippet(data) # Skip snippets that we couldn't find a match. Probably because more snippets were # added after the migration had already started, namely after the SnippetsPipeline # has already run. return unless matched_snippet matched_snippet.create_repository matched_snippet.repository.fetch_as_mirror(oauth2_url) response = Snippets::RepositoryValidationService.new(nil, matched_snippet).execute # skips matched_snippet repository creation if repository is invalid return cleanup_snippet_repository(matched_snippet) if response.error? Snippets::UpdateStatisticsService.new(matched_snippet).execute end |
#transform(_context, data) ⇒ Object
11 12 13 14 15 |
# File 'lib/bulk_imports/projects/pipelines/snippets_repository_pipeline.rb', line 11 def transform(_context, data) data.tap do |d| d['createdAt'] = DateTime.parse(data['createdAt']) end end |