dirtree 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +7 -5
- data/dirtree.gemspec +0 -2
- data/exe/dirtree +32 -6
- data/lib/dirtree/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 488c50a2e59bf6d2c8869e66feefb25d41ae52b00b4bb463cdd0e213f2536536
|
4
|
+
data.tar.gz: 25153964406c9b93302bd1f74d833fd44f01124fe211ebbe2e20fb7eb1b0c8b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebe9bc99009044b84f6ebd15e8de8bf7001bf0b8beb7df9499bd9613d4ee78681c36d6e2b9a18831570cadaf3ab7efedf00c3611af1ce0b3f67694e3ac94cab7
|
7
|
+
data.tar.gz: 1930b9f2e722414acefc07ab3552666617be0c7d35a37d3565be472b58186ffc12091435eb5ea0f26ea48bcc0ec589bcd731cd441f1c7a785549283754412e16
|
data/README.md
CHANGED
@@ -13,8 +13,10 @@ Dirtree visualizes an list of file paths into a tree graph, printed as HTML page
|
|
13
13
|
## Circles template
|
14
14
|

|
15
15
|
|
16
|
-
##
|
16
|
+
## Treemap template
|
17
|
+

|
17
18
|
|
19
|
+
## Installation
|
18
20
|
|
19
21
|
$ gem install dirtree
|
20
22
|
|
@@ -24,9 +26,9 @@ Dirtree visualizes an list of file paths into a tree graph, printed as HTML page
|
|
24
26
|
-v, --version Print version
|
25
27
|
-h, --help Show this help text
|
26
28
|
-l, --local-dependencies Use saved JavaScript libraries instead of downloading them
|
27
|
-
-
|
28
|
-
-
|
29
|
-
|
29
|
+
-s, --screenshot Get an image screenshot of the directory tree
|
30
|
+
-o, --output=File.html Specify a path to write HTML output
|
31
|
+
-t, --template=TemplateName Specify the template name, available templates ["tree", "circles", "flame", "treemap"]
|
30
32
|
|
31
33
|
## Examples
|
32
34
|
|
@@ -36,7 +38,7 @@ Dirtree visualizes an list of file paths into a tree graph, printed as HTML page
|
|
36
38
|
$ dirtree -o output.html **/* *
|
37
39
|
```
|
38
40
|
|
39
|
-
|
41
|
+
make sure you have `globstar` on
|
40
42
|
```
|
41
43
|
$ shopt -s globstar
|
42
44
|
```
|
data/dirtree.gemspec
CHANGED
data/exe/dirtree
CHANGED
@@ -4,6 +4,7 @@ require 'optparse'
|
|
4
4
|
require 'json'
|
5
5
|
require 'erb'
|
6
6
|
require 'open-uri'
|
7
|
+
require 'tempfile'
|
7
8
|
|
8
9
|
templates_dir = File.join(File.dirname(__FILE__), '..', 'templates')
|
9
10
|
templates = Dir.open(templates_dir).map do |file|
|
@@ -43,12 +44,20 @@ OptionParser.new do |opts|
|
|
43
44
|
options[:local_dependencies] = true
|
44
45
|
end
|
45
46
|
|
47
|
+
opts.on(
|
48
|
+
'-s',
|
49
|
+
'--screenshot',
|
50
|
+
'Get an image screenshot of the directory tree'
|
51
|
+
) do
|
52
|
+
options[:screenshot] = true
|
53
|
+
end
|
54
|
+
|
46
55
|
opts.on(
|
47
56
|
'-oFile.html',
|
48
57
|
'--output=File.html',
|
49
|
-
'Specify a path to write output
|
50
|
-
not specified output will be printed to STDOUT'
|
58
|
+
'Specify a path to write HTML output'
|
51
59
|
) do |value|
|
60
|
+
raise 'missing filename after ‘-o’' if value.empty?
|
52
61
|
options[:output] = value
|
53
62
|
end
|
54
63
|
|
@@ -82,8 +91,25 @@ if options[:local_dependencies]
|
|
82
91
|
end
|
83
92
|
end
|
84
93
|
|
85
|
-
if options.key?(:output)
|
86
|
-
|
87
|
-
|
88
|
-
|
94
|
+
File.write(options[:output], result) if options.key?(:output)
|
95
|
+
|
96
|
+
if options.key?(:screenshot)
|
97
|
+
unless options.key?(:output)
|
98
|
+
tmp = Tempfile.new
|
99
|
+
tmp.write(result)
|
100
|
+
tmp.close
|
101
|
+
end
|
102
|
+
file = options[:output] || tmp.path
|
103
|
+
%w[chromium chrome google-chrome google-chrome-stable].each do |chrome|
|
104
|
+
system(
|
105
|
+
chrome,
|
106
|
+
'--disable-gpu',
|
107
|
+
'--headless',
|
108
|
+
'--screenshot',
|
109
|
+
'--window-size=1500,1500',
|
110
|
+
"file://" + file
|
111
|
+
) && break
|
112
|
+
end
|
89
113
|
end
|
114
|
+
|
115
|
+
puts result unless options.key?(:output) || options.key?(:screenshot)
|
data/lib/dirtree/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dirtree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emad Elsaid
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|