tty-box 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -1
- data/README.md +2 -2
- data/lib/tty/box.rb +1 -1
- data/lib/tty/box/border.rb +0 -1
- data/lib/tty/box/version.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- data/spec/unit/frame_spec.rb +12 -0
- data/tty-box.gemspec +7 -6
- metadata +17 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22f794bf37522fed08b625102db5d264f79aca278567b6b1c1963d7c51e13d81
|
4
|
+
data.tar.gz: 5bc28c0eb6c16fc60d5325987c5f03e7a68e608c0cb1bea6671bee08733c4f33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffe110f742b307902689234d61eee012709dac09b5723dc08617a5f605c0585e01c7d4e65282ab888a62719e8ca8a9b3d7f1d7e726e8d854ae84caf6d322c3d6
|
7
|
+
data.tar.gz: 6d966972cbd28e03edd08c6e80ef96db438ccdb2ac3343fb8cd4c6eea0db7bb125e510ed0b1b4d20864b6f252f590a9d8abf3e36a7cb0eae1d2b7f5b36b6c0f8
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## [v0.4.0] - 2019-06-05
|
4
|
+
|
5
|
+
### Changed
|
6
|
+
* Change gemspec to require Ruby >= 2.0.0
|
7
|
+
* Change to update tty-cursor dependency
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
* Fix issue with displaying box with colored content
|
11
|
+
|
3
12
|
## [v0.3.0] - 2018-10-08
|
4
13
|
|
5
14
|
### Added
|
@@ -7,7 +16,7 @@
|
|
7
16
|
* Add :ascii border type for drawing ASCII boxes
|
8
17
|
|
9
18
|
### Fixed
|
10
|
-
* Fix box color fill to
|
19
|
+
* Fix box color fill to correctly recognise missing borders and match the height and width
|
11
20
|
* Fix absolute content positioning when borders are missing
|
12
21
|
|
13
22
|
## [v0.2.1] - 2018-09-10
|
@@ -25,6 +34,7 @@
|
|
25
34
|
|
26
35
|
* Initial implementation and release
|
27
36
|
|
37
|
+
[v0.4.0]: https://github.com/piotrmurach/tty-box/compare/v0.3.0...v0.4.0
|
28
38
|
[v0.3.0]: https://github.com/piotrmurach/tty-box/compare/v0.2.1...v0.3.0
|
29
39
|
[v0.2.1]: https://github.com/piotrmurach/tty-box/compare/v0.2.0...v0.2.1
|
30
40
|
[v0.2.0]: https://github.com/piotrmurach/tty-box/compare/v0.1.0...v0.2.0
|
data/README.md
CHANGED
@@ -197,7 +197,7 @@ print box
|
|
197
197
|
There are three types of border `:ascii`, `:light`, `:thick`. By default the `:light` border is used. This can be changed using the `:border` keyword:
|
198
198
|
|
199
199
|
```ruby
|
200
|
-
box = TTY::Box.
|
200
|
+
box = TTY::Box.frame(width: 30, height: 10, border: :thick)
|
201
201
|
```
|
202
202
|
|
203
203
|
and printing the box out to console will produce:
|
@@ -268,7 +268,7 @@ print box
|
|
268
268
|
# ┼────────┼
|
269
269
|
```
|
270
270
|
|
271
|
-
If you want to
|
271
|
+
If you want to remove a given border element as a value use `false`. For example to remove bottom border do:
|
272
272
|
|
273
273
|
```ruby
|
274
274
|
TTY::Box.new(
|
data/lib/tty/box.rb
CHANGED
@@ -106,7 +106,7 @@ module TTY
|
|
106
106
|
content_size = width - left_size - right_size
|
107
107
|
unless content[i].nil?
|
108
108
|
output << bg.(fg.(content[i]))
|
109
|
-
content_size -= content[i].size
|
109
|
+
content_size -= Strings::ANSI.sanitize(content[i]).size
|
110
110
|
end
|
111
111
|
if style[:fg] || style[:bg] || !position # something to color
|
112
112
|
output << bg.(fg.(' ' * content_size))
|
data/lib/tty/box/border.rb
CHANGED
data/lib/tty/box/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
data/spec/unit/frame_spec.rb
CHANGED
@@ -46,4 +46,16 @@ RSpec.describe TTY::Box, '#frame' do
|
|
46
46
|
"\e[4;1H└──────────────────┘"
|
47
47
|
].join)
|
48
48
|
end
|
49
|
+
|
50
|
+
it "correctly displays colored content" do
|
51
|
+
box = TTY::Box.frame(width: 35, height: 3) do
|
52
|
+
Pastel.new.green.on_red("Hello world!")
|
53
|
+
end
|
54
|
+
|
55
|
+
expect(box).to eq([
|
56
|
+
"┌─────────────────────────────────┐\n",
|
57
|
+
"│\e[32;41mHello world!\e[0m │\n",
|
58
|
+
"└─────────────────────────────────┘\n"
|
59
|
+
].join)
|
60
|
+
end
|
49
61
|
end
|
data/tty-box.gemspec
CHANGED
@@ -6,8 +6,7 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = "tty-box"
|
7
7
|
spec.version = TTY::Box::VERSION
|
8
8
|
spec.authors = ["Piotr Murach"]
|
9
|
-
spec.email = [""]
|
10
|
-
|
9
|
+
spec.email = ["me@piotrmurach.com"]
|
11
10
|
spec.summary = %q{Draw various frames and boxes in your terminal interface.}
|
12
11
|
spec.description = %q{Draw various frames and boxes in your terminal interface.}
|
13
12
|
spec.homepage = "https://piotrmurach.github.io/tty"
|
@@ -19,11 +18,13 @@ Gem::Specification.new do |spec|
|
|
19
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
19
|
spec.require_paths = ["lib"]
|
21
20
|
|
21
|
+
spec.required_ruby_version = '>= 2.0.0'
|
22
|
+
|
22
23
|
spec.add_dependency 'pastel', '~> 0.7.2'
|
23
|
-
spec.add_dependency 'tty-cursor', '~> 0.
|
24
|
-
spec.add_dependency 'strings', '~> 0.1.
|
24
|
+
spec.add_dependency 'tty-cursor', '~> 0.7'
|
25
|
+
spec.add_dependency 'strings', '~> 0.1.5'
|
25
26
|
|
26
|
-
spec.add_development_dependency "bundler", "
|
27
|
-
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "bundler", ">= 1.5"
|
28
|
+
spec.add_development_dependency "rake"
|
28
29
|
spec.add_development_dependency "rspec", "~> 3.0"
|
29
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tty-box
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Murach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pastel
|
@@ -30,56 +30,56 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: '0.7'
|
34
34
|
type: :runtime
|
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: 0.
|
40
|
+
version: '0.7'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: strings
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.1.
|
47
|
+
version: 0.1.5
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.1.
|
54
|
+
version: 0.1.5
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
61
|
+
version: '1.5'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '1.
|
68
|
+
version: '1.5'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,7 +96,7 @@ dependencies:
|
|
96
96
|
version: '3.0'
|
97
97
|
description: Draw various frames and boxes in your terminal interface.
|
98
98
|
email:
|
99
|
-
-
|
99
|
+
- me@piotrmurach.com
|
100
100
|
executables: []
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
@@ -138,15 +138,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
138
138
|
requirements:
|
139
139
|
- - ">="
|
140
140
|
- !ruby/object:Gem::Version
|
141
|
-
version:
|
141
|
+
version: 2.0.0
|
142
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
144
|
- - ">="
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: '0'
|
147
147
|
requirements: []
|
148
|
-
|
149
|
-
rubygems_version: 2.7.3
|
148
|
+
rubygems_version: 3.0.3
|
150
149
|
signing_key:
|
151
150
|
specification_version: 4
|
152
151
|
summary: Draw various frames and boxes in your terminal interface.
|