rjgit 5.6.1.0 → 5.9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11fd7309b1391fba839301750f2c1fe51d0b38abbb72a36088c39f729ad0368f
4
- data.tar.gz: e890015d41e4408358b9d000d8d5d94a251a8dfe9a4815f75c22858f607c01b0
3
+ metadata.gz: 5b28d35d4c9ea97c5a4ea28b0a62b7374daea6a7a0fd906cfbefbcb986ac37aa
4
+ data.tar.gz: dceb29a1d1e1d20f93a43c71b08ba02d7f23d1f2c8dd92c43a8bf810594dba19
5
5
  SHA512:
6
- metadata.gz: a8afbaa28cfd0a432c3d0d3ad9aa54e34a9e262bbe924d6554a3b7745abbe3025508015ccd97c8bdadae38a89a87f04ef71eb3c052ba9508129d398dfc9bdec4
7
- data.tar.gz: fc84910f12f9c6b5a768e9b06ef7336363fa5f308192d19493c6f2ae2047f3e7032392305795dff9c1225b372ff903838d843f02b4cab6c7aefa47d49fa56ba2
6
+ metadata.gz: e3ab922915d8f98e59757c853277f96273871c867d3f7eda3e2bec4f3d65fb6ec142fdab92fd9df60df3a7ffb6c010482d98ad2c9ac0b3b511a14cd469a5e2fc
7
+ data.tar.gz: c1ac638be7e459f8ab20364ec89c75e6da40d9fa81cd184c7c28f3aaa898c8953b2c62f7f63b52294d38f488ee932944ac6dd707ae74474c0e5e1d83bfa639c3
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'mime-types', '~> 2.6.2'
3
+ gem 'mime-types', '~> 3.3.1'
4
4
  gem 'rake', '>= 12.3.3'
5
5
 
6
6
  gem 'coveralls', '~> 0.8.23', require: false
