tty-table 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/CHANGELOG.md +8 -0
- data/Gemfile +0 -1
- data/appveyor.yml +0 -4
- data/lib/tty/table.rb +2 -2
- data/lib/tty/table/column_constraint.rb +2 -2
- data/lib/tty/table/{column_set.rb → columns.rb} +2 -2
- data/lib/tty/table/renderer/basic.rb +2 -2
- data/lib/tty/table/version.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/unit/{column_set → columns}/extract_widths_spec.rb +6 -8
- data/spec/unit/{column_set → columns}/total_width_spec.rb +1 -3
- data/spec/unit/{column_set → columns}/widths_from_spec.rb +1 -3
- data/tty-table.gemspec +4 -1
- metadata +26 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bcfc9c4c4f7d6855d4873722744d74857e12de3
|
4
|
+
data.tar.gz: 9850f499486fdb55fec0114f5b136d0237be61c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d879801c732179591cba77d527c2330679d9edc029966ffd08a0afaeac65db2b5e9a5089787881132f336573b5ea8ef9a230c9a6783d8d218db9f403ec23dc7
|
7
|
+
data.tar.gz: cb944ee39fa02cba0a77d885c42d7f80d1b6133a51ae96d8f368ce755d462cfce1fdcefa1ea3dcaed80d19e69318137e3bb108d4f6ee314ddc4539010506ef0c
|
data/.travis.yml
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
language: ruby
|
3
3
|
sudo: false
|
4
4
|
cache: bundler
|
5
|
+
before_install: "gem update bundler"
|
5
6
|
bundler_args: --without yard benchmarks
|
6
7
|
script: "bundle exec rake ci"
|
7
8
|
rvm:
|
@@ -9,7 +10,7 @@ rvm:
|
|
9
10
|
- 2.1.10
|
10
11
|
- 2.2.6
|
11
12
|
- 2.3.3
|
12
|
-
- 2.4.
|
13
|
+
- 2.4.1
|
13
14
|
- ruby-head
|
14
15
|
- jruby-9.1.1.0
|
15
16
|
- jruby-head
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## [v0.9.0] - 2017-11-04
|
4
|
+
|
5
|
+
### Changed
|
6
|
+
* Change ColumnSet class to Columns
|
7
|
+
* Change gemset to require Ruby >= 2.0.0
|
8
|
+
* Change to update tty-screen dependency
|
9
|
+
|
3
10
|
## [v0.8.0] - 2017-02-27
|
4
11
|
|
5
12
|
### Changed
|
@@ -69,6 +76,7 @@
|
|
69
76
|
|
70
77
|
* Initial implementation and release
|
71
78
|
|
79
|
+
[v0.9.0]: https://github.com/piotrmurach/tty-table/compare/v0.8.0...v0.9.0
|
72
80
|
[v0.8.0]: https://github.com/piotrmurach/tty-table/compare/v0.7.0...v0.8.0
|
73
81
|
[v0.7.0]: https://github.com/piotrmurach/tty-table/compare/v0.6.0...v0.7.0
|
74
82
|
[v0.6.0]: https://github.com/piotrmurach/tty-table/compare/v0.5.0...v0.6.0
|
data/Gemfile
CHANGED
data/appveyor.yml
CHANGED
@@ -9,7 +9,6 @@ test_script:
|
|
9
9
|
- bundle exec rake ci
|
10
10
|
environment:
|
11
11
|
matrix:
|
12
|
-
- ruby_version: "193"
|
13
12
|
- ruby_version: "200"
|
14
13
|
- ruby_version: "200-x64"
|
15
14
|
- ruby_version: "21"
|
@@ -18,6 +17,3 @@ environment:
|
|
18
17
|
- ruby_version: "22-x64"
|
19
18
|
- ruby_version: "23"
|
20
19
|
- ruby_version: "23-x64"
|
21
|
-
matrix:
|
22
|
-
allow_failures:
|
23
|
-
- ruby_version: "193"
|
data/lib/tty/table.rb
CHANGED
@@ -4,7 +4,7 @@ require 'equatable'
|
|
4
4
|
require 'forwardable'
|
5
5
|
require 'necromancer'
|
6
6
|
|
7
|
-
require_relative 'table/
|
7
|
+
require_relative 'table/columns'
|
8
8
|
require_relative 'table/header'
|
9
9
|
require_relative 'table/orientation'
|
10
10
|
require_relative 'table/row'
|
@@ -370,7 +370,7 @@ module TTY
|
|
370
370
|
#
|
371
371
|
# @api public
|
372
372
|
def width
|
373
|
-
|
373
|
+
Columns.new(self).total_width
|
374
374
|
end
|
375
375
|
|
376
376
|
# Return true if this is an empty table, i.e. if the number of
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require_relative 'border/null'
|
4
|
-
require_relative '
|
4
|
+
require_relative 'columns'
|
5
5
|
require_relative 'error'
|
6
6
|
|
7
7
|
module TTY
|
@@ -109,7 +109,7 @@ module TTY
|
|
109
109
|
'orientation.'
|
110
110
|
table.orientation = :vertical
|
111
111
|
table.rotate
|
112
|
-
|
112
|
+
Columns.widths_from(table)
|
113
113
|
end
|
114
114
|
|
115
115
|
# Expand column widths to match the requested width
|
@@ -8,7 +8,7 @@ require_relative '../border_dsl'
|
|
8
8
|
require_relative '../border_options'
|
9
9
|
require_relative '../border/null'
|
10
10
|
require_relative '../column_constraint'
|
11
|
-
require_relative '../
|
11
|
+
require_relative '../columns'
|
12
12
|
require_relative '../header'
|
13
13
|
require_relative '../indentation'
|
14
14
|
require_relative '../operations'
|
@@ -132,7 +132,7 @@ module TTY
|
|
132
132
|
#
|
133
133
|
# @api public
|
134
134
|
def column_widths
|
135
|
-
@column_widths =
|
135
|
+
@column_widths = Columns.widths_from(table, @column_widths)
|
136
136
|
end
|
137
137
|
|
138
138
|
# Store border characters, style and separator for the table rendering
|
data/lib/tty/table/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
RSpec.describe TTY::Table::ColumnSet, '#extract_widths' do
|
3
|
+
RSpec.describe TTY::Table::Columns, '#extract_widths' do
|
6
4
|
let(:color) { Pastel.new(enabled: true) }
|
7
5
|
|
8
6
|
it 'extract widths' do
|
9
7
|
header = ['h1', 'h2', 'h3']
|
10
8
|
rows = [['a1', 'a2', 'a3'], ['b1', 'b2', 'b3']]
|
11
9
|
table = TTY::Table.new header, rows
|
12
|
-
column_set = TTY::Table::
|
10
|
+
column_set = TTY::Table::Columns.new(table)
|
13
11
|
expect(column_set.extract_widths).to eql([2,2,2])
|
14
12
|
end
|
15
13
|
|
@@ -17,7 +15,7 @@ RSpec.describe TTY::Table::ColumnSet, '#extract_widths' do
|
|
17
15
|
header = ['h1', 'うなじ']
|
18
16
|
rows = [['こんにちは', 'a2'], ['b1','選択']]
|
19
17
|
table = TTY::Table.new header, rows
|
20
|
-
column_set = TTY::Table::
|
18
|
+
column_set = TTY::Table::Columns.new(table)
|
21
19
|
expect(column_set.extract_widths).to eql([10,6])
|
22
20
|
end
|
23
21
|
|
@@ -25,7 +23,7 @@ RSpec.describe TTY::Table::ColumnSet, '#extract_widths' do
|
|
25
23
|
table = TTY::Table.new
|
26
24
|
table << ["Multi\nLine\nContent", "Text\nthat\nwraps"]
|
27
25
|
table << ["Some\nother\ntext", 'Simple']
|
28
|
-
column_set = TTY::Table::
|
26
|
+
column_set = TTY::Table::Columns.new(table)
|
29
27
|
expect(column_set.extract_widths).to eq([7,6])
|
30
28
|
end
|
31
29
|
|
@@ -33,7 +31,7 @@ RSpec.describe TTY::Table::ColumnSet, '#extract_widths' do
|
|
33
31
|
table = TTY::Table.new
|
34
32
|
table << ["Multi\\nLine\\nContent", "Text\\nthat\\nwraps"]
|
35
33
|
table << ["Some\\nother\\ntext", 'Simple']
|
36
|
-
column_set = TTY::Table::
|
34
|
+
column_set = TTY::Table::Columns.new(table)
|
37
35
|
expect(column_set.extract_widths).to eq([20, 17])
|
38
36
|
end
|
39
37
|
|
@@ -42,7 +40,7 @@ RSpec.describe TTY::Table::ColumnSet, '#extract_widths' do
|
|
42
40
|
table = TTY::Table.new header: header
|
43
41
|
table << [color.green.on_blue('a1'), 'a2']
|
44
42
|
table << ['b1', color.red.on_yellow('b2')]
|
45
|
-
column_set = TTY::Table::
|
43
|
+
column_set = TTY::Table::Columns.new(table)
|
46
44
|
expect(column_set.extract_widths).to eq([2,2])
|
47
45
|
end
|
48
46
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
RSpec.describe TTY::Table::ColumnSet, '#extract_widths!' do
|
3
|
+
RSpec.describe TTY::Table::Columns, '#extract_widths!' do
|
6
4
|
let(:header) { ['h1', 'h2', 'h3'] }
|
7
5
|
let(:rows) { [['a1', 'a2', 'a3'], ['b1', 'b2', 'b3']] }
|
8
6
|
let(:table) { TTY::Table.new header, rows }
|
@@ -1,8 +1,6 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
RSpec.describe TTY::Table::ColumnSet, '#widths_from' do
|
3
|
+
RSpec.describe TTY::Table::Columns, '#widths_from' do
|
6
4
|
let(:header) { ['h1', 'h2', 'h3'] }
|
7
5
|
let(:rows) { [['a1', 'a2', 'a3'], ['b1', 'b2', 'b3']] }
|
8
6
|
let(:table) { TTY::Table.new header, rows }
|
data/tty-table.gemspec
CHANGED
@@ -18,13 +18,16 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
+
spec.required_ruby_version = '>= 2.0.0'
|
22
|
+
|
21
23
|
spec.add_dependency 'equatable', '~> 0.5.0'
|
22
24
|
spec.add_dependency 'necromancer', '~> 0.4.0'
|
23
25
|
spec.add_dependency 'pastel', '~> 0.7.0'
|
24
|
-
spec.add_dependency 'tty-screen', '~> 0.
|
26
|
+
spec.add_dependency 'tty-screen', '~> 0.6.0'
|
25
27
|
spec.add_dependency 'verse', '~> 0.5.0'
|
26
28
|
spec.add_dependency 'unicode-display_width','~> 1.1.0'
|
27
29
|
|
28
30
|
spec.add_development_dependency 'bundler', '>= 1.5.0', '< 2.0'
|
29
31
|
spec.add_development_dependency 'rake'
|
32
|
+
spec.add_development_dependency 'rspec', '~> 3.1'
|
30
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tty-table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.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: 2017-
|
11
|
+
date: 2017-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equatable
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.6.0
|
62
62
|
type: :runtime
|
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: 0.
|
68
|
+
version: 0.6.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: verse
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,6 +128,20 @@ dependencies:
|
|
128
128
|
- - ">="
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: rspec
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - "~>"
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '3.1'
|
138
|
+
type: :development
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - "~>"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '3.1'
|
131
145
|
description: A flexible and intuitive table generator
|
132
146
|
email:
|
133
147
|
- ''
|
@@ -159,7 +173,7 @@ files:
|
|
159
173
|
- lib/tty/table/border_dsl.rb
|
160
174
|
- lib/tty/table/border_options.rb
|
161
175
|
- lib/tty/table/column_constraint.rb
|
162
|
-
- lib/tty/table/
|
176
|
+
- lib/tty/table/columns.rb
|
163
177
|
- lib/tty/table/empty.rb
|
164
178
|
- lib/tty/table/error.rb
|
165
179
|
- lib/tty/table/field.rb
|
@@ -201,9 +215,9 @@ files:
|
|
201
215
|
- spec/unit/border_options/update_spec.rb
|
202
216
|
- spec/unit/column_constraint/enforce_spec.rb
|
203
217
|
- spec/unit/column_constraint/widths_spec.rb
|
204
|
-
- spec/unit/
|
205
|
-
- spec/unit/
|
206
|
-
- spec/unit/
|
218
|
+
- spec/unit/columns/extract_widths_spec.rb
|
219
|
+
- spec/unit/columns/total_width_spec.rb
|
220
|
+
- spec/unit/columns/widths_from_spec.rb
|
207
221
|
- spec/unit/data_spec.rb
|
208
222
|
- spec/unit/each_spec.rb
|
209
223
|
- spec/unit/each_with_index_spec.rb
|
@@ -299,7 +313,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
299
313
|
requirements:
|
300
314
|
- - ">="
|
301
315
|
- !ruby/object:Gem::Version
|
302
|
-
version:
|
316
|
+
version: 2.0.0
|
303
317
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
304
318
|
requirements:
|
305
319
|
- - ">="
|
@@ -329,9 +343,9 @@ test_files:
|
|
329
343
|
- spec/unit/border_options/update_spec.rb
|
330
344
|
- spec/unit/column_constraint/enforce_spec.rb
|
331
345
|
- spec/unit/column_constraint/widths_spec.rb
|
332
|
-
- spec/unit/
|
333
|
-
- spec/unit/
|
334
|
-
- spec/unit/
|
346
|
+
- spec/unit/columns/extract_widths_spec.rb
|
347
|
+
- spec/unit/columns/total_width_spec.rb
|
348
|
+
- spec/unit/columns/widths_from_spec.rb
|
335
349
|
- spec/unit/data_spec.rb
|
336
350
|
- spec/unit/each_spec.rb
|
337
351
|
- spec/unit/each_with_index_spec.rb
|