Class: Artifactory::GemImport::Gem

Inherits:
Object
  • Object
show all
Defined in:
lib/artifactory/gem_import/gem.rb,
lib/artifactory/gem_import/gem/errors.rb

Defined Under Namespace

Classes: Errors

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec:, source_repo:, target_repo:, cache_dir:) ⇒ Gem

Returns a new instance of Gem.



13
14
15
16
17
18
19
# File 'lib/artifactory/gem_import/gem.rb', line 13

def initialize(spec:, source_repo:, target_repo:, cache_dir:)
  @name, @version, _lang = spec
  @cache_dir = cache_dir
  @source_repo = source_repo
  @target_repo = target_repo
  @errors = Errors.new
end

Instance Attribute Details

#cache_dirObject (readonly)

Returns the value of attribute cache_dir.



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

def cache_dir
  @cache_dir
end

#errorsObject (readonly)

Returns the value of attribute errors.



9
10
11
# File 'lib/artifactory/gem_import/gem.rb', line 9

def errors
  @errors
end

#foreign_representationObject

Returns the value of attribute foreign_representation.



11
12
13
# File 'lib/artifactory/gem_import/gem.rb', line 11

def foreign_representation
  @foreign_representation
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/artifactory/gem_import/gem.rb', line 6

def name
  @name
end

#source_repoObject (readonly)

Returns the value of attribute source_repo.



7
8
9
# File 'lib/artifactory/gem_import/gem.rb', line 7

def source_repo
  @source_repo
end

#target_repoObject (readonly)

Returns the value of attribute target_repo.



7
8
9
# File 'lib/artifactory/gem_import/gem.rb', line 7

def target_repo
  @target_repo
end

#versionObject (readonly)

Returns the value of attribute version.



6
7
8
# File 'lib/artifactory/gem_import/gem.rb', line 6

def version
  @version
end

Instance Method Details

#cache_pathObject



45
46
47
# File 'lib/artifactory/gem_import/gem.rb', line 45

def cache_path
  @cache_path ||= File.join(cache_dir, filename)
end

#filenameObject



49
50
51
# File 'lib/artifactory/gem_import/gem.rb', line 49

def filename
  @filename ||= "#{name}-#{version}.gem"
end

#source_gems_urlObject



25
26
27
# File 'lib/artifactory/gem_import/gem.rb', line 25

def source_gems_url
  source_repo.gems_url
end

#source_headersObject



29
30
31
# File 'lib/artifactory/gem_import/gem.rb', line 29

def source_headers
  source_repo.headers
end

#source_urlObject



21
22
23
# File 'lib/artifactory/gem_import/gem.rb', line 21

def source_url
  @source_url ||= File.join(source_repo.gems_url, filename)
end

#target_gems_urlObject



37
38
39
# File 'lib/artifactory/gem_import/gem.rb', line 37

def target_gems_url
  target_repo.gems_url
end

#target_headersObject



41
42
43
# File 'lib/artifactory/gem_import/gem.rb', line 41

def target_headers
  target_repo.headers
end

#target_urlObject



33
34
35
# File 'lib/artifactory/gem_import/gem.rb', line 33

def target_url
  @target_url ||= File.join(target_repo.gems_url, filename)
end