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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de83dc517a44cecc9c6936beafcc7a9e92bbef44b9f835ce8c5f537a34fcfb99
4
- data.tar.gz: 4e5a152bf222a4a1a267fa97699b8f20cbe33be48c9d7847b83172dc26708c2a
3
+ metadata.gz: 22f794bf37522fed08b625102db5d264f79aca278567b6b1c1963d7c51e13d81
4
+ data.tar.gz: 5bc28c0eb6c16fc60d5325987c5f03e7a68e608c0cb1bea6671bee08733c4f33
5
5
  SHA512:
6
- metadata.gz: 8979a9ad2c06c9ff1762005feabfbdf28456e75a496c3a39a4276b7fe73a31fc9bb69c8941d4470efb8c2a7277bdbdce62de7c788f95622a24c299cd015a2e72
7
- data.tar.gz: 99f56b7376c5d96b933e1deb3f7282d37e7b7ce10130240516dc3408387feb38edb567de17ee72a96e9c1e5de49b3cde2c3f2d35fd0ff6cfc22767e1a010fb9b
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 corretly recognise missing borders and match the height and width
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.new(width 30, height: 10, border: :thick)
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 remoe a given border element as a value use `false`. For example to remove bottom border do:
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))
@@ -78,4 +78,3 @@ module TTY
78
78
  end # Border
79
79
  end # Box
80
80
  end # TTY
81
-
@@ -2,6 +2,6 @@
2
2
 
3
3
  module TTY
4
4
  module Box
5
- VERSION = "0.3.0"
5
+ VERSION = "0.4.0"
6
6
  end # Box
7
7
  end # TTY
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  if ENV['COVERAGE'] || ENV['TRAVIS']
2
4
  require 'simplecov'
3
5
  require 'coveralls'
@@ -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.6.0'
24
- spec.add_dependency 'strings', '~> 0.1.4'
24
+ spec.add_dependency 'tty-cursor', '~> 0.7'
25
+ spec.add_dependency 'strings', '~> 0.1.5'
25
26
 
26
- spec.add_development_dependency "bundler", "~> 1.16"
27
- spec.add_development_dependency "rake", "~> 10.0"
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.3.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: 2018-10-08 00:00:00.000000000 Z
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.6.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.6.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.4
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.4
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.16'
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.16'
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: '10.0'
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: '10.0'
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: '0'
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
- rubyforge_project:
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.