Sha256: 521e02eec597a9a0f649aa7ac50d60bc14bf90ef1a758d3952371e5e11fe98aa

Contents?: true

Size: 1.12 KB

Versions: 6

Compression:

Stored size: 1.12 KB

Contents

require_relative "gem/errors"

module Artifactory
  module GemImport
    class Gem
      attr_reader :name, :version
      attr_reader :source_repo, :target_repo
      attr_reader :cache_dir
      attr_reader :errors

      attr_accessor :foreign_representation

      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

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

      def source_gems_url
        source_repo.gems_url
      end

      def source_headers
        source_repo.headers
      end

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

      def target_gems_url
        target_repo.gems_url
      end

      def target_headers
        target_repo.headers
      end

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
artifactory-gem_import-1.1.0 lib/artifactory/gem_import/gem.rb
artifactory-gem_import-1.0.0 lib/artifactory/gem_import/gem.rb
artifactory-gem_import-0.2.2 lib/artifactory/gem_import/gem.rb
artifactory-gem_import-0.2.0 lib/artifactory/gem_import/gem.rb
artifactory-gem_import-0.1.4 lib/artifactory/gem_import/gem.rb
artifactory-gem_import-0.1.3 lib/artifactory/gem_import/gem.rb