dorian-git-tree 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/git-tree +4 -0
  3. data/lib/dorian/git/tree.rb +29 -0
  4. metadata +45 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3cbb35e06fdb53882fda7e48dbf46c9b0576ca4e75aaba5e99a7485754ea72a6
4
+ data.tar.gz: 91f949eee7bfb3939c610d79936c017660cd20dfa75b716646837b6499472564
5
+ SHA512:
6
+ metadata.gz: c1d6839c7b46ddca156ac56aa5106a0dc7712d1fe6951b6cc1e43ad8e6dca660f82daf3e2f9b4387cd874d0412617cc9ebbd338ebd5b43dd232088fc6bfb3e90
7
+ data.tar.gz: 2a82615674b7fb29d25475e89f7ce797a254dab3d1b0c0d51c662e59931de6c7dd2ab67544540074ae584ce5b086a177511b6ed43660d70e62cda538d63dd706
data/bin/git-tree ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'dorian/git/tree'
4
+ Dorian::Git::Tree.run
@@ -0,0 +1,29 @@
1
+ require 'shellwords'
2
+
3
+ module Dorian
4
+ module Git
5
+ class Tree
6
+ def self.run
7
+ list(ARGV.first || ".")
8
+ end
9
+
10
+ private
11
+
12
+ def self.list(dir, start: true)
13
+ puts dir if start
14
+
15
+ `git ls-tree HEAD #{Shellwords.escape(dir)} --name-only`.split("\n").sort.each do |line|
16
+ split = line.split('/')
17
+ puts format(line)
18
+ list(line + '/', start: false) if File.directory?(line)
19
+ end
20
+ end
21
+
22
+ def self.format(file)
23
+ split = file.split('/')
24
+ return file unless split.size > 1
25
+ "│ " * (split.size - 2) + "└── " + split.last
26
+ end
27
+ end
28
+ end
29
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dorian-git-tree
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Dorian Marié
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-10-08 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: e.g. `git-tree config/`
14
+ email: dorian@dorianmarie.fr
15
+ executables:
16
+ - git-tree
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/git-tree
21
+ - lib/dorian/git/tree.rb
22
+ homepage: https://github.com/dorianmariefr/git-tree
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubygems_version: 3.2.19
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: Lists your files and directories in your git repository as a tree
45
+ test_files: []