Sha256: cf2c5680ef91b766042106dfe3680627269f28999dc212f717ce2c2eeadd5023

Contents?: true

Size: 818 Bytes

Versions: 1

Compression:

Stored size: 818 Bytes

Contents

require 'eac_launcher/git/base'

module EacLauncher
  module Git
    class MirrorUpdate < ::EacLauncher::Paths::Real
      include ::EacRubyUtils::SimpleCache

      def initialize(target_path, source_path, source_rev)
        super(target_path)
        @target_git = ::EacLauncher::Git::Base.new(self)
        @source_git = ::EacLauncher::Git::Base.new(source_path)
        @source_rev = source_rev
        run
      end

      private

      def run
        fetch_remote_source
        reset_source_rev
      end

      def fetch_remote_source
        @target_git.git
        @target_git.assert_remote_url('origin', @source_git)
        @target_git.fetch('origin', tags: true)
      end

      def reset_source_rev
        @target_git.reset_hard(@source_git.rev_parse(@source_rev, true))
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eac_launcher-0.6.0 lib/eac_launcher/git/mirror_update.rb