Class: Artifactory::GemImport::Worker::Importer

Inherits:
Base
  • Object
show all
Defined in:
lib/artifactory/gem_import/worker/importer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source_repo:, target_repo:, only: /.+/, force: false) ⇒ Importer

Returns a new instance of Importer.



10
11
12
13
14
15
# File 'lib/artifactory/gem_import/worker/importer.rb', line 10

def initialize(source_repo:, target_repo:, only: /.+/, force: false)
  @source_repo = source_repo
  @target_repo = target_repo
  @only        = only
  @force       = force
end

Instance Attribute Details

#forceObject (readonly)

Returns the value of attribute force.



8
9
10
# File 'lib/artifactory/gem_import/worker/importer.rb', line 8

def force
  @force
end

#onlyObject (readonly)

Returns the value of attribute only.



8
9
10
# File 'lib/artifactory/gem_import/worker/importer.rb', line 8

def only
  @only
end

#source_repoObject (readonly)

Returns the value of attribute source_repo.



8
9
10
# File 'lib/artifactory/gem_import/worker/importer.rb', line 8

def source_repo
  @source_repo
end

#target_repoObject (readonly)

Returns the value of attribute target_repo.



8
9
10
# File 'lib/artifactory/gem_import/worker/importer.rb', line 8

def target_repo
  @target_repo
end

Instance Method Details

#import!Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/artifactory/gem_import/worker/importer.rb', line 17

def import!
  output_counts

  missing_gems
    .map { |spec| Gem.new spec: spec, source_repo: source_repo, target_repo: target_repo, cache_dir: tmp_dir }
    .each { |gem| process gem }

  summary
ensure
  remove_tmp_dir!
end