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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0858c189821239b020f4c42e74d223a3b49fc96fcc568b6680f0debe9820061a'
4
- data.tar.gz: 38afa48cdbde551d0ae0bfaafe637908d09cf946a9044847174b848244484f96
3
+ metadata.gz: b94708f3ef60f8780c0444e9ea75767073b8c6e93ca3ec2259d3d9fab20f4e3f
4
+ data.tar.gz: c47f0fcc4a55fd85b52d479fab6b79f66c49ef7644fbd2eca93e1638142e2437
5
5
  SHA512:
6
- metadata.gz: 492a6ef48c686c1fabde0bc2d75299b2b6a3b279e015f2e6cb11442734d36f06325a22fab35f270c170b65c514e60ea917a7afacbb66d61ba472d23a87403284
7
- data.tar.gz: cf3a6808e9af66e35bd2ae3c5a7b351610fa7e889a07916ee080ceadc87e370fd430eea88bb576746a5ea0b37a4abd62fac5ce378bc657683037fbced2e62269
6
+ metadata.gz: ec0aaa4561df1d5ed44c48897aefc7580769936e6ece768679321c8208d43b1def9308982e9f3320b040bed9d2a98c5641ae8e381524c2b1a8d7c3e7a7b1eda4
7
+ data.tar.gz: 278459ea22c634e0e38222af6b55031a4d02ed7831eb1f67ac625a136ee88e4e9543990c6b67266451e4f22928a29e76df81f4b4ca28c1a1f621ed9f1adbc9b7
@@ -2,11 +2,14 @@ require:
2
2
  - rubocop-performance
3
3
  - rubocop-rspec
4
4
  AllCops:
5
- TargetRubyVersion: 2.6
5
+ TargetRubyVersion: 2.7
6
+ NewCops: enable
6
7
  DisplayCopNames: true
7
8
  DisplayStyleGuide: true
