tty-tree 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53e2981f489110b90e65e7205454e15b1bea811f29063fc5f165c68a2a4a6b5f
4
- data.tar.gz: ca58a44574af6db9502106a7f6f292125f0b4f156401b3f69e6d4001b602831f
3
+ metadata.gz: 53809e6a714d9396dad1142a2a2b9a0183c7cc18580634ea3d9e0e42a22fb58a
4
+ data.tar.gz: 14326bab7fc703fb8e39870238f9a4ff964c9ab60699d2a18bf4c42a381abe88
5
5
  SHA512:
6
- metadata.gz: bc7fa766eb270b8324b5c9241d7fa0869c4e63273ea57809a8d66c982b13e4db501173c88a1201003e71b7db6f629577a971e0bc97abe3feae9a1e9e6c7d6b63
7
- data.tar.gz: 4508c2b82e085d0e3deca12fb62d74c9c20d4453367286add7e0e3b9a3b6e1f4aab27ae99fec2194957d6e0dcc2d5160172f7cbfa9d985099d9ba7589f9aedc9
6
+ metadata.gz: 2a4a9598b9b71c63eb8332b6445686b553aba1e6af92937dc23a0f3432f5ae67190bd91985975bba95afe18bf70dd89e58001f5c2875c4dd4b35790ec38933e6
7
+ data.tar.gz: 27dafaa5422382d8749017825110641ea4021c71a3778997a6484804015d08b217eaec6941e834a448fc9d25e07ea4f3e2d94735e0bcbf9367b93e37f4459e64
@@ -1,5 +1,10 @@
1
1
  # Change log
2
2
 
3
+ ## [v0.3.0] - 2019-05-03
4
+
5
+ ### Changed
6
+ * Strip null bytes from pathname by Stephen A. Wilson(@Zeragamba)
7
+
3
8
  ## [v0.2.0] - 2018-09-01
4
9
 
5
10
  ### Changed
@@ -9,5 +14,6 @@
9
14
 
10
15
  * Initial implementation and release
11
16
 
17
+ [v0.3.0]: https://github.com/piotrmurach/tty-tree/compare/v0.2.0...v0.3.0
12
18
  [v0.2.0]: https://github.com/piotrmurach/tty-tree/compare/v0.1.0...v0.2.0
13
19
  [v0.1.0]: https://github.com/piotrmurach/tty-tree/compare/v0.1.0
data/README.md CHANGED
@@ -21,7 +21,7 @@
21
21
 
22
22
  > Print directory or structured data in a tree like format.
23
23
 
24
- **TTY::Prompt** provides independent directory or hash data rendering component for [TTY](https://github.com/piotrmurach/tty) toolkit.
24
+ **TTY::Tree** provides independent directory or hash data rendering component for [TTY](https://github.com/piotrmurach/tty) toolkit.
25
25
 
26
26
  ## Installation
27
27
 
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module TTY
@@ -33,7 +33,12 @@ module TTY
33
33
  :symlink?, :socket?, :pipe?
34
34
 
35
35
  def initialize(path, parent, prefix, level)
36
- @path = Pathname.new(path)
36
+ if path.is_a? String
37
+ # strip null bytes from the string to avoid throwing errors
38
+ path = path.delete("\0")
39
+ end
40
+
41
+ @path = Pathname.new(path)
37
42
  @name = @path.basename
38
43
  @parent = Pathname.new(parent)
39
44
  @prefix = prefix
@@ -42,6 +47,7 @@ module TTY
42
47
 
43
48
  def full_path
44
49
  return parent if name.to_s.empty?
50
+
45
51
  parent.join(name)
46
52
  end
47
53
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module TTY
4
4
  class Tree
5
- VERSION = "0.2.0"
5
+ VERSION = "0.3.0"
6
6
  end # Tree
7
7
  end # TTY
@@ -4,7 +4,7 @@
4
4
  RSpec.describe TTY::Tree::Node do
5
5
  it "provides directory stats" do
6
6
  dir = fixtures_path('dir1')
7
- node = TTY::Tree::Node.new(dir, '', '', 0)
7
+ node = TTY::Tree::Node.new(dir, '', '', 0)
8
8
 
9
9
  expect(node.directory?).to eq(true)
10
10
  expect(node.file?).to eq(false)
@@ -33,4 +33,10 @@ RSpec.describe TTY::Tree::Node do
33
33
 
34
34
  expect(node_a).to_not eq(node_b)
35
35
  end
36
+
37
+ it "strips null bytes from pathname" do
38
+ node = nil
39
+ expect {node = TTY::Tree::Node.new("dir1\0", '', '', 0)}.not_to raise_error
40
+ expect(node.path.to_s).to eq('dir1')
41
+ end
36
42
  end
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
6
6
  spec.name = "tty-tree"
7
7
  spec.version = TTY::Tree::VERSION
8
8
  spec.authors = ["Piotr Murach"]
9
- spec.email = [""]
9
+ spec.email = ["me@piotrmurach.com"]
10
10
 
11
11
  spec.summary = %q{Print directory or structured data in a tree like format.}
12
12
  spec.description = %q{Print directory or structured data in a tree like format.}
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.required_ruby_version = '>= 2.0.0'
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.14"
25
- spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "bundler", ">= 1.14.0"
25
+ spec.add_development_dependency "rake"
26
26
  spec.add_development_dependency "rspec", "~> 3.0"
27
27
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tty-tree
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
  - Piotr Murach
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-01 00:00:00.000000000 Z
11
+ date: 2019-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.14'
19
+ version: 1.14.0
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.14'
26
+ version: 1.14.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '3.0'
55
55
  description: Print directory or structured data in a tree like format.
56
56
  email:
57
- - ''
57
+ - me@piotrmurach.com
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
@@ -103,8 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
- rubyforge_project:
107
- rubygems_version: 2.7.3
106
+ rubygems_version: 3.0.3
108
107
  signing_key:
109
108
  specification_version: 4
110
109
  summary: Print directory or structured data in a tree like format.