Sha256: 7fce6bae24c0a34ceec4f89724b50a6ac0b8fd29ca17e8a6c8fdfa3cc8da877c

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

require 'eac_launcher/git/mirror_update'
require 'eac_launcher/vendor/github'

module EacLauncher
  module Git
    # Métodos abstratos:
    #  * source_instance
    #  * source_remote_name
    #  * current_ref
    class WarpBase < ::EacLauncher::Paths::Real
      include ::EacRubyUtils::SimpleCache

      TARGET_REMOTE = 'target'

      def initialize(instance)
        @instance = instance
        cache_git.git.reset_hard(current_ref)
        cache_git.assert_remote_url(TARGET_REMOTE, target_remote_url)
        super(path)
      end

      protected

      attr_reader :instance

      def update
        ::EacLauncher::Git::MirrorUpdate.new(
          path,
          source_instance.real,
          source_instance.options.git_current_revision
        )
      end

      def path
        instance.cache_path('git_repository')
      end

      def source_git_uncached
        ::EacLauncher::Git::Base.new(source_instance.real)
      end

      def cache_git_uncached
        ::EacLauncher::Git::Base.new(update)
      end

      def target_remote_url
        ::EacLauncher::Vendor::Github.to_ssh_url(source_git.git.remote(source_remote_name).url)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eac_launcher-0.6.2 lib/eac_launcher/git/warp_base.rb
eac_launcher-0.6.1 lib/eac_launcher/git/warp_base.rb