kosi 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -2
- data/CHANGELOG.md +7 -0
- data/README.md +19 -6
- data/kosi.gemspec +3 -3
- data/lib/kosi/version.rb +1 -1
- data/spec/kosi/align_spec.rb +1 -1
- data/spec/kosi/connector_char_spec.rb +2 -2
- data/spec/kosi/horizontal_border_char_spec.rb +2 -2
- data/spec/kosi/validators/each_array_length_validator_spec.rb +56 -56
- data/spec/kosi/validators/row_type_validator_spec.rb +51 -51
- data/spec/kosi/vertical_border_char_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -3
- metadata +28 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 277d63a0aa18baa0da5411fbf47b302f03690b90
|
4
|
+
data.tar.gz: 010c1b4a1c87f0102b3c60153874623a32bd62a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c39e6e7765c741de7efce0ae6d2655fdb97b18e0b31a2d7d261ff71ceb6445009d14b442a203891e49054b4b81c8883c1a4452a83431b2543e13c2aca702d725
|
7
|
+
data.tar.gz: a0703525fc854c47b0b0d28829c18a7b6d186348b099c28f23137a6c1c3c685646eb5b66ca02fd193d063bdd3a206b75ce2957ecc0980e084c43997de3ad8bfa
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,12 +1,27 @@
|
|
1
1
|
# Kosi
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/kosi.svg)](http://badge.fury.io/rb/kosi)
|
4
|
+
[![Gem Downloads](https://img.shields.io/gem/dt/kosi.svg)](http://badge.fury.io/rb/kosi)
|
4
5
|
[![Build Status](https://travis-ci.org/tbpgr/kosi.png?branch=master)](https://travis-ci.org/tbpgr/kosi)
|
5
6
|
[![Coverage Status](https://coveralls.io/repos/tbpgr/kosi/badge.png)](https://coveralls.io/r/tbpgr/kosi)
|
6
7
|
[![Code Climate](https://codeclimate.com/github/tbpgr/kosi.png)](https://codeclimate.com/github/tbpgr/kosi)
|
7
8
|
|
8
9
|
ターミナルアプリケーション用表フォーマットサポートツール。格子。
|
9
10
|
|
11
|
+
## :notes: Images
|
12
|
+
### :baby_chick: Before
|
13
|
+
|
14
|
+
:rage1::rage1::rage1:,:alien:,:older_woman::older_woman:
|
15
|
+
:older_man:,:dog:,:baby::baby::baby::baby::baby::baby::baby:
|
16
|
+
:cat::cat:,:octocat::octocat::octocat::octocat::octocat::octocat::octocat:,:octopus::octopus::octopus::octopus::octopus:
|
17
|
+
|
18
|
+
### :chicken: After
|
19
|
+
+----------+--------------------------+--------------------------+
|
20
|
+
|:rage1::rage1::rage1:|:alien::grey_question::grey_question::grey_question::grey_question::grey_question::grey_question:|:older_woman::older_woman::grey_question::grey_question::grey_question::grey_question::grey_question:|
|
21
|
+
|:older_man::grey_question::grey_question:|:dog::grey_question::grey_question::grey_question::grey_question::grey_question::grey_question:|:baby::baby::baby::baby::baby::baby::baby:|
|
22
|
+
|:cat::cat::grey_question:|:octocat::octocat::octocat::octocat::octocat::octocat::octocat:|:octopus::octopus::octopus::octopus::octopus::grey_question::grey_question:|
|
23
|
+
+----------+--------------------------+--------------------------+
|
24
|
+
|
10
25
|
## :cloud::arrow_down: Installation
|
11
26
|
|
12
27
|
Add this line to your application's Gemfile:
|
@@ -26,12 +41,6 @@ Or install it yourself as:
|
|
26
41
|
:link: [terminal-table gem](https://github.com/tj/terminal-table) の日本語対応版にあたります。
|
27
42
|
(terminal-tableはASCII対応のみなので全角文字が混ざるとテーブルレイアウトが崩れる)
|
28
43
|
|
29
|
-
具体的には
|
30
|
-
|
31
|
-
* Unicode 1-127 => ASCII。1文字分として計算
|
32
|
-
* Unicode 65377(0xff61)..65439(0xff9f) => 半角カナ。1文字分として計算
|
33
|
-
* その他 => 全角として扱う。2文字分として計算
|
34
|
-
|
35
44
|
## :o2: Options
|
36
45
|
### :icecream: Align
|
37
46
|
配置指定。右寄せ、左寄せ、中央を選択可能。
|
@@ -278,6 +287,10 @@ x*******x*******x*******x
|
|
278
287
|
x*******x*******x*******x
|
279
288
|
~~~
|
280
289
|
|
290
|
+
## :memo: 注意事項
|
291
|
+
* gem のバージョンが 2.0.1 以下だと unicode gem でエラーが発生するケースがあるようです。
|
292
|
+
その場合は gem を 2.0.2 以上に Update してください。
|
293
|
+
|
281
294
|
## :two_men_holding_hands: Contributing :two_women_holding_hands:
|
282
295
|
|
283
296
|
1. Fork it ( https://github.com/tbpgr/kosi/fork )
|
data/kosi.gemspec
CHANGED
@@ -20,9 +20,9 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_runtime_dependency 'unicode', '>= 0.4.4'
|
22
22
|
|
23
|
-
spec.add_development_dependency 'bundler', '~> 1.3'
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.15.3'
|
24
24
|
spec.add_development_dependency 'rake'
|
25
|
-
spec.add_development_dependency 'rspec', '~>
|
26
|
-
spec.add_development_dependency 'simplecov', '~> 0.
|
25
|
+
spec.add_development_dependency 'rspec', '~> 3.6.0'
|
26
|
+
spec.add_development_dependency 'simplecov', '~> 0.14.1'
|
27
27
|
spec.add_development_dependency 'coveralls'
|
28
28
|
end
|
data/lib/kosi/version.rb
CHANGED
data/spec/kosi/align_spec.rb
CHANGED
@@ -31,8 +31,8 @@ describe Kosi::ConnectorChar do
|
|
31
31
|
|
32
32
|
# -- given --
|
33
33
|
if c[:expect_error]
|
34
|
-
|
35
|
-
|
34
|
+
expect { Kosi::ConnectorChar.new(c[:options]) }
|
35
|
+
.to raise_error(ArgumentError)
|
36
36
|
next
|
37
37
|
end
|
38
38
|
connector_char = Kosi::ConnectorChar.new(c[:options])
|
@@ -31,8 +31,8 @@ describe Kosi::HorizontalBorderChar do
|
|
31
31
|
|
32
32
|
# -- given --
|
33
33
|
if c[:expect_error]
|
34
|
-
|
35
|
-
|
34
|
+
expect { Kosi::HorizontalBorderChar.new(c[:options]) }
|
35
|
+
.to raise_error(ArgumentError)
|
36
36
|
next
|
37
37
|
end
|
38
38
|
horizontal_border_char = Kosi::HorizontalBorderChar.new(c[:options])
|
@@ -1,56 +1,56 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'kosi/validators/each_array_length_validator'
|
4
|
-
|
5
|
-
describe Kosi::Validators::EachArrayLength do
|
6
|
-
context :validate do
|
7
|
-
cases = [
|
8
|
-
{
|
9
|
-
case_no: 1,
|
10
|
-
case_title: 'Same Length Array case',
|
11
|
-
inputs: [[*1..5], [*6..10]],
|
12
|
-
},
|
13
|
-
{
|
14
|
-
case_no: 2,
|
15
|
-
case_title: 'Zero Length Array case',
|
16
|
-
inputs: [[], []],
|
17
|
-
},
|
18
|
-
{
|
19
|
-
case_no: 3,
|
20
|
-
case_title: 'Different Length Array case',
|
21
|
-
inputs: [[*1..5], [*6..11]],
|
22
|
-
expect_error: true,
|
23
|
-
error_class: ArgumentError
|
24
|
-
},
|
25
|
-
]
|
26
|
-
|
27
|
-
cases.each do |c|
|
28
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
29
|
-
begin
|
30
|
-
case_before c
|
31
|
-
|
32
|
-
# -- given --
|
33
|
-
# nothing
|
34
|
-
|
35
|
-
# -- when/then --
|
36
|
-
if c[:expect_error]
|
37
|
-
expect { Kosi::Validators::EachArrayLength.validate(c[:inputs]) }.to raise_error(c[:error_class])
|
38
|
-
next
|
39
|
-
else
|
40
|
-
expect { Kosi::Validators::EachArrayLength.validate(c[:inputs]) }.not_to raise_error
|
41
|
-
end
|
42
|
-
ensure
|
43
|
-
case_after c
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def case_before(c)
|
48
|
-
# implement each case before
|
49
|
-
end
|
50
|
-
|
51
|
-
def case_after(c)
|
52
|
-
# implement each case after
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'kosi/validators/each_array_length_validator'
|
4
|
+
|
5
|
+
describe Kosi::Validators::EachArrayLength do
|
6
|
+
context :validate do
|
7
|
+
cases = [
|
8
|
+
{
|
9
|
+
case_no: 1,
|
10
|
+
case_title: 'Same Length Array case',
|
11
|
+
inputs: [[*1..5], [*6..10]],
|
12
|
+
},
|
13
|
+
{
|
14
|
+
case_no: 2,
|
15
|
+
case_title: 'Zero Length Array case',
|
16
|
+
inputs: [[], []],
|
17
|
+
},
|
18
|
+
{
|
19
|
+
case_no: 3,
|
20
|
+
case_title: 'Different Length Array case',
|
21
|
+
inputs: [[*1..5], [*6..11]],
|
22
|
+
expect_error: true,
|
23
|
+
error_class: ArgumentError
|
24
|
+
},
|
25
|
+
]
|
26
|
+
|
27
|
+
cases.each do |c|
|
28
|
+
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
29
|
+
begin
|
30
|
+
case_before c
|
31
|
+
|
32
|
+
# -- given --
|
33
|
+
# nothing
|
34
|
+
|
35
|
+
# -- when/then --
|
36
|
+
if c[:expect_error]
|
37
|
+
expect { Kosi::Validators::EachArrayLength.validate(c[:inputs]) }.to raise_error(c[:error_class])
|
38
|
+
next
|
39
|
+
else
|
40
|
+
expect { Kosi::Validators::EachArrayLength.validate(c[:inputs]) }.not_to raise_error
|
41
|
+
end
|
42
|
+
ensure
|
43
|
+
case_after c
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def case_before(c)
|
48
|
+
# implement each case before
|
49
|
+
end
|
50
|
+
|
51
|
+
def case_after(c)
|
52
|
+
# implement each case after
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -1,51 +1,51 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'kosi/validators/row_type_validator'
|
4
|
-
|
5
|
-
describe Kosi::Validators::RowType do
|
6
|
-
context :validate do
|
7
|
-
cases = [
|
8
|
-
{
|
9
|
-
case_no: 1,
|
10
|
-
case_title: 'Array case',
|
11
|
-
inputs: ['Array'],
|
12
|
-
},
|
13
|
-
{
|
14
|
-
case_no: 2,
|
15
|
-
case_title: 'Not Array case',
|
16
|
-
inputs: 'not Array',
|
17
|
-
expect_error: true,
|
18
|
-
error_class: ArgumentError
|
19
|
-
},
|
20
|
-
]
|
21
|
-
|
22
|
-
cases.each do |c|
|
23
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
24
|
-
begin
|
25
|
-
case_before c
|
26
|
-
|
27
|
-
# -- given --
|
28
|
-
# nothing
|
29
|
-
|
30
|
-
# -- when/then --
|
31
|
-
if c[:expect_error]
|
32
|
-
expect { Kosi::Validators::RowType.validate(c[:inputs]) }.to raise_error(c[:error_class])
|
33
|
-
next
|
34
|
-
else
|
35
|
-
expect { Kosi::Validators::RowType.validate(c[:inputs]) }.not_to raise_error
|
36
|
-
end
|
37
|
-
ensure
|
38
|
-
case_after c
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def case_before(c)
|
43
|
-
# implement each case before
|
44
|
-
end
|
45
|
-
|
46
|
-
def case_after(c)
|
47
|
-
# implement each case after
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'kosi/validators/row_type_validator'
|
4
|
+
|
5
|
+
describe Kosi::Validators::RowType do
|
6
|
+
context :validate do
|
7
|
+
cases = [
|
8
|
+
{
|
9
|
+
case_no: 1,
|
10
|
+
case_title: 'Array case',
|
11
|
+
inputs: ['Array'],
|
12
|
+
},
|
13
|
+
{
|
14
|
+
case_no: 2,
|
15
|
+
case_title: 'Not Array case',
|
16
|
+
inputs: 'not Array',
|
17
|
+
expect_error: true,
|
18
|
+
error_class: ArgumentError
|
19
|
+
},
|
20
|
+
]
|
21
|
+
|
22
|
+
cases.each do |c|
|
23
|
+
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
24
|
+
begin
|
25
|
+
case_before c
|
26
|
+
|
27
|
+
# -- given --
|
28
|
+
# nothing
|
29
|
+
|
30
|
+
# -- when/then --
|
31
|
+
if c[:expect_error]
|
32
|
+
expect { Kosi::Validators::RowType.validate(c[:inputs]) }.to raise_error(c[:error_class])
|
33
|
+
next
|
34
|
+
else
|
35
|
+
expect { Kosi::Validators::RowType.validate(c[:inputs]) }.not_to raise_error
|
36
|
+
end
|
37
|
+
ensure
|
38
|
+
case_after c
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def case_before(c)
|
43
|
+
# implement each case before
|
44
|
+
end
|
45
|
+
|
46
|
+
def case_after(c)
|
47
|
+
# implement each case after
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -31,8 +31,8 @@ describe Kosi::VerticalBorderChar do
|
|
31
31
|
|
32
32
|
# -- given --
|
33
33
|
if c[:expect_error]
|
34
|
-
|
35
|
-
|
34
|
+
expect { Kosi::VerticalBorderChar.new(c[:options]) }
|
35
|
+
.to raise_error(ArgumentError)
|
36
36
|
next
|
37
37
|
end
|
38
38
|
vertical_border_char = Kosi::VerticalBorderChar.new(c[:options])
|
data/spec/spec_helper.rb
CHANGED
@@ -2,15 +2,14 @@
|
|
2
2
|
require 'simplecov'
|
3
3
|
require 'coveralls'
|
4
4
|
Coveralls.wear!
|
5
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
5
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
|
6
6
|
SimpleCov::Formatter::HTMLFormatter,
|
7
7
|
Coveralls::SimpleCov::Formatter
|
8
|
-
]
|
8
|
+
])
|
9
9
|
SimpleCov.start do
|
10
10
|
add_filter '/spec/'
|
11
11
|
end
|
12
12
|
RSpec.configure do |config|
|
13
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
14
13
|
config.run_all_when_everything_filtered = true
|
15
14
|
config.filter_run :focus
|
16
15
|
end
|
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kosi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tbpgr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unicode
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.4.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.4.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.15.3
|
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:
|
40
|
+
version: 1.15.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 3.6.0
|
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:
|
68
|
+
version: 3.6.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: simplecov
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.14.1
|
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: 0.
|
82
|
+
version: 0.14.1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: coveralls
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
description: terminal table format for japanese
|
@@ -101,11 +101,11 @@ executables: []
|
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
-
- .coveralls.yml
|
105
|
-
- .gitignore
|
106
|
-
- .rspec
|
107
|
-
- .rubocop.yml
|
108
|
-
- .travis.yml
|
104
|
+
- ".coveralls.yml"
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rspec"
|
107
|
+
- ".rubocop.yml"
|
108
|
+
- ".travis.yml"
|
109
109
|
- CHANGELOG.md
|
110
110
|
- Gemfile
|
111
111
|
- LICENSE.txt
|
@@ -146,17 +146,17 @@ require_paths:
|
|
146
146
|
- lib
|
147
147
|
required_ruby_version: !ruby/object:Gem::Requirement
|
148
148
|
requirements:
|
149
|
-
- -
|
149
|
+
- - ">="
|
150
150
|
- !ruby/object:Gem::Version
|
151
151
|
version: '0'
|
152
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
153
|
requirements:
|
154
|
-
- -
|
154
|
+
- - ">="
|
155
155
|
- !ruby/object:Gem::Version
|
156
156
|
version: '0'
|
157
157
|
requirements: []
|
158
158
|
rubyforge_project:
|
159
|
-
rubygems_version: 2.
|
159
|
+
rubygems_version: 2.6.8
|
160
160
|
signing_key:
|
161
161
|
specification_version: 4
|
162
162
|
summary: terminal table format for japanese
|
@@ -171,4 +171,3 @@ test_files:
|
|
171
171
|
- spec/kosi/vertical_border_char_spec.rb
|
172
172
|
- spec/spec_helper.rb
|
173
173
|
- spec/table_spec.rb
|
174
|
-
has_rdoc:
|