lite-report 1.0.1 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +14 -3
- data/.travis.yml +1 -0
- data/CHANGELOG.md +20 -0
- data/Gemfile.lock +94 -83
- data/lib/lite/report/array.rb +1 -1
- data/lib/lite/report/configuration.rb +15 -9
- data/lib/lite/report/hash.rb +1 -1
- data/lib/lite/report/helpers/encoders.rb +8 -1
- data/lib/lite/report/helpers/records.rb +1 -1
- data/lib/lite/report/helpers/transporters.rb +2 -2
- data/lib/lite/report/record.rb +2 -1
- data/lib/lite/report/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b94708f3ef60f8780c0444e9ea75767073b8c6e93ca3ec2259d3d9fab20f4e3f
|
4
|
+
data.tar.gz: c47f0fcc4a55fd85b52d479fab6b79f66c49ef7644fbd2eca93e1638142e2437
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec0aaa4561df1d5ed44c48897aefc7580769936e6ece768679321c8208d43b1def9308982e9f3320b040bed9d2a98c5641ae8e381524c2b1a8d7c3e7a7b1eda4
|
7
|
+
data.tar.gz: 278459ea22c634e0e38222af6b55031a4d02ed7831eb1f67ac625a136ee88e4e9543990c6b67266451e4f22928a29e76df81f4b4ca28c1a1f621ed9f1adbc9b7
|
data/.rubocop.yml
CHANGED
@@ -2,11 +2,14 @@ require:
|
|
2
2
|
- rubocop-performance
|
3
3
|
- rubocop-rspec
|
4
4
|
AllCops:
|
5
|
-
TargetRubyVersion: 2.
|
5
|
+
TargetRubyVersion: 2.7
|
6
|
+
NewCops: enable
|
6
7
|
DisplayCopNames: true
|
7
8
|
DisplayStyleGuide: true
|
8
|
-
|
9
|
-
|
9
|
+
Gemspec/RequiredRubyVersion:
|
10
|
+
Enabled: false
|
11
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
12
|
+
Enabled: true
|
10
13
|
Layout/EmptyLinesAroundBlockBody:
|
11
14
|
Exclude:
|
12
15
|
- 'spec/**/**/*'
|
@@ -14,6 +17,14 @@ Layout/EmptyLinesAroundClassBody:
|
|
14
17
|
EnforcedStyle: empty_lines_except_namespace
|
15
18
|
Layout/EmptyLinesAroundModuleBody:
|
16
19
|
EnforcedStyle: empty_lines_except_namespace
|
20
|
+
Layout/LineLength:
|
21
|
+
Max: 100
|
22
|
+
Layout/SpaceAroundMethodCallOperator:
|
23
|
+
Enabled: true
|
24
|
+
Lint/RaiseException:
|
25
|
+
Enabled: true
|
26
|
+
Lint/StructNewOverride:
|
27
|
+
Enabled: true
|
17
28
|
Metrics/BlockLength:
|
18
29
|
Exclude:
|
19
30
|
- 'spec/**/**/*'
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [1.0.6] - 2020-10-10
|
10
|
+
### Added
|
11
|
+
- Added improved Ruby 2.7 support
|
12
|
+
|
13
|
+
## [1.0.5] - 2020-07-03
|
14
|
+
### Added
|
15
|
+
- Added Ruby 2.7 support
|
16
|
+
|
17
|
+
## [1.0.4] - 2020-02-11
|
18
|
+
### Changed
|
19
|
+
- Fix record instance not generating
|
20
|
+
|
21
|
+
## [1.0.3] - 2019-08-24
|
22
|
+
### Changed
|
23
|
+
- Fix broken configuration option
|
24
|
+
|
25
|
+
## [1.0.2] - 2019-08-24
|
26
|
+
### Changed
|
27
|
+
- Improved how configuration works
|
28
|
+
|
9
29
|
## [1.0.1] - 2019-08-15
|
10
30
|
### Changed
|
11
31
|
- Underscore initializer file name
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lite-report (1.0.
|
4
|
+
lite-report (1.0.6)
|
5
5
|
activerecord
|
6
6
|
activerecord-import
|
7
7
|
deep_pluck
|
@@ -9,129 +9,140 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
actionpack (
|
13
|
-
actionview (=
|
14
|
-
activesupport (=
|
15
|
-
rack (~> 2.0)
|
12
|
+
actionpack (6.0.3.4)
|
13
|
+
actionview (= 6.0.3.4)
|
14
|
+
activesupport (= 6.0.3.4)
|
15
|
+
rack (~> 2.0, >= 2.0.8)
|
16
16
|
rack-test (>= 0.6.3)
|
17
17
|
rails-dom-testing (~> 2.0)
|
18
|
-
rails-html-sanitizer (~> 1.0, >= 1.0
|
19
|
-
actionview (
|
20
|
-
activesupport (=
|
18
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
19
|
+
actionview (6.0.3.4)
|
20
|
+
activesupport (= 6.0.3.4)
|
21
21
|
builder (~> 3.1)
|
22
22
|
erubi (~> 1.4)
|
23
23
|
rails-dom-testing (~> 2.0)
|
24
|
-
rails-html-sanitizer (~> 1.
|
25
|
-
activemodel (
|
26
|
-
activesupport (=
|
27
|
-
activerecord (
|
28
|
-
activemodel (=
|
29
|
-
activesupport (=
|
30
|
-
|
31
|
-
activerecord-import (1.0.2)
|
24
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
25
|
+
activemodel (6.0.3.4)
|
26
|
+
activesupport (= 6.0.3.4)
|
27
|
+
activerecord (6.0.3.4)
|
28
|
+
activemodel (= 6.0.3.4)
|
29
|
+
activesupport (= 6.0.3.4)
|
30
|
+
activerecord-import (1.0.6)
|
32
31
|
activerecord (>= 3.2)
|
33
|
-
activesupport (
|
32
|
+
activesupport (6.0.3.4)
|
34
33
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
35
34
|
i18n (>= 0.7, < 2)
|
36
35
|
minitest (~> 5.1)
|
37
36
|
tzinfo (~> 1.1)
|
38
|
-
|
39
|
-
ast (2.4.
|
40
|
-
builder (3.2.
|
37
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
38
|
+
ast (2.4.1)
|
39
|
+
builder (3.2.4)
|
41
40
|
colorize (0.8.1)
|
42
|
-
concurrent-ruby (1.1.
|
43
|
-
crass (1.0.
|
44
|
-
database_cleaner (1.
|
45
|
-
deep_pluck (1.1.
|
41
|
+
concurrent-ruby (1.1.7)
|
42
|
+
crass (1.0.6)
|
43
|
+
database_cleaner (1.8.5)
|
44
|
+
deep_pluck (1.1.4)
|
46
45
|
activerecord (>= 3)
|
47
46
|
pluck_all (>= 1.2.3)
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
rails_compatibility (>= 0.0.1)
|
48
|
+
diff-lcs (1.4.4)
|
49
|
+
erubi (1.9.0)
|
50
|
+
fasterer (0.8.3)
|
51
51
|
colorize (~> 0.7)
|
52
|
-
ruby_parser (>= 3.
|
52
|
+
ruby_parser (>= 3.14.1)
|
53
53
|
generator_spec (0.9.4)
|
54
54
|
activesupport (>= 3.0.0)
|
55
55
|
railties (>= 3.0.0)
|
56
|
-
i18n (1.
|
56
|
+
i18n (1.8.5)
|
57
57
|
concurrent-ruby (~> 1.0)
|
58
|
-
|
59
|
-
loofah (2.2.3)
|
58
|
+
loofah (2.7.0)
|
60
59
|
crass (~> 1.0.2)
|
61
60
|
nokogiri (>= 1.5.9)
|
62
|
-
method_source (0.
|
61
|
+
method_source (1.0.0)
|
63
62
|
mini_portile2 (2.4.0)
|
64
|
-
minitest (5.
|
65
|
-
nokogiri (1.10.
|
63
|
+
minitest (5.14.2)
|
64
|
+
nokogiri (1.10.10)
|
66
65
|
mini_portile2 (~> 2.4.0)
|
67
|
-
parallel (1.
|
68
|
-
parser (2.
|
69
|
-
ast (~> 2.4.
|
66
|
+
parallel (1.19.2)
|
67
|
+
parser (2.7.2.0)
|
68
|
+
ast (~> 2.4.1)
|
70
69
|
pluck_all (2.0.4)
|
71
70
|
activesupport (>= 3.0.0)
|
72
|
-
|
71
|
+
polyamorous (2.3.2)
|
72
|
+
activerecord (>= 5.2.1)
|
73
|
+
rack (2.2.3)
|
73
74
|
rack-test (1.1.0)
|
74
75
|
rack (>= 1.0, < 3)
|
75
76
|
rails-dom-testing (2.0.3)
|
76
77
|
activesupport (>= 4.2.0)
|
77
78
|
nokogiri (>= 1.6)
|
78
|
-
rails-html-sanitizer (1.
|
79
|
-
loofah (~> 2.
|
80
|
-
|
81
|
-
|
82
|
-
|
79
|
+
rails-html-sanitizer (1.3.0)
|
80
|
+
loofah (~> 2.3)
|
81
|
+
rails_compatibility (0.0.2)
|
82
|
+
activerecord (>= 3)
|
83
|
+
railties (6.0.3.4)
|
84
|
+
actionpack (= 6.0.3.4)
|
85
|
+
activesupport (= 6.0.3.4)
|
83
86
|
method_source
|
84
87
|
rake (>= 0.8.7)
|
85
|
-
thor (>= 0.
|
88
|
+
thor (>= 0.20.3, < 2.0)
|
86
89
|
rainbow (3.0.0)
|
87
|
-
rake (
|
88
|
-
ransack (2.
|
89
|
-
|
90
|
-
|
91
|
-
activesupport (>= 5.0)
|
90
|
+
rake (13.0.1)
|
91
|
+
ransack (2.3.2)
|
92
|
+
activerecord (>= 5.2.1)
|
93
|
+
activesupport (>= 5.2.1)
|
92
94
|
i18n
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
rspec-
|
99
|
-
|
95
|
+
polyamorous (= 2.3.2)
|
96
|
+
regexp_parser (1.8.1)
|
97
|
+
rexml (3.2.4)
|
98
|
+
rspec (3.9.0)
|
99
|
+
rspec-core (~> 3.9.0)
|
100
|
+
rspec-expectations (~> 3.9.0)
|
101
|
+
rspec-mocks (~> 3.9.0)
|
102
|
+
rspec-core (3.9.3)
|
103
|
+
rspec-support (~> 3.9.3)
|
104
|
+
rspec-expectations (3.9.2)
|
100
105
|
diff-lcs (>= 1.2.0, < 2.0)
|
101
|
-
rspec-support (~> 3.
|
102
|
-
rspec-mocks (3.
|
106
|
+
rspec-support (~> 3.9.0)
|
107
|
+
rspec-mocks (3.9.1)
|
103
108
|
diff-lcs (>= 1.2.0, < 2.0)
|
104
|
-
rspec-support (~> 3.
|
105
|
-
rspec-rails (
|
106
|
-
actionpack (>=
|
107
|
-
activesupport (>=
|
108
|
-
railties (>=
|
109
|
-
rspec-core (~> 3.
|
110
|
-
rspec-expectations (~> 3.
|
111
|
-
rspec-mocks (~> 3.
|
112
|
-
rspec-support (~> 3.
|
113
|
-
rspec-support (3.
|
114
|
-
rubocop (0.
|
115
|
-
jaro_winkler (~> 1.5.1)
|
109
|
+
rspec-support (~> 3.9.0)
|
110
|
+
rspec-rails (4.0.1)
|
111
|
+
actionpack (>= 4.2)
|
112
|
+
activesupport (>= 4.2)
|
113
|
+
railties (>= 4.2)
|
114
|
+
rspec-core (~> 3.9)
|
115
|
+
rspec-expectations (~> 3.9)
|
116
|
+
rspec-mocks (~> 3.9)
|
117
|
+
rspec-support (~> 3.9)
|
118
|
+
rspec-support (3.9.3)
|
119
|
+
rubocop (0.93.0)
|
116
120
|
parallel (~> 1.10)
|
117
|
-
parser (>= 2.
|
121
|
+
parser (>= 2.7.1.5)
|
118
122
|
rainbow (>= 2.2.2, < 4.0)
|
123
|
+
regexp_parser (>= 1.8)
|
124
|
+
rexml
|
125
|
+
rubocop-ast (>= 0.6.0)
|
119
126
|
ruby-progressbar (~> 1.7)
|
120
|
-
unicode-display_width (>= 1.4.0, <
|
121
|
-
rubocop-
|
122
|
-
|
123
|
-
rubocop-
|
124
|
-
rubocop (>= 0.
|
127
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
128
|
+
rubocop-ast (0.7.1)
|
129
|
+
parser (>= 2.7.1.5)
|
130
|
+
rubocop-performance (1.8.1)
|
131
|
+
rubocop (>= 0.87.0)
|
132
|
+
rubocop-ast (>= 0.4.0)
|
133
|
+
rubocop-rspec (1.43.2)
|
134
|
+
rubocop (~> 0.87)
|
125
135
|
ruby-progressbar (1.10.1)
|
126
|
-
ruby_parser (3.
|
136
|
+
ruby_parser (3.15.0)
|
127
137
|
sexp_processor (~> 4.9)
|
128
|
-
sexp_processor (4.
|
129
|
-
sqlite3 (1.4.
|
130
|
-
thor (0.
|
138
|
+
sexp_processor (4.15.1)
|
139
|
+
sqlite3 (1.4.2)
|
140
|
+
thor (1.0.1)
|
131
141
|
thread_safe (0.3.6)
|
132
|
-
tzinfo (1.2.
|
142
|
+
tzinfo (1.2.7)
|
133
143
|
thread_safe (~> 0.1)
|
134
|
-
unicode-display_width (1.
|
144
|
+
unicode-display_width (1.7.0)
|
145
|
+
zeitwerk (2.4.0)
|
135
146
|
|
136
147
|
PLATFORMS
|
137
148
|
ruby
|
@@ -152,4 +163,4 @@ DEPENDENCIES
|
|
152
163
|
sqlite3
|
153
164
|
|
154
165
|
BUNDLED WITH
|
155
|
-
2.
|
166
|
+
2.1.4
|
data/lib/lite/report/array.rb
CHANGED
@@ -10,21 +10,27 @@ module Lite
|
|
10
10
|
def initialize
|
11
11
|
@csv_options = {}
|
12
12
|
@data_options = {}
|
13
|
-
@
|
13
|
+
@import_options = {}
|
14
14
|
end
|
15
15
|
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
@configuration ||= Configuration.new
|
20
|
-
end
|
18
|
+
class << self
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
attr_writer :configuration
|
21
|
+
|
22
|
+
def configuration
|
23
|
+
@configuration ||= Configuration.new
|
24
|
+
end
|
25
|
+
|
26
|
+
def configure
|
27
|
+
yield(configuration)
|
28
|
+
end
|
29
|
+
|
30
|
+
def reset_configuration!
|
31
|
+
@configuration = Configuration.new
|
32
|
+
end
|
25
33
|
|
26
|
-
def self.configure
|
27
|
-
yield(configuration)
|
28
34
|
end
|
29
35
|
|
30
36
|
end
|
data/lib/lite/report/hash.rb
CHANGED
@@ -10,7 +10,14 @@ module Lite
|
|
10
10
|
def encode(cell)
|
11
11
|
return cell unless cell.is_a?(String)
|
12
12
|
|
13
|
-
cell.tr('"', '')
|
13
|
+
cell = cell.tr('"', '')
|
14
|
+
return cell if @data_options[:encode].empty?
|
15
|
+
|
16
|
+
cell.encode!(
|
17
|
+
@data_options[:encode][0],
|
18
|
+
@data_options[:encode][1],
|
19
|
+
**@data_options[:encode][2]
|
20
|
+
)
|
14
21
|
end
|
15
22
|
|
16
23
|
def encode?(delete: false)
|
@@ -8,7 +8,7 @@ module Lite
|
|
8
8
|
private
|
9
9
|
|
10
10
|
def generate_export!
|
11
|
-
CSV.generate(
|
11
|
+
CSV.generate(**@csv_options) do |csv|
|
12
12
|
@data.each do |row|
|
13
13
|
csv << process_export_row!(row)
|
14
14
|
end
|
@@ -33,7 +33,7 @@ module Lite
|
|
33
33
|
|
34
34
|
@data.each do |row|
|
35
35
|
row = process_export_row!(row)
|
36
|
-
csv << CSV.generate_line(row,
|
36
|
+
csv << CSV.generate_line(row, **@csv_options)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
data/lib/lite/report/record.rb
CHANGED
@@ -18,7 +18,7 @@ class Lite::Report::Record < Lite::Report::Base
|
|
18
18
|
@data = Lite::Report::Hash.import(@data, csv_options: @csv_options, data_options: @data_options)
|
19
19
|
.each { |row| row.delete(:id) || row.delete('id') }
|
20
20
|
|
21
|
-
klass.import(@data,
|
21
|
+
klass.import(@data, **@import_options)
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
@@ -43,6 +43,7 @@ class Lite::Report::Record < Lite::Report::Base
|
|
43
43
|
columns = class_columns(@data)
|
44
44
|
@data = @data.result if ransack_class?(@data)
|
45
45
|
@data = @data.deep_pluck(*columns)
|
46
|
+
@data = [@data] unless @data.is_a?(Array)
|
46
47
|
end
|
47
48
|
|
48
49
|
def generate_export!
|
data/lib/lite/report/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lite-report
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -220,7 +220,7 @@ dependencies:
|
|
220
220
|
- - ">="
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '0'
|
223
|
-
description:
|
223
|
+
description:
|
224
224
|
email:
|
225
225
|
- j.gomez@drexed.com
|
226
226
|
executables: []
|
@@ -264,7 +264,7 @@ homepage: http://drexed.github.io/lite-report
|
|
264
264
|
licenses:
|
265
265
|
- MIT
|
266
266
|
metadata: {}
|
267
|
-
post_install_message:
|
267
|
+
post_install_message:
|
268
268
|
rdoc_options: []
|
269
269
|
require_paths:
|
270
270
|
- lib
|
@@ -279,8 +279,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
279
279
|
- !ruby/object:Gem::Version
|
280
280
|
version: '0'
|
281
281
|
requirements: []
|
282
|
-
rubygems_version: 3.
|
283
|
-
signing_key:
|
282
|
+
rubygems_version: 3.1.4
|
283
|
+
signing_key:
|
284
284
|
specification_version: 4
|
285
285
|
summary: Import and export Ruby and Rails objects to flat files and vice versa
|
286
286
|
test_files: []
|