gollum-rugged_adapter 0.1b → 0.2b

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OWJjMGU4NGM0ODZkMjZmZGZkNDhhOTI4YTMzYmFmNzdiZDM3ZDEwMQ==
4
+ YWUyNjcxMGEzMTk5YWRhNDA3YWNmYjA3NzU1NmY5NWRhNDJjMmNjZQ==
5
5
  data.tar.gz: !binary |-
6
- YTNjYzk3OWE2Njk2MGQ0ODdmNTExZTMxYjlkMmY3NWIyYzkwYjQ2Nw==
6
+ YjY1MjA3YzEwMTlmY2ZlYmI0ZDQ0MWZlNDkwZjc4ZTg2MzljYjQ3MA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjI2Njg5N2EyODAyYzRiMjkzYmExZjNiYWFlZTZiZDQ3Y2VkZmRkOWEyOTNi
10
- ZmYyNTMwMjY1MGNiOWE5ZTQ4ZGIzZGQ1MjczYzYzNGJjY2YyMWVjY2M1NDQ5
11
- YjU0ODAxNWE5YjIzNzE4MjA1ZjBhNGUwN2FjOWI2ZWVkZTljMjE=
9
+ ZjEyMjRlMjYzMzRjOGQzN2I4ZDc4MGY5MmRiODk3ZDVhMTk0MTY0M2E2ZDdk
10
+ NWExOTQyOWViMzk1ZWY4YmZlMTIzODFiZGYzYjA1NjAyOWU5ZTNjYTJiZTk3
11
+ NGQwYWRmNWIzZjE3Yzg1ZjIzZTY4MGM5YmZhOWI0YjY2MTA2Y2Q=
12
12
  data.tar.gz: !binary |-
13
- MGRlOThmMWFhMzI0M2EyZDczNzFiMzA4OTA3ZWE1NTRlOWU3YTU2OTNhNGJj
14
- NjBiMDczZDQxNmQzZmFhOTE0NDE0MGQyNmZmNWMxM2U0YmYzMmU5NTFmN2M2
15
- NGRkOWEwN2I5NjZhYmFlNzQyZWFjYmVmMjdlOGQ2YTQyMWY0MmE=
13
+ NWFjZjBjYTgyYjA1MDk4MTVjMjc5YmQ3MjIwYjQ1MmE1MzFhMDQzM2M5NTBk
14
+ NTg4ZTBmYzRkYmU5YTk0ODExMmMzNmZlNmViZTM2MmEyM2I1ODc3ZDc4NzY0
15
+ YjRkYTU5OTAyNzk3ZTM1MGJjNzg5MWNiZWFkNTVlMGI5M2Y0OTI=
data/README.md CHANGED
@@ -12,11 +12,15 @@ Adapter for [gollum](https://github.com/gollum/gollum) to use [Rugged](https://g
12
12
 
13
13
  Install the gem:
14
14
 
15
- `gem install gollum-rugged_adapter`
15
+ ```bash
16
+ gem install --pre gollum-rugged_adapter # --pre required for beta-releases
17
+ ```
16
18
 
17
19
  Now run gollum as follows:
18
20
 
19
- `gollum --adapter rugged`
21
+ ```bash
22
+ gollum --adapter rugged
23
+ ```
20
24
 
21
25
  ## CONTRIBUTING
22
26
 
@@ -110,7 +110,7 @@ module Gollum
110
110
  end
111
111
 
112
112
  def authored_date
113
- @commit.time
113
+ @commit.author[:time]
114
114
  end
115
115
 
116
116
  def message
@@ -132,13 +132,15 @@ module Gollum
132
132
  deletions = 0
133
133
  total = 0
134
134
  files = []
135
- diff = @commit.diff.each_patch do |patch|
136
- new_additions = patch.stat[0]
137
- new_deletions = patch.stat[1]
135
+ parent = @commit.parents.first
136
+ diff = Rugged::Tree.diff(@commit.tree.repo, parent ? parent.tree : nil, @commit.tree)
137
+ diff = diff.each_patch do |patch|
138
+ new_additions = patch.stat[1]
139
+ new_deletions = patch.stat[0]
138
140
  additions += new_additions
139
141
  deletions += new_deletions
140
142
  total += patch.changes
141
- files << [patch.delta.new_file[:path], new_deletions, new_additions, patch.changes] # Rugged seems to generate the stat diffs in the other direciton than grit does by default, so switch the order of additions and deletions.
143
+ files << [patch.delta.new_file[:path].force_encoding("UTF-8"), new_deletions, new_additions, patch.changes] # Rugged seems to generate the stat diffs in the other direciton than grit does by default, so switch the order of additions and deletions.
142
144
  end
143
145
  OpenStruct.new(:additions => additions, :deletions => deletions, :files => files, :id => id, :total => total)
144
146
  end
@@ -543,9 +545,13 @@ module Gollum
543
545
  @index ||= Gollum::Git::Index.new(@repo.index, @repo)
544
546
  end
545
547
 
546
- def diff(sha1, sha2, path = nil)
548
+ def diff(sha1, sha2, *paths)
547
549
  opts = path == nil ? {} : {:path => path}
548
- @repo.diff(sha1, sha2, opts).patches.map {|patch| OpenStruct.new(:diff => patch.to_s.split("\n")[2..-1].join("\n"))}.reverse # First remove two superfluous lines. Rugged seems to order the diffs differently than Grit, so reverse.
550
+ patches = @repo.diff(sha1, sha2, opts).patches
551
+ if not paths.empty?
552
+ patches.keep_if { |p| paths.include? p.delta.new_file[:path] }
553
+ end
554
+ patches.map {|patch| OpenStruct.new(:diff => patch.to_s.split("\n")[2..-1].join("\n").force_encoding("UTF-8"))}.reverse # First remove two superfluous lines. Rugged seems to order the diffs differently than Grit, so reverse.
549
555
  end
550
556
 
551
557
  def log(commit = 'refs/heads/master', path = nil, options = {})
@@ -1,7 +1,7 @@
1
1
  module Gollum
2
2
  module Lib
3
3
  module Git
4
- VERSION = '0.1b'
4
+ VERSION = '0.2b'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gollum-rugged_adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1b
4
+ version: 0.2b
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bart Kamphorst, Dawa Ometto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-24 00:00:00.000000000 Z
11
+ date: 2015-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged