Class: RJGit::RJGitPack
- Inherits:
-
Object
- Object
- RJGit::RJGitPack
- Defined in:
- lib/transport.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#bidirectional ⇒ Object
Returns the value of attribute bidirectional.
-
#jpack ⇒ Object
Returns the value of attribute jpack.
-
#jrepo ⇒ Object
Returns the value of attribute jrepo.
Instance Method Summary collapse
- #advertise_refs ⇒ Object
-
#initialize(repository, bidirectional = false) ⇒ RJGitPack
constructor
A new instance of RJGitPack.
- #process(client_msg) ⇒ Object
Constructor Details
#initialize(repository, bidirectional = false) ⇒ RJGitPack
Returns a new instance of RJGitPack.
13 14 15 16 |
# File 'lib/transport.rb', line 13 def initialize(repository, bidirectional = false) @jrepo = RJGit.repository_type(repository) @bidirectional = bidirectional end |
Instance Attribute Details
#bidirectional ⇒ Object
Returns the value of attribute bidirectional.
11 12 13 |
# File 'lib/transport.rb', line 11 def bidirectional @bidirectional end |
#jpack ⇒ Object
Returns the value of attribute jpack.
11 12 13 |
# File 'lib/transport.rb', line 11 def jpack @jpack end |
#jrepo ⇒ Object
Returns the value of attribute jrepo.
11 12 13 |
# File 'lib/transport.rb', line 11 def jrepo @jrepo end |
Instance Method Details
#advertise_refs ⇒ Object
18 19 20 21 22 23 24 |
# 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) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# 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 |