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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dorian/git/tree.rb +11 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42b9ccf28933c01ec92f8d3b25d01a3f7e5ba10ae20ad481e1b4715351165979
4
- data.tar.gz: 3b4cbf601a6f870dd5c807358c2d8d34210de77591c2795be9b626d647fd9152
3
+ metadata.gz: db9e5c485461690eb5d6c477b7ee19800310a7ed75cc344a75ce4e010a84f39a
4
+ data.tar.gz: 2754c9fb19a4ea50b1caf7d456fac5407964d94f572e560b68d41bad4eb49a3c
5
5
  SHA512:
6
- metadata.gz: b44ccdfea86469a67ca44d697a732609671f165cb959dcc50a669a88fc239b6d6244ab477eb6ce01863c8d02a86ee1764099ef224310909fa8fcaea20a907be5
7
- data.tar.gz: e0379bb8aaa800c98549cb62e6f3acff6ae6feae7d9433ca7078da7ffbdab670286c9fa9dd23b1c0c9cb68f4b5ccba58634fecf42ff132e29e7885ec4d19ff00
6
+ metadata.gz: 5bf1564b380bb50e76d70772cc9d58a8bea580a57d7a15de717906a7da535f7a36d1398c4c5aa651a70f014ed37d8fc75a0542215e87dc6d81d9326025091604
7
+ data.tar.gz: d4fdd7e69ed9f1c0802a6c7c83368d6937ae19321560b5ee9616c896a49573e98f28422b07076122803ef0fcc3752f360848e027dce502a30efbd91a727008d4
@@ -15,10 +15,17 @@ module Dorian
15
15
  end
16
16
 
17
17
  key = ARGV.first || "."
18
- files = git_ls_files(key)
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dorian-git-tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié