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 +8 -8
- data/README.md +6 -2
- data/lib/rugged_adapter/git_layer_rugged.rb +13 -7
- data/lib/rugged_adapter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YWUyNjcxMGEzMTk5YWRhNDA3YWNmYjA3NzU1NmY5NWRhNDJjMmNjZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjY1MjA3YzEwMTlmY2ZlYmI0ZDQ0MWZlNDkwZjc4ZTg2MzljYjQ3MA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjEyMjRlMjYzMzRjOGQzN2I4ZDc4MGY5MmRiODk3ZDVhMTk0MTY0M2E2ZDdk
|
10
|
+
NWExOTQyOWViMzk1ZWY4YmZlMTIzODFiZGYzYjA1NjAyOWU5ZTNjYTJiZTk3
|
11
|
+
NGQwYWRmNWIzZjE3Yzg1ZjIzZTY4MGM5YmZhOWI0YjY2MTA2Y2Q=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
136
|
-
|
137
|
-
|
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,
|
548
|
+
def diff(sha1, sha2, *paths)
|
547
549
|
opts = path == nil ? {} : {:path => path}
|
548
|
-
@repo.diff(sha1, sha2, opts).patches
|
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 = {})
|
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.
|
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:
|
11
|
+
date: 2015-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rugged
|