8
- LineLength:
9
- Max: 100
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/**/**/*'
@@ -4,6 +4,7 @@ cache: bundler
4
4
  rvm:
5
5
  - 2.5
6
6
  - 2.6
7
+ - 2.7
7
8
  - ruby-head
8
9
  matrix:
9
10
  fast_finish: true
@@ -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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lite-report (1.0.1)
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 (5.2.3)
13
- actionview (= 5.2.3)
14
- activesupport (= 5.2.3)
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.2)
19
- actionview (5.2.3)
20
- activesupport (= 5.2.3)
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.0, >= 1.0.3)
25
- activemodel (5.2.3)
26
- activesupport (= 5.2.3)
27
- activerecord (5.2.3)
28
- activemodel (= 5.2.3)
29
- activesupport (= 5.2.3)
30
- arel (>= 9.0)
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 (5.2.3)
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
- arel (9.0.0)
39
- ast (2.4.0)
40
- builder (3.2.3)
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.5)
43
- crass (1.0.4)
44
- database_cleaner (1.7.0)
45
- deep_pluck (1.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
- diff-lcs (1.3)
49
- erubi (1.8.0)
50
- fasterer (0.6.0)
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.13.0)
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.6.0)
56
+ i18n (1.8.5)
57
57
  concurrent-ruby (~> 1.0)
58
- jaro_winkler (1.5.3)
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.9.2)
61
+ method_source (1.0.0)
63
62
  mini_portile2 (2.4.0)
64
- minitest (5.11.3)
65
- nokogiri (1.10.4)
63
+ minitest (5.14.2)
64
+ nokogiri (1.10.10)
66
65
  mini_portile2 (~> 2.4.0)
67
- parallel (1.17.0)
68
- parser (2.6.3.0)
69
- ast (~> 2.4.0)
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
- rack (2.0.7)
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.2.0)
79
- loofah (~> 2.2, >= 2.2.2)
80
- railties (5.2.3)
81
- actionpack (= 5.2.3)
82
- activesupport (= 5.2.3)
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.19.0, < 2.0)
88
+ thor (>= 0.20.3, < 2.0)
86
89
  rainbow (3.0.0)
87
- rake (12.3.3)
88
- ransack (2.1.1)
89
- actionpack (>= 5.0)
90
- activerecord (>= 5.0)
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
- rspec (3.8.0)
94
- rspec-core (~> 3.8.0)
95
- rspec-expectations (~> 3.8.0)
96
- rspec-mocks (~> 3.8.0)
97
- rspec-core (3.8.2)
98
- rspec-support (~> 3.8.0)
99
- rspec-expectations (3.8.4)
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.8.0)
102
- rspec-mocks (3.8.1)
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.8.0)
105
- rspec-rails (3.8.2)
106
- actionpack (>= 3.0)
107
- activesupport (>= 3.0)
108
- railties (>= 3.0)
109
- rspec-core (~> 3.8.0)
110
- rspec-expectations (~> 3.8.0)
111
- rspec-mocks (~> 3.8.0)
112
- rspec-support (~> 3.8.0)
113
- rspec-support (3.8.2)
114
- rubocop (0.74.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.6)
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, < 1.7)
121
- rubocop-performance (1.4.1)
122
- rubocop (>= 0.71.0)
123
- rubocop-rspec (1.35.0)
124
- rubocop (>= 0.60.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.13.1)
136
+ ruby_parser (3.15.0)
127
137
  sexp_processor (~> 4.9)
128
- sexp_processor (4.12.1)
129
- sqlite3 (1.4.1)
130
- thor (0.20.3)
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.5)
142
+ tzinfo (1.2.7)
133
143
  thread_safe (~> 0.1)
134
- unicode-display_width (1.6.0)
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.0.1
166
+ 2.1.4
@@ -7,7 +7,7 @@ class Lite::Report::Array < Lite::Report::Base
7
7
  end
8
8
 
9
9
  def import
10
- CSV.foreach(@data, @csv_options)
10
+ CSV.foreach(@data, **@csv_options)
11
11
  .with_object([]) do |row, array|
12
12
  row = convert_to_array!(row)
13
13
  array << process_import_row!(row)
@@ -10,21 +10,27 @@ module Lite
10
10
  def initialize
11
11
  @csv_options = {}
12
12
  @data_options = {}
13
- @import_adapter = {}
13
+ @import_options = {}
14
14
  end
15
15
 
16
16
  end
17
17
 
18
- def self.configuration
19
- @configuration ||= Configuration.new
20
- end
18
+ class << self
21
19
 
22
- def self.configuration=(config)
23
- @configuration = config
24
- end
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
@@ -8,7 +8,7 @@ class Lite::Report::Hash < Lite::Report::Base
8
8
  end
9
9
 
10
10
  def import
11
- CSV.foreach(@data, @csv_options)
11
+ CSV.foreach(@data, **@csv_options)
12
12
  .with_object([]) do |row, array|
13
13
  next if header_row?(row)
14
14
 
@@ -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('"', '').encode!(*@data_options[:encode])
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)
@@ -10,7 +10,7 @@ module Lite
10
10
  def class_columns(data)
11
11
  return data.klass.column_names if ransack_class?(data)
12
12
 
13
- data.column_names
13
+ data.try(:column_names) || data.class.column_names
14
14
  end
15
15
 
16
16
  def klass
@@ -8,7 +8,7 @@ module Lite
8
8
  private
9
9
 
10
10
  def generate_export!
11
- CSV.generate(@csv_options) do |csv|
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, @csv_options)
36
+ csv << CSV.generate_line(row, **@csv_options)
37
37
  end
38
38
  end
39
39
  end
@@ -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, @import_options)
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!
@@ -3,7 +3,7 @@
3
3
  module Lite
4
4
  module Report
5
5
 
6
- VERSION ||= '1.0.1'
6
+ VERSION ||= '1.0.6'
7
7
 
8
8
  end
9
9
  end
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.1
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: 2019-08-15 00:00:00.000000000 Z
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.0.4
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: []