Sha256: 78892ed73c4b9b937d67d771a91f68e4238522fa91d676ceb09e3b83f04f11a7

Contents?: true

Size: 797 Bytes

Versions: 1

Compression:

Stored size: 797 Bytes

Contents

module EacLauncher
  module Git
    class MirrorUpdate < ::EacLauncher::Path
      include ::Eac::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.fetch("file://#{@source_git}", tags: true)
      end

      def reset_source_rev
        h = @source_git.rev_parse(@source_rev)
        raise "Hash not found for ref. \"#{@source_rev}\" in \"#{@source_git}\"" unless h
        @target_git.reset_hard(h)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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