Sha256: cec27d699b6020e2cfe8a73c3ad721cc4c726e76c908d43e633ee63c88a18560

Contents?: true

Size: 1.38 KB

Versions: 4

Compression:

Stored size: 1.38 KB

Contents

# frozen_string_literal: true

require 'avm/launcher/git/mirror_update'
require 'avm/launcher/vendor/github'
require 'avm/projects/stereotypes/git/publish'

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

        TARGET_REMOTE = ::Avm::Projects::Stereotypes::Git::Publish::PUBLISH_GIT_REMOTE_NAME

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

        protected

        attr_reader :instance

        def update
          ::Avm::Launcher::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
          ::Avm::Launcher::Git::Base.new(source_instance.real)
        end

        def cache_git_uncached
          ::Avm::Launcher::Git::Base.new(update)
        end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
avm-tools-0.102.0 lib/avm/launcher/git/warp_base.rb
avm-tools-0.101.0 lib/avm/launcher/git/warp_base.rb
avm-tools-0.100.0 lib/avm/launcher/git/warp_base.rb
avm-tools-0.99.1 lib/avm/launcher/git/warp_base.rb