tabled 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.rspec +2 -1
- data/.rubocop_todo.yml +7 -7
- data/Gemfile.lock +3 -56
- 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/tabled.gemspec +5 -3
- metadata +12 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82a764f542f7d1d83f41e21d66e3e4407e0add51f3c78d56998804061c7a53f5
|
4
|
+
data.tar.gz: d50b8c1c7b9f015599c9eaffba00bcefac673e4f7271499cd50c3f600b249512
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73f29421ca05bd0ef6557ecabb1b01e83608d80ff6ad21ab6ccdf1a7a2c1938f223ee9def3efb4df9cd2935d1c5eabb0bd8fd0c8e22f9033606ad3f55ead540c
|
7
|
+
data.tar.gz: 492de196716a4c3d39d789780b2f216474cb7de4e06da59125aed7eda50b1064e7bd1102c0dca8b066045501d0df4e0a531956e13035e3b6de02c2de32c931eb
|
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/Gemfile.lock
CHANGED
@@ -1,70 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tabled (0.0.
|
4
|
+
tabled (0.0.4)
|
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
11
|
byebug (11.1.3)
|
13
|
-
descendants_tracker (0.0.4)
|
14
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
15
12
|
diff-lcs (1.5.0)
|
16
13
|
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)
|
14
|
+
dry-cli (0.7.0)
|
56
15
|
parallel (1.22.1)
|
57
16
|
parser (3.1.2.0)
|
58
17
|
ast (~> 2.4.1)
|
59
|
-
psych (4.0.4)
|
60
|
-
stringio
|
61
|
-
racc (1.6.0)
|
62
|
-
rack (2.2.3)
|
63
18
|
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
19
|
regexp_parser (2.4.0)
|
69
20
|
rexml (3.2.5)
|
70
21
|
rspec (3.11.0)
|
@@ -94,15 +45,12 @@ GEM
|
|
94
45
|
rubocop-rspec (2.10.0)
|
95
46
|
rubocop (~> 1.19)
|
96
47
|
ruby-progressbar (1.11.0)
|
97
|
-
semver2 (3.4.2)
|
98
48
|
simplecov (0.21.2)
|
99
49
|
docile (~> 1.1)
|
100
50
|
simplecov-html (~> 0.11)
|
101
51
|
simplecov_json_formatter (~> 0.1)
|
102
52
|
simplecov-html (0.12.3)
|
103
53
|
simplecov_json_formatter (0.1.4)
|
104
|
-
stringio (3.0.2)
|
105
|
-
thread_safe (0.3.6)
|
106
54
|
unicode-display_width (2.1.0)
|
107
55
|
|
108
56
|
PLATFORMS
|
@@ -110,7 +58,6 @@ PLATFORMS
|
|
110
58
|
|
111
59
|
DEPENDENCIES
|
112
60
|
byebug
|
113
|
-
jeweler
|
114
61
|
rspec
|
115
62
|
rubocop
|
116
63
|
rubocop-rspec
|
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
[![Gem Version](https://badge.fury.io/rb/tabled.svg)](https://badge.fury.io/rb/tabled) ![CI is pasing for ruby 2.6 - 3.0](https://github.com/rukomoynikov/tabled/actions/workflows/linters.yml/badge.svg) ![Downloads](https://badgen.net/rubygems/dt/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/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.4'
|
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,9 @@ Gem::Specification.new do |s|
|
|
16
17
|
'rubygems_mfa_required' => 'true' }
|
17
18
|
s.license = 'MIT'
|
18
19
|
|
20
|
+
s.add_dependency 'dry-cli'
|
21
|
+
|
19
22
|
s.add_development_dependency 'byebug'
|
20
|
-
s.add_development_dependency 'jeweler'
|
21
23
|
s.add_development_dependency 'rspec'
|
22
24
|
s.add_development_dependency 'rubocop'
|
23
25
|
s.add_development_dependency 'rubocop-rspec'
|
metadata
CHANGED
@@ -1,23 +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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Rukomoynikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-24 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: :
|
20
|
+
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: byebug
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -94,10 +94,11 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
description: Library can be used to render your data to a console.
|
98
|
-
|
97
|
+
description: Library can be used to render your data to a console. Being quite simple
|
98
|
+
it has many features.
|
99
99
|
email: rukomoynikov@gmail.com
|
100
|
-
executables:
|
100
|
+
executables:
|
101
|
+
- tabled
|
101
102
|
extensions: []
|
102
103
|
extra_rdoc_files: []
|
103
104
|
files:
|
@@ -110,9 +111,11 @@ files:
|
|
110
111
|
- Gemfile
|
111
112
|
- Gemfile.lock
|
112
113
|
- README.md
|
114
|
+
- bin/tabled
|
113
115
|
- demo.rb
|
114
116
|
- lib/content_shaper.rb
|
115
117
|
- lib/helpers.rb
|
118
|
+
- lib/parsers/csv_parser.rb
|
116
119
|
- lib/tabled.rb
|
117
120
|
- lib/template.rb
|
118
121
|
- tabled.gemspec
|
@@ -137,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
140
|
- !ruby/object:Gem::Version
|
138
141
|
version: '0'
|
139
142
|
requirements: []
|
140
|
-
rubygems_version: 3.
|
143
|
+
rubygems_version: 3.1.6
|
141
144
|
signing_key:
|
142
145
|
specification_version: 4
|
143
146
|
summary: Library for rendering pretty tables in console
|