Class: Gitlab::GithubImport::SequentialImporter
- Inherits:
-
Object
- Object
- Gitlab::GithubImport::SequentialImporter
- Defined in:
- lib/gitlab/github_import/sequential_importer.rb
Overview
The SequentialImporter imports a GitHub project in a single thread, without using Sidekiq. This makes it useful for testing purposes as well as Rake tasks, but it should be avoided for anything else in favour of the parallel importer.
Constant Summary collapse
- SEQUENTIAL_IMPORTERS =
[ Importer::LabelsImporter, Importer::MilestonesImporter, Importer::ReleasesImporter ].freeze
- PARALLEL_IMPORTERS =
[ Importer::PullRequestsImporter, Importer::IssuesImporter, Importer::DiffNotesImporter, Importer::NotesImporter, Importer::LfsObjectsImporter ].freeze
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project, token: nil) ⇒ SequentialImporter
constructor
project - The project to import the data into.
Constructor Details
#initialize(project, token: nil) ⇒ SequentialImporter
project - The project to import the data into. token - The token to use for the GitHub API.
28 29 30 31 32 |
# File 'lib/gitlab/github_import/sequential_importer.rb', line 28 def initialize(project, token: nil) @project = project @client = GithubImport .new_client_for(project, token: token, parallel: false) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client
10 11 12 |
# File 'lib/gitlab/github_import/sequential_importer.rb', line 10 def client @client end |
#project ⇒ Object (readonly)
Returns the value of attribute project
10 11 12 |
# File 'lib/gitlab/github_import/sequential_importer.rb', line 10 def project @project end |
Instance Method Details
#execute ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/gitlab/github_import/sequential_importer.rb', line 34 def execute Importer::RepositoryImporter.new(project, client).execute SEQUENTIAL_IMPORTERS.each do |klass| klass.new(project, client).execute end PARALLEL_IMPORTERS.each do |klass| klass.new(project, client, parallel: false).execute end true end |