class RJGit::RJGitPack
Attributes
bidirectional[RW]
jpack[RW]
jrepo[RW]
Public Class Methods
new(repository, bidirectional = false)
click to toggle source
# File lib/transport.rb, line 13 def initialize(repository, bidirectional = false) @jrepo = RJGit.repository_type(repository) @bidirectional = bidirectional end
Public Instance Methods
advertise_refs()
click to toggle source
# File lib/transport.rb, line 18 def advertise_refs out_stream = ByteArrayOutputStream.new pck_out = PacketLineOut.new(out_stream) advertiser = PacketLineOutRefAdvertiser.new(pck_out) @jpack.sendAdvertisedRefs(advertiser) return out_stream.to_string end
process(client_msg)
click to toggle source
# File lib/transport.rb, line 26 def process(client_msg) input, output = init_buffers(client_msg) @jpack.set_bi_directional_pipe(@bidirectional) begin @jpack.send(@action, input, output, nil) rescue Java::OrgEclipseJgitErrors::InvalidObjectIdException, Java::OrgEclipseJgitTransport::UploadPackInternalServerErrorException, Java::JavaIo::IOException => e return nil, e end return ByteArrayInputStream.new(output.to_byte_array).to_io, nil end
Private Instance Methods
init_buffers(client_msg)
click to toggle source
# File lib/transport.rb, line 39 def init_buffers(client_msg) return ByteArrayInputStream.new(client_msg.to_java_bytes), ByteArrayOutputStream.new end