dorian-git-tree 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dorian/git/tree.rb +11 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db9e5c485461690eb5d6c477b7ee19800310a7ed75cc344a75ce4e010a84f39a
|
4
|
+
data.tar.gz: 2754c9fb19a4ea50b1caf7d456fac5407964d94f572e560b68d41bad4eb49a3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bf1564b380bb50e76d70772cc9d58a8bea580a57d7a15de717906a7da535f7a36d1398c4c5aa651a70f014ed37d8fc75a0542215e87dc6d81d9326025091604
|
7
|
+
data.tar.gz: d4fdd7e69ed9f1c0802a6c7c83368d6937ae19321560b5ee9616c896a49573e98f28422b07076122803ef0fcc3752f360848e027dce502a30efbd91a727008d4
|
data/lib/dorian/git/tree.rb
CHANGED
@@ -15,10 +15,17 @@ module Dorian
|
|
15
15
|
end
|
16
16
|
|
17
17
|
key = ARGV.first || "."
|
18
|
-
|
18
|
+
|
19
|
+
files = git_ls_files(key).map do |file|
|
20
|
+
ARGV.first ? file.sub(ARGV.first, "") : file
|
21
|
+
end
|
22
|
+
|
19
23
|
values = group(files)
|
24
|
+
|
20
25
|
key = "#{key}/" if values.any? && key != "." && key[-1] != "/"
|
26
|
+
|
21
27
|
puts key
|
28
|
+
|
22
29
|
values.each.with_index do |(value_key, value_values), value_index|
|
23
30
|
print(
|
24
31
|
key: value_key,
|
@@ -30,7 +37,9 @@ module Dorian
|
|
30
37
|
end
|
31
38
|
|
32
39
|
def self.git_ls_files(path)
|
33
|
-
`#{["git", "ls-files", path].compact.shelljoin}`.split("\n")
|
40
|
+
result = `#{["git", "ls-files", path].compact.shelljoin}`.split("\n")
|
41
|
+
exit $?.exitstatus if $?.exitstatus > 0
|
42
|
+
result
|
34
43
|
end
|
35
44
|
|
36
45
|
def self.group(files)
|