data/README.md CHANGED
@@ -6,6 +6,7 @@ RJGit
6
6
  [![Build Status](https://travis-ci.org/repotag/rjgit.png)](https://travis-ci.org/repotag/rjgit)
7
7
  [![Coverage Status](https://coveralls.io/repos/repotag/rjgit/badge.png?branch=master)](https://coveralls.io/r/repotag/rjgit)
8
8
  [![Gem Version](https://badge.fury.io/rb/rjgit.png)](http://badge.fury.io/rb/rjgit)
9
+ [![Cutting Edge Dependency Status](https://dometto-cuttingedge.herokuapp.com/github/repotag/rjgit/svg 'Cutting Edge Dependency Status')](https://dometto-cuttingedge.herokuapp.com/github/repotag/rjgit/info)
9
10
 
10
11
  Summary
11
12
  -------
@@ -2,6 +2,7 @@ module RJGit
2
2
 
3
3
  # PersonIdent in JGit
4
4
  import 'org.eclipse.jgit.lib.PersonIdent'
5
+ import 'java.util.TimeZone'
5
6
 
6
7
  class Actor
7
8
 
@@ -17,10 +18,11 @@ module RJGit
17
18
  return self.new(name, email)
18
19
  end
19
20
 
20
- def initialize(name, email)
21
+ def initialize(name, email, time = nil)
21
22
  @name = name
22
23
  @email = email
23
- @person_ident = PersonIdent.new(name, email)
24
+ @time = time
25
+ @person_ident = @time ? PersonIdent.new(name, email, time.to_java, TimeZone.getTimeZone(time.zone)) : PersonIdent.new(name, email)
24
26
  end
25
27
 
26
28
  # Create an Actor from a string.
@@ -43,7 +45,8 @@ module RJGit
43
45
  # time - The Time the commit was authored or committed.
44
46
  #
45
47
  # Returns a String.
46
- def output(time)
48
+ def output(time = nil)
49
+ time = time || self.time
47
50
  offset = time.utc_offset / 60
48
51
  "%s <%s> %d %+.2d%.2d" % [
49
52
  @name,
@@ -52,6 +55,10 @@ module RJGit
52
55
  offset / 60,
53
56
  offset.abs % 60]
54
57
  end
58
+
59
+ def time
60
+ Time.at(@person_ident.getWhen.getTime/1000)
61
+ end
55
62
 
56
63
  end
57
64
 
@@ -27,12 +27,17 @@ module RJGit
27
27
 
28
28
  module Porcelain
29
29
 
30
+ import 'java.io.IOException'
30
31
  import 'org.eclipse.jgit.lib.Constants'
31
32
  import 'org.eclipse.jgit.api.AddCommand'
32
33
  import 'org.eclipse.jgit.api.CommitCommand'
33
34
  import 'org.eclipse.jgit.api.BlameCommand'
35
+ import 'org.eclipse.jgit.api.errors.RefNotFoundException'
34
36
  import 'org.eclipse.jgit.blame.BlameGenerator'
35
37
  import 'org.eclipse.jgit.blame.BlameResult'
38
+ import 'org.eclipse.jgit.errors.IncorrectObjectTypeException'
39
+ import 'org.eclipse.jgit.errors.InvalidPatternException'
40
+ import 'org.eclipse.jgit.errors.MissingObjectException'
36
41
  import 'org.eclipse.jgit.treewalk.CanonicalTreeParser'
37
42
  import 'org.eclipse.jgit.diff.DiffFormatter'
38
43
 
@@ -163,6 +168,58 @@ module RJGit
163
168
  RJGit.convert_diff_entries(diff_entries)
164
169
  end
165
170
 
171
+ def self.describe(repository, ref, options = {})
172
+ options = {:always => false, :long => false, :tags => false, :match => []}.merge(options)
173
+ repo = RJGit.repository_type(repository)
174
+ git = RubyGit.new(repo).jgit
175
+ command = git.describe.
176
+ set_always(options[:always]).
177
+ set_long(options[:long]).
178
+ set_tags(options[:tags])
179
+ begin
180
+ command = command.set_target(ref)
181
+ rescue IncorrectObjectTypeException, IOException, MissingObjectException, RefNotFoundException
182
+ return nil
183
+ end
184
+ options[:match].each do |match|
185
+ begin
186
+ command = command.set_match(match)
187
+ rescue InvalidPatternException
188
+ return nil
189
+ end
190
+ end
191
+ command.call
192
+ end
193
+
194
+ # options:
195
+ # * ref
196
+ # * path_filter
197
+ # * case_insensitive
198
+ def self.grep(repository, query, options={})
199
+ case_insensitive = options[:case_insensitive]
200
+ repo = RJGit.repository_type(repository)
201
+ walk = RevWalk.new(repo)
202
+ ls_tree_options = {:recursive => true, :path_filter => options[:path_filter]}
203
+
204
+ query = case query
205
+ when Regexp then query
206
+ when String then Regexp.new(Regexp.escape(query))
207
+ else raise "A #{query.class} was passed to #{self}.grep(). Only Regexps and Strings are supported!"
208
+ end
209
+
210
+ query = Regexp.new(query.source, query.options | Regexp::IGNORECASE) if case_insensitive
211
+
212
+ ls_tree(repo, nil, options.fetch(:ref, 'HEAD'), ls_tree_options).each_with_object({}) do |item, result|
213
+ blob = Blob.new(repo, item[:mode], item[:path], walk.lookup_blob(ObjectId.from_string(item[:id])))
214
+ next if blob.binary?
215
+
216
+ rows = blob.data.split("\n")
217
+ data = rows.grep(query)
218
+ next if data.empty?
219
+
220
+ result[blob.path] = data
221
+ end
222
+ end
166
223
  end
167
224
 
168
225
  module Plumbing
@@ -1,3 +1,3 @@
1
1
  module RJGit
2
- VERSION = "5.6.1.0"
2
+ VERSION = "5.9.0.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: 5.6.1.0
4
+ version: 5.9.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maarten Engelen
@@ -12,14 +12,14 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2020-03-14 00:00:00.000000000 Z
15
+ date: 2020-11-02 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  requirements:
20
20
  - - "~>"
21
21
  - !ruby/object:Gem::Version
22
- version: '1.15'
22
+ version: '3.3'
23
23
  name: mime-types
24
24
  prerelease: false
25
25
  type: :runtime
@@ -27,7 +27,7 @@ dependencies:
27
27
  requirements:
28
28
  - - "~>"
29
29
  - !ruby/object:Gem::Version
30
- version: '1.15'
30
+ version: '3.3'
31
31
  description: JRuby wrapper around the JGit library for manipulating git repositories
32
32
  in code.
33
33
  email: repotag-dev@googlegroups.com
@@ -49,7 +49,8 @@ files:
49
49
  - lib/java/jars/bcpkix-jdk15on-161.jar
50
50
  - lib/java/jars/bcprov-jdk15on-161.jar
51
51
  - lib/java/jars/jsch-0.1.54.jar
52
- - lib/java/jars/org.eclipse.jgit-5.6.1.202002131546-r.jar
52
+ - lib/java/jars/org.eclipse.jgit-5.9.0.202009080501-r.jar
53
+ - lib/java/jars/org.eclipse.jgit.ssh.jsch-5.8.0.202006091008-r.jar
53
54
  - lib/java/jars/slf4j-api-1.7.2.jar
54
55
  - lib/java/jars/slf4j-simple-1.7.12.jar
55
56
  - lib/repo.rb