rjgit 4.0.1.0 → 4.0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a465cfeece5013f22dc111804a3e9bc4dc4fb667
4
- data.tar.gz: 8e6d8bcffd10eac722c5c61f5808fd10cf2091a1
3
+ metadata.gz: 0ca68263a40b689b818e249bd15a957dcb48d587
4
+ data.tar.gz: cef170d6a7fb2826a599b48268bf7274925427d8
5
5
  SHA512:
6
- metadata.gz: 0eb0dca93ef3c5e84bc5af9a4b26d25e3b81fccd5731411dc6efaccfdb8604b5d0c2f02306a6915dc8e87d2d48870d81d1d0346863b8bde0e435c7180dd1877b
7
- data.tar.gz: 034259f6a049f41353dfdc1bb378de8bb1664661a2160f8c234136112e87217fefb4171b8fa287e5dca1b70977a66691a82435b98c6327b66c65225e7d51959b
6
+ metadata.gz: 530f3585843ea4ec1db17d5094c8c4da3ba1096f89a76689773a2c0e36efb440b91b031666a9e4d0ddbb814d07195a5b32ede60101b251d66c839b8902e096f7
7
+ data.tar.gz: 68fe649430f200759180d48a3a7146d89476f428c6bde23f9bff2d22d696986e121c7d21fa97e3f671f5301c920fd2cacbbd0ab6a60af16e3e09f6217689b758
data/README.md CHANGED
@@ -38,6 +38,10 @@ $ gem install rjgit
38
38
  - rspec >= 2.0
39
39
  - simplecov
40
40
 
41
+ #### Version scheme
42
+
43
+ RJGit's version number is the version of jgit used, plus our own patch level counter. For instance, RJGit 4.0.1.0 uses jgit 4.0.1, patch level 0.
44
+
41
45
  Usage
42
46
  -----
43
47
  RJGit wraps most (if not all) of JGit's core functionality; it has classes for all important Git objects, i.e., Repo, Blob, Tree, Commit, and Tag. It allows parsing and manipulation of these objects in an intuitive manner, either simulating ordinary git usage (with a working directory on disk) or on a lower level, through creating new git objects manually (also works with 'bare' repositories, without a working directory).
data/lib/blob.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  module RJGit
2
2
 
3
3
  import 'org.eclipse.jgit.revwalk.RevBlob'
4
+ import 'org.eclipse.jgit.diff.RawText'
4
5
 
5
6
  class Blob
6
7
 
@@ -41,6 +42,14 @@ module RJGit
41
42
  @mode == SYMLINK_TYPE
42
43
  end
43
44
 
45
+ def binary?
46
+ RawText.is_binary(self.data.to_java_bytes)
47
+ end
48
+
49
+ def line_count
50
+ self.binary? ? 0 : self.data.split("\n").size
51
+ end
52
+
44
53
  # The mime type of this file (based on the filename)
45
54
  # Returns String
46
55
  def mime_type
data/lib/transport.rb CHANGED
@@ -14,10 +14,6 @@ module RJGit
14
14
  @jrepo = RJGit.repository_type(repository)
15
15
  @bidirectional = bidirectional
16
16
  end
17
-
18
- def init_buffers(client_msg)
19
- return ByteArrayInputStream.new(client_msg.to_java_bytes), ByteArrayOutputStream.new
20
- end
21
17
 
22
18
  def advertise_refs
23
19
  out_stream = ByteArrayOutputStream.new
@@ -26,6 +22,24 @@ module RJGit
26
22
  @jpack.sendAdvertisedRefs(advertiser)
27
23
  return out_stream.to_string
28
24
  end
25
+
26
+ def process(client_msg)
27
+ input, output = init_buffers(client_msg)
28
+ @jpack.set_bi_directional_pipe(@bidirectional)
29
+ begin
30
+ @jpack.send(@action, input, output, nil)
31
+ rescue Java::OrgEclipseJgitErrors::InvalidObjectIdException, Java::OrgEclipseJgitTransport::UploadPackInternalServerErrorException, Java::JavaIo::IOException => e
32
+ return nil, e
33
+ end
34
+ return ByteArrayInputStream.new(output.to_byte_array).to_io, nil
35
+ end
36
+
37
+ private
38
+
39
+ def init_buffers(client_msg)
40
+ return ByteArrayInputStream.new(client_msg.to_java_bytes), ByteArrayOutputStream.new
41
+ end
42
+
29
43
  end
30
44
 
31
45
  class RJGitReceivePack < RJGitPack
@@ -33,45 +47,17 @@ module RJGit
33
47
  def initialize(repository, bidirectional = false)
34
48
  super
35
49
  @jpack = ReceivePack.new(@jrepo)
50
+ @action = :receive
36
51
  end
37
52
 
38
- def process(client_msg)
39
- self.receive(client_msg)
40
- end
41
-
42
- def receive(client_msg)
43
- in_stream, out_stream = init_buffers(client_msg)
44
- @jpack.set_bi_directional_pipe(@bidirectional)
45
- begin
46
- @jpack.receive(in_stream, out_stream, nil)
47
- rescue Java::OrgEclipseJgitErrors::InvalidObjectIdException, Java::JavaIo::IOException => e
48
- return nil, e
49
- end
50
- return ByteArrayInputStream.new(out_stream.to_byte_array).to_io, nil
51
53
  end
52
-
53
- end
54
54
 
55
55
  class RJGitUploadPack < RJGitPack
56
56
 
57
57
  def initialize(repository, bidirectional = false)
58
58
  super
59
59
  @jpack = UploadPack.new(@jrepo)
60
- end
61
-
62
- def process(client_msg)
63
- self.upload(client_msg)
64
- end
65
-
66
- def upload(client_msg)
67
- in_stream, out_stream = init_buffers(client_msg)
68
- @jpack.set_bi_directional_pipe(@bidirectional)
69
- begin
70
- @jpack.upload(in_stream, out_stream, nil)
71
- rescue Java::OrgEclipseJgitErrors::InvalidObjectIdException, Java::OrgEclipseJgitTransport::UploadPackInternalServerErrorException, Java::JavaIo::IOException => e
72
- return nil, e
73
- end
74
- return ByteArrayInputStream.new(out_stream.to_byte_array).to_io, nil
60
+ @action = :upload
75
61
  end
76
62
 
77
63
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RJGit
2
- VERSION = "4.0.1.0"
2
+ VERSION = "4.0.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rjgit
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1.0
4
+ version: 4.0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maarten Engelen
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2015-07-26 00:00:00.000000000 Z
15
+ date: 2015-09-25 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: mime-types
@@ -45,7 +45,7 @@ files:
45
45
  - lib/constants.rb
46
46
  - lib/git.rb
47
47
  - lib/java/jars/jsch-0.1.49.jar
48
- - lib/java/jars/org.eclipse.jgit-4.0.1.201506240215-r.jar
48
+ - lib/java/jars/org.eclipse.jgit-4.0.3.201509231615-r.jar
49
49
  - lib/java/jars/slf4j-api-1.7.2.jar
50
50
  - lib/java/jars/slf4j-simple-1.7.12.jar
51
51
  - lib/repo.rb