dirtree 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb64f8d686c8126e4dab42c711d7f3b17eb050d3
4
- data.tar.gz: ff74a6c7a5e016e8e5852421916fb62190c7c24f
3
+ metadata.gz: dab1916c1ed6f532cea1b66c6ec5f6485342cfb8
4
+ data.tar.gz: da89e771d354d425ac016a407997b73d4caef95b
5
5
  SHA512:
6
- metadata.gz: 67ed70759e896f00a666d5568b0e7d793081f6e85fecb7bf61e6eff1e33ce9a0f0f984f1aaacacda46147caa457c6be2a80939630a73af18db6662908020878d
7
- data.tar.gz: a41b0d579446826b277b709c4f538c4486db68f33cdb59b54510e2ca523543bdeb0132903104e46b968284991121d5a579ffbb5a3e036c9b747ef207bdc49c7d
6
+ metadata.gz: 27971ec983be71a799a7e304d660f9834be1f7c4c0dc0ad831a31414cf272c9f8437dae1358547a31cf3b0e46f8b0771c72105935642084773faf6c2d2c07f4c
7
+ data.tar.gz: 5ce9c49b082bc5aa8b3909e1183cd36a0808504558cf8881cd67ab0d30d8e3298f5bf8f440e506387a0fdfd1330e5b4ee6026412c52fa20f968f0a9ff67c98f3
data/README.md CHANGED
@@ -20,7 +20,9 @@ Dirtree visualizes an list of file paths into a tree graph, printed as HTML page
20
20
  Usage: dirtree [options]... [file]...
21
21
  -v, --version Print version
22
22
  -h, --help Show this help text
23
+ -l, --local-dependencies Use saved JavaScript libraries instead of downloading them
23
24
  -o, --output=File.html Specify a path to write output, if not specified output will be printed to STDOUT
25
+ -t, --template=TemplateName Specify the template name, available templates ["circles", "tree"]
24
26
 
25
27
 
26
28
  ## Examples
data/exe/dirtree CHANGED
@@ -3,6 +3,7 @@ require 'dirtree'
3
3
  require 'optparse'
4
4
  require 'json'
5
5
  require 'erb'
6
+ require 'open-uri'
6
7
 
7
8
  templates_dir = File.join(File.dirname(__FILE__), '..', 'templates')
8
9
  templates = Dir.open(templates_dir).map do |file|
@@ -34,10 +35,19 @@ OptionParser.new do |opts|
34
35
  exit
35
36
  end
36
37
 
38
+ opts.on(
39
+ '-l',
40
+ '--local-dependencies',
41
+ 'Use saved JavaScript libraries instead of downloading them'
42
+ ) do
43
+ options[:local_dependencies] = true
44
+ end
45
+
37
46
  opts.on(
38
47
  '-oFile.html',
39
48
  '--output=File.html',
40
- 'Specify a path to write output, by default will be printed to STDOUT'
49
+ 'Specify a path to write output, if
50
+ not specified output will be printed to STDOUT'
41
51
  ) do |value|
42
52
  options[:output] = value
43
53
  end
@@ -62,6 +72,16 @@ template = File.read(File.expand_path(template_file))
62
72
  tree = root.as_json
63
73
  result = ERB.new(template).result binding
64
74
 
75
+ if options[:local_dependencies]
76
+ result.gsub! %r{(<script src="(.+)"><\/script>)} do
77
+ injection = '<script>'
78
+ injection << open($2).read
79
+ injection << '</script>'
80
+
81
+ injection
82
+ end
83
+ end
84
+
65
85
  if options.key?(:output)
66
86
  File.write(options[:output], result)
67
87
  else
@@ -1,3 +1,3 @@
1
1
  module Dirtree
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.3.0'.freeze
3
3
  end
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.2.0
4
+ version: 0.3.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: 2017-07-19 00:00:00.000000000 Z
11
+ date: 2017-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  version: '0'
79
79
  requirements: []
80
80
  rubyforge_project:
81
- rubygems_version: 2.6.10
81
+ rubygems_version: 2.6.12
82
82
  signing_key:
83
83
  specification_version: 4
84
84
  summary: display list of file paths as an interactive tree