Sha256: cc1e61ddaf958c5073c2ed2ff71d0dbb126598ac9f4166dbc66c7a22be84cc55

Contents?: true

Size: 821 Bytes

Versions: 6

Compression:

Stored size: 821 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.git
        @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

6 entries across 6 versions & 1 rubygems

Version Path
eac_launcher-0.1.6 lib/eac_launcher/git/mirror_update.rb
eac_launcher-0.1.5 lib/eac_launcher/git/mirror_update.rb
eac_launcher-0.1.3 lib/eac_launcher/git/mirror_update.rb
eac_launcher-0.1.4 lib/eac_launcher/git/mirror_update.rb
eac_launcher-0.1.2 lib/eac_launcher/git/mirror_update.rb
eac_launcher-0.1.1 lib/eac_launcher/git/mirror_update.rb