tabled 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/linters.yml +9 -8
- data/.gitignore +2 -1
- data/.rspec +2 -1
- data/.rubocop_todo.yml +7 -7
- data/CHANGELOG.md +4 -1
- data/Gemfile.lock +4 -59
- data/README.md +7 -0
- data/bin/tabled +32 -0
- data/lib/content_shaper.rb +5 -4
- data/lib/parsers/csv_parser.rb +10 -0
- data/lib/tabled.rb +0 -1
- data/tabled.gemspec +5 -4
- metadata +11 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6975cba3c924564332a058b0780101a7e469e25ca6143d9743bd19ea3e45c0c5
|
|
4
|
+
data.tar.gz: d3de8444e683807a3490f2c7fa34e5c0c3538054923036d2981659074e0bc31e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d161770b55f054132a064529a4eb4d420fb9172b8ccff788cba15b337f4110c22adde0ea2a26d36d05bacf99795de62a1e77bebf9b75919868cb04c77f83c194
|
|
7
|
+
data.tar.gz: 2481ed7691562b8f78a17a8cfa5de798787a76385f64d55d545574639a514af4e5ba7ee040893ea3a3b721f57547d2b9b196efec4c044f4edbe61a11672c0371
|
|
@@ -17,31 +17,32 @@ permissions:
|
|
|
17
17
|
contents: read
|
|
18
18
|
|
|
19
19
|
jobs:
|
|
20
|
+
|
|
20
21
|
linters:
|
|
21
|
-
runs-on: ubuntu-latest
|
|
22
22
|
strategy:
|
|
23
23
|
matrix:
|
|
24
24
|
ruby-version: ['3.0']
|
|
25
|
+
runs-on: ubuntu-latest
|
|
25
26
|
steps:
|
|
26
27
|
- uses: actions/checkout@v3
|
|
27
28
|
- name: Set up Ruby
|
|
28
|
-
uses: ruby/setup-ruby@
|
|
29
|
+
uses: ruby/setup-ruby@v1
|
|
29
30
|
with:
|
|
30
31
|
ruby-version: ${{ matrix.ruby-version }}
|
|
31
|
-
bundler-cache: true
|
|
32
|
-
|
|
33
|
-
run: bundle exec rubocop
|
|
32
|
+
bundler-cache: true
|
|
33
|
+
|
|
34
34
|
test:
|
|
35
|
-
runs-on:
|
|
35
|
+
runs-on: ${{ matrix.os }}
|
|
36
36
|
strategy:
|
|
37
37
|
matrix:
|
|
38
|
+
os: [ubuntu-latest, macos-latest]
|
|
38
39
|
ruby-version: ['2.6', '2.7', '3.0']
|
|
39
40
|
steps:
|
|
40
41
|
- uses: actions/checkout@v3
|
|
41
42
|
- name: Set up Ruby
|
|
42
|
-
uses: ruby/setup-ruby@
|
|
43
|
+
uses: ruby/setup-ruby@v1
|
|
43
44
|
with:
|
|
44
45
|
ruby-version: ${{ matrix.ruby-version }}
|
|
45
|
-
bundler-cache: true
|
|
46
|
+
bundler-cache: true
|
|
46
47
|
- name: Run tests
|
|
47
48
|
run: bundle exec rspec
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
--format documentation
|
|
1
|
+
--format documentation
|
|
2
|
+
--require spec_helper
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config --auto-gen-only-exclude`
|
|
3
|
-
# on 2022-
|
|
3
|
+
# on 2022-06-24 15:05:43 UTC using RuboCop version 1.29.1.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
@@ -29,14 +29,13 @@ Metrics/BlockLength:
|
|
|
29
29
|
- 'spec/framed/tabled_spec.rb'
|
|
30
30
|
- 'spec/non_framed/tabled_spec.rb'
|
|
31
31
|
|
|
32
|
-
# Offense count:
|
|
32
|
+
# Offense count: 1
|
|
33
33
|
# Configuration parameters: IgnoredMethods, Max.
|
|
34
34
|
Metrics/CyclomaticComplexity:
|
|
35
35
|
Exclude:
|
|
36
|
-
- 'lib/content_shaper.rb'
|
|
37
36
|
- 'lib/helpers.rb'
|
|
38
37
|
|
|
39
|
-
# Offense count:
|
|
38
|
+
# Offense count: 5
|
|
40
39
|
# Configuration parameters: CountComments, Max, CountAsOne, ExcludedMethods, IgnoredMethods.
|
|
41
40
|
Metrics/MethodLength:
|
|
42
41
|
Exclude:
|
|
@@ -44,11 +43,10 @@ Metrics/MethodLength:
|
|
|
44
43
|
- 'lib/helpers.rb'
|
|
45
44
|
- 'spec/factories/factory_data.rb'
|
|
46
45
|
|
|
47
|
-
# Offense count:
|
|
46
|
+
# Offense count: 1
|
|
48
47
|
# Configuration parameters: IgnoredMethods, Max.
|
|
49
48
|
Metrics/PerceivedComplexity:
|
|
50
49
|
Exclude:
|
|
51
|
-
- 'lib/content_shaper.rb'
|
|
52
50
|
- 'lib/helpers.rb'
|
|
53
51
|
|
|
54
52
|
# Offense count: 1
|
|
@@ -57,13 +55,15 @@ RSpec/ExampleLength:
|
|
|
57
55
|
Exclude:
|
|
58
56
|
- 'spec/framed/tabled_spec.rb'
|
|
59
57
|
|
|
60
|
-
# Offense count:
|
|
58
|
+
# Offense count: 9
|
|
61
59
|
# Configuration parameters: AllowedConstants.
|
|
62
60
|
Style/Documentation:
|
|
63
61
|
Exclude:
|
|
64
62
|
- 'spec/**/*'
|
|
65
63
|
- 'test/**/*'
|
|
64
|
+
- 'bin/tabled'
|
|
66
65
|
- 'lib/content_shaper.rb'
|
|
67
66
|
- 'lib/helpers.rb'
|
|
67
|
+
- 'lib/parsers/csv_parser.rb'
|
|
68
68
|
- 'lib/tabled.rb'
|
|
69
69
|
- 'lib/template.rb'
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
### Version 0.0.5 (September 04, 2023)
|
|
2
|
+
1. (Bug fix) Unnecessary dev gem reference removed
|
|
3
|
+
|
|
1
4
|
### Version 0.0.3 (May 23, 2022)
|
|
2
5
|
1. Printing titles of columns
|
|
3
6
|
2. Fixing layout (amount of spaces for row separators)
|
|
@@ -8,4 +11,4 @@
|
|
|
8
11
|
3. Adding row separator
|
|
9
12
|
|
|
10
13
|
### Version 0.0.1 (May 11, 2022)
|
|
11
|
-
1. Basic rendering tables to console
|
|
14
|
+
1. Basic rendering tables to console
|
data/Gemfile.lock
CHANGED
|
@@ -1,70 +1,20 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
tabled (0.0.
|
|
4
|
+
tabled (0.0.5)
|
|
5
|
+
dry-cli
|
|
5
6
|
|
|
6
7
|
GEM
|
|
7
8
|
remote: http://rubygems.org/
|
|
8
9
|
specs:
|
|
9
|
-
addressable (2.4.0)
|
|
10
10
|
ast (2.4.2)
|
|
11
|
-
builder (3.2.4)
|
|
12
|
-
byebug (11.1.3)
|
|
13
|
-
descendants_tracker (0.0.4)
|
|
14
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
|
15
11
|
diff-lcs (1.5.0)
|
|
16
12
|
docile (1.4.0)
|
|
17
|
-
|
|
18
|
-
multipart-post (>= 1.2, < 3)
|
|
19
|
-
git (1.11.0)
|
|
20
|
-
rchardet (~> 1.8)
|
|
21
|
-
github_api (0.16.0)
|
|
22
|
-
addressable (~> 2.4.0)
|
|
23
|
-
descendants_tracker (~> 0.0.4)
|
|
24
|
-
faraday (~> 0.8, < 0.10)
|
|
25
|
-
hashie (>= 3.4)
|
|
26
|
-
mime-types (>= 1.16, < 3.0)
|
|
27
|
-
oauth2 (~> 1.0)
|
|
28
|
-
hashie (5.0.0)
|
|
29
|
-
highline (2.0.3)
|
|
30
|
-
jeweler (2.3.9)
|
|
31
|
-
builder
|
|
32
|
-
bundler
|
|
33
|
-
git (>= 1.2.5)
|
|
34
|
-
github_api (~> 0.16.0)
|
|
35
|
-
highline (>= 1.6.15)
|
|
36
|
-
nokogiri (>= 1.5.10)
|
|
37
|
-
psych
|
|
38
|
-
rake
|
|
39
|
-
rdoc
|
|
40
|
-
semver2
|
|
41
|
-
jwt (2.3.0)
|
|
42
|
-
mime-types (2.99.3)
|
|
43
|
-
mini_portile2 (2.8.0)
|
|
44
|
-
multi_json (1.15.0)
|
|
45
|
-
multi_xml (0.6.0)
|
|
46
|
-
multipart-post (2.1.1)
|
|
47
|
-
nokogiri (1.13.6)
|
|
48
|
-
mini_portile2 (~> 2.8.0)
|
|
49
|
-
racc (~> 1.4)
|
|
50
|
-
oauth2 (1.4.8)
|
|
51
|
-
faraday (>= 0.8, < 3.0)
|
|
52
|
-
jwt (>= 1.0, < 3.0)
|
|
53
|
-
multi_json (~> 1.3)
|
|
54
|
-
multi_xml (~> 0.5)
|
|
55
|
-
rack (>= 1.2, < 3)
|
|
13
|
+
dry-cli (1.0.0)
|
|
56
14
|
parallel (1.22.1)
|
|
57
15
|
parser (3.1.2.0)
|
|
58
16
|
ast (~> 2.4.1)
|
|
59
|
-
psych (4.0.4)
|
|
60
|
-
stringio
|
|
61
|
-
racc (1.6.0)
|
|
62
|
-
rack (2.2.3)
|
|
63
17
|
rainbow (3.1.1)
|
|
64
|
-
rake (13.0.6)
|
|
65
|
-
rchardet (1.8.0)
|
|
66
|
-
rdoc (6.4.0)
|
|
67
|
-
psych (>= 4.0.0)
|
|
68
18
|
regexp_parser (2.4.0)
|
|
69
19
|
rexml (3.2.5)
|
|
70
20
|
rspec (3.11.0)
|
|
@@ -94,23 +44,18 @@ GEM
|
|
|
94
44
|
rubocop-rspec (2.10.0)
|
|
95
45
|
rubocop (~> 1.19)
|
|
96
46
|
ruby-progressbar (1.11.0)
|
|
97
|
-
semver2 (3.4.2)
|
|
98
47
|
simplecov (0.21.2)
|
|
99
48
|
docile (~> 1.1)
|
|
100
49
|
simplecov-html (~> 0.11)
|
|
101
50
|
simplecov_json_formatter (~> 0.1)
|
|
102
51
|
simplecov-html (0.12.3)
|
|
103
52
|
simplecov_json_formatter (0.1.4)
|
|
104
|
-
stringio (3.0.2)
|
|
105
|
-
thread_safe (0.3.6)
|
|
106
53
|
unicode-display_width (2.1.0)
|
|
107
54
|
|
|
108
55
|
PLATFORMS
|
|
109
56
|
ruby
|
|
110
57
|
|
|
111
58
|
DEPENDENCIES
|
|
112
|
-
byebug
|
|
113
|
-
jeweler
|
|
114
59
|
rspec
|
|
115
60
|
rubocop
|
|
116
61
|
rubocop-rspec
|
|
@@ -118,4 +63,4 @@ DEPENDENCIES
|
|
|
118
63
|
tabled!
|
|
119
64
|
|
|
120
65
|
BUNDLED WITH
|
|
121
|
-
2.
|
|
66
|
+
2.3.26
|
data/README.md
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
[](https://badge.fury.io/rb/tabled)  
|
|
2
3
|
|
|
3
4
|
|
|
@@ -58,6 +59,12 @@ Result
|
|
|
58
59
|
----------------------------------------------------------------
|
|
59
60
|
```
|
|
60
61
|
|
|
62
|
+
# Printing CSV files to console
|
|
63
|
+
As a part of the gem `tabled` binary is included. So, you can basicaly run it like:
|
|
64
|
+
```shell
|
|
65
|
+
tabled print path_to_csv_file
|
|
66
|
+
```
|
|
67
|
+
|
|
61
68
|
# Contributing
|
|
62
69
|
1. Fork it ( http://github.com/rukomoynikov/tabled/fork )
|
|
63
70
|
2. Create your feature branch (git checkout -b my-new-feature)
|
data/bin/tabled
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative '../lib/tabled'
|
|
5
|
+
require_relative '../lib/parsers/csv_parser'
|
|
6
|
+
require 'dry/cli'
|
|
7
|
+
require 'pathname'
|
|
8
|
+
|
|
9
|
+
module TabledCli
|
|
10
|
+
module CLI
|
|
11
|
+
module Commands
|
|
12
|
+
extend Dry::CLI::Registry
|
|
13
|
+
|
|
14
|
+
class Print < Dry::CLI::Command
|
|
15
|
+
desc 'Printing CSV to console'
|
|
16
|
+
|
|
17
|
+
argument :input, desc: 'Input file to print'
|
|
18
|
+
|
|
19
|
+
def call(input: nil, **)
|
|
20
|
+
return p 'File must be provided' if input.nil?
|
|
21
|
+
return p 'File doesn\'t exist' unless File.exist?(Pathname.new(input))
|
|
22
|
+
|
|
23
|
+
Tabled.new(Tabled::CSVParser.parse(Pathname.new(input))).print_to_console
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
register 'print', Print, aliases: ['p', '-p', '--print']
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
Dry::CLI.new(TabledCli::CLI::Commands).call
|
data/lib/content_shaper.rb
CHANGED
|
@@ -41,15 +41,16 @@ class Tabled
|
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
def add_left_and_right_borders(content)
|
|
44
|
+
return content unless options[:framed]
|
|
45
|
+
|
|
44
46
|
content.each_with_object([]) do |row, enumerator|
|
|
45
47
|
# For a row separator all symbols are the same
|
|
46
48
|
row_is_separator = row.chars.uniq.size == 1
|
|
47
|
-
|
|
49
|
+
|
|
50
|
+
enumerator << if row_is_separator && !options[:row_separator].nil?
|
|
48
51
|
(options[:row_separator] * 2) + row + options[:row_separator]
|
|
49
|
-
elsif !options[:framed]
|
|
50
|
-
row
|
|
51
52
|
else
|
|
52
|
-
|
|
53
|
+
"| #{row}|"
|
|
53
54
|
end
|
|
54
55
|
end
|
|
55
56
|
end
|
data/lib/tabled.rb
CHANGED
data/tabled.gemspec
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = 'tabled'
|
|
5
|
-
s.version = '0.0.
|
|
5
|
+
s.version = '0.0.5'
|
|
6
6
|
s.summary = 'Library for rendering pretty tables in console'
|
|
7
|
-
s.description =
|
|
7
|
+
s.description = 'Library can be used to render your data to a console. Being quite simple it has many features.'
|
|
8
8
|
s.authors = ['Max Rukomoynikov']
|
|
9
9
|
s.email = 'rukomoynikov@gmail.com'
|
|
10
|
+
s.executables << 'tabled'
|
|
10
11
|
s.files =
|
|
11
12
|
Dir.chdir(File.expand_path(__dir__)) do
|
|
12
13
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
|
@@ -16,8 +17,8 @@ Gem::Specification.new do |s|
|
|
|
16
17
|
'rubygems_mfa_required' => 'true' }
|
|
17
18
|
s.license = 'MIT'
|
|
18
19
|
|
|
19
|
-
s.
|
|
20
|
-
|
|
20
|
+
s.add_dependency 'dry-cli'
|
|
21
|
+
|
|
21
22
|
s.add_development_dependency 'rspec'
|
|
22
23
|
s.add_development_dependency 'rubocop'
|
|
23
24
|
s.add_development_dependency 'rubocop-rspec'
|
metadata
CHANGED
|
@@ -1,37 +1,23 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tabled
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Max Rukomoynikov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-09-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
14
|
+
name: dry-cli
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: '0'
|
|
20
|
-
type: :
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - ">="
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: '0'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: jeweler
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - ">="
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0'
|
|
34
|
-
type: :development
|
|
20
|
+
type: :runtime
|
|
35
21
|
prerelease: false
|
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
23
|
requirements:
|
|
@@ -94,10 +80,11 @@ dependencies:
|
|
|
94
80
|
- - ">="
|
|
95
81
|
- !ruby/object:Gem::Version
|
|
96
82
|
version: '0'
|
|
97
|
-
description: Library can be used to render your data to a console.
|
|
98
|
-
|
|
83
|
+
description: Library can be used to render your data to a console. Being quite simple
|
|
84
|
+
it has many features.
|
|
99
85
|
email: rukomoynikov@gmail.com
|
|
100
|
-
executables:
|
|
86
|
+
executables:
|
|
87
|
+
- tabled
|
|
101
88
|
extensions: []
|
|
102
89
|
extra_rdoc_files: []
|
|
103
90
|
files:
|
|
@@ -110,9 +97,11 @@ files:
|
|
|
110
97
|
- Gemfile
|
|
111
98
|
- Gemfile.lock
|
|
112
99
|
- README.md
|
|
100
|
+
- bin/tabled
|
|
113
101
|
- demo.rb
|
|
114
102
|
- lib/content_shaper.rb
|
|
115
103
|
- lib/helpers.rb
|
|
104
|
+
- lib/parsers/csv_parser.rb
|
|
116
105
|
- lib/tabled.rb
|
|
117
106
|
- lib/template.rb
|
|
118
107
|
- tabled.gemspec
|
|
@@ -137,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
137
126
|
- !ruby/object:Gem::Version
|
|
138
127
|
version: '0'
|
|
139
128
|
requirements: []
|
|
140
|
-
rubygems_version: 3.2.
|
|
129
|
+
rubygems_version: 3.2.33
|
|
141
130
|
signing_key:
|
|
142
131
|
specification_version: 4
|
|
143
132
|
summary: Library for rendering pretty tables in console
|