dorian-git-tree 0.2.2 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/git-tree +2 -1
- data/lib/dorian/git/tree.rb +18 -4
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b75c81a2bb8b9c645a6f11b968acddbc5fb6ccae3c5652b626c6731ecb610ea5
|
4
|
+
data.tar.gz: 8a931bfd14ac781ed36a458c405b876dcae7700d3366c57358ad04da0d953acd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c7242040f46199cd329fa59cc2cb0253bf4be8b025c8901d883c0035c2fd97510695548a305afc1fe2cf511441d02071e2db2d212f1c9e75ef06d74cb6e1fe5
|
7
|
+
data.tar.gz: a18875fefc4682cc1ea3170e6e466331852f29e51949d0a4d76ccfce39898a420795acae3e46397f6a8ddbded3d26e93926f7806fa576850ea9be71dc38ec60a
|
data/bin/git-tree
CHANGED
data/lib/dorian/git/tree.rb
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "English"
|
4
|
+
|
1
5
|
require "shellwords"
|
2
6
|
|
3
7
|
module Dorian
|
@@ -15,22 +19,32 @@ module Dorian
|
|
15
19
|
end
|
16
20
|
|
17
21
|
key = ARGV.first || "."
|
18
|
-
|
22
|
+
|
23
|
+
files =
|
24
|
+
git_ls_files(key).map do |file|
|
25
|
+
ARGV.first ? file.sub(ARGV.first, "") : file
|
26
|
+
end
|
27
|
+
|
19
28
|
values = group(files)
|
29
|
+
|
20
30
|
key = "#{key}/" if values.any? && key != "." && key[-1] != "/"
|
31
|
+
|
21
32
|
puts key
|
33
|
+
|
22
34
|
values.each.with_index do |(value_key, value_values), value_index|
|
23
35
|
print(
|
24
36
|
key: value_key,
|
25
37
|
values: value_values,
|
26
38
|
index: value_index,
|
27
|
-
size: values.size
|
39
|
+
size: values.size
|
28
40
|
)
|
29
41
|
end
|
30
42
|
end
|
31
43
|
|
32
44
|
def self.git_ls_files(path)
|
33
|
-
`#{["git", "ls-files", path].compact.shelljoin}`.split("\n")
|
45
|
+
result = `#{["git", "ls-files", path].compact.shelljoin}`.split("\n")
|
46
|
+
exit $CHILD_STATUS.exitstatus if $CHILD_STATUS.exitstatus.positive?
|
47
|
+
result
|
34
48
|
end
|
35
49
|
|
36
50
|
def self.group(files)
|
@@ -39,7 +53,7 @@ module Dorian
|
|
39
53
|
.transform_values do |values|
|
40
54
|
group(
|
41
55
|
values
|
42
|
-
.map { |value| value.split("/")[1
|
56
|
+
.map { |value| value.split("/")[1..].join("/") }
|
43
57
|
.reject(&:empty?)
|
44
58
|
)
|
45
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dorian-git-tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dorian Marié
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
Lists your files and directories in your git repository as a tree
|
@@ -22,7 +22,7 @@ extra_rdoc_files: []
|
|
22
22
|
files:
|
23
23
|
- bin/git-tree
|
24
24
|
- lib/dorian/git/tree.rb
|
25
|
-
homepage: https://github.com/
|
25
|
+
homepage: https://github.com/dorianmariecom/git-tree
|
26
26
|
licenses:
|
27
27
|
- MIT
|
28
28
|
metadata:
|
@@ -42,7 +42,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: '0'
|
44
44
|
requirements: []
|
45
|
-
rubygems_version: 3.
|
45
|
+
rubygems_version: 3.5.3
|
46
46
|
signing_key:
|
47
47
|
specification_version: 4
|
48
48
|
summary: Lists your files and directories in your git repository as a tree
|