csv_rb 5.2.3.2 → 6.0.3.1
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/Gemfile +3 -3
- data/Gemfile.lock +127 -111
- data/README.md +22 -15
- data/lib/csv_rb/action_controller.rb +4 -4
- data/lib/csv_rb/plain_builder.rb +9 -11
- data/lib/csv_rb/stream_builder.rb +39 -0
- data/lib/csv_rb/stream_csv_deflator.rb +3 -36
- data/lib/csv_rb/template_handler.rb +2 -2
- data/lib/csv_rb/version.rb +1 -1
- data/spec/csv_rb_builder_spec.rb +40 -18
- data/spec/csv_rb_mailer_spec.rb +1 -1
- data/spec/dummy/app/assets/config/manifest.js +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +1155 -0
- data/spec/test_6.0.sh +16 -0
- metadata +10 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f86f23f12fd21b0809508d1da0642f20f4c89684bdd8bddd35ecf83dc7aaeb72
|
4
|
+
data.tar.gz: ed23c0f5dc0be75206f59a61ba6aa42ce9d75125791d1202d971645eb00442ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '06485dddc7b678c90f4bdf61e743fa79e2afb3508670cc0f7b32005837f789c6c0711e2aa7dcba1468040a32469fc2698b1b2ba2405c14599b209d5db93f52b4'
|
7
|
+
data.tar.gz: 2a9fc36f21fbb5313c9b982ef7c987daa7d0cbad45f98553be8512e0c66c7105c4a3e41bf90c2d3b280451c6557e04038cdc0698cdd30d8e8d29d1d497e71f26
|
data/Gemfile
CHANGED
@@ -5,9 +5,9 @@ source "http://rubygems.org"
|
|
5
5
|
# development dependencies will be added by default to the :development group.
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
ENV["RAILS_VERSION"] ||= '
|
9
|
-
gem 'rails',
|
10
|
-
gem 'responders', '~>
|
8
|
+
ENV["RAILS_VERSION"] ||= '6.0.3'
|
9
|
+
gem 'rails', '~> 6.0.3', '>= 6.0.3.1'
|
10
|
+
gem 'responders', '~> 3.0'
|
11
11
|
|
12
12
|
# jquery-rails is used by the dummy application
|
13
13
|
|
data/Gemfile.lock
CHANGED
@@ -1,58 +1,71 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
csv_rb (
|
5
|
-
actionpack (
|
4
|
+
csv_rb (6.0.2.4)
|
5
|
+
actionpack (>= 5.2)
|
6
6
|
csv (>= 3.1.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actioncable (
|
12
|
-
actionpack (=
|
11
|
+
actioncable (6.0.3.1)
|
12
|
+
actionpack (= 6.0.3.1)
|
13
13
|
nio4r (~> 2.0)
|
14
14
|
websocket-driver (>= 0.6.1)
|
15
|
-
|
16
|
-
actionpack (=
|
17
|
-
|
18
|
-
|
15
|
+
actionmailbox (6.0.3.1)
|
16
|
+
actionpack (= 6.0.3.1)
|
17
|
+
activejob (= 6.0.3.1)
|
18
|
+
activerecord (= 6.0.3.1)
|
19
|
+
activestorage (= 6.0.3.1)
|
20
|
+
activesupport (= 6.0.3.1)
|
21
|
+
mail (>= 2.7.1)
|
22
|
+
actionmailer (6.0.3.1)
|
23
|
+
actionpack (= 6.0.3.1)
|
24
|
+
actionview (= 6.0.3.1)
|
25
|
+
activejob (= 6.0.3.1)
|
19
26
|
mail (~> 2.5, >= 2.5.4)
|
20
27
|
rails-dom-testing (~> 2.0)
|
21
|
-
actionpack (
|
22
|
-
actionview (=
|
23
|
-
activesupport (=
|
24
|
-
rack (~> 2.0)
|
28
|
+
actionpack (6.0.3.1)
|
29
|
+
actionview (= 6.0.3.1)
|
30
|
+
activesupport (= 6.0.3.1)
|
31
|
+
rack (~> 2.0, >= 2.0.8)
|
25
32
|
rack-test (>= 0.6.3)
|
26
33
|
rails-dom-testing (~> 2.0)
|
27
|
-
rails-html-sanitizer (~> 1.0, >= 1.0
|
28
|
-
|
29
|
-
|
34
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
35
|
+
actiontext (6.0.3.1)
|
36
|
+
actionpack (= 6.0.3.1)
|
37
|
+
activerecord (= 6.0.3.1)
|
38
|
+
activestorage (= 6.0.3.1)
|
39
|
+
activesupport (= 6.0.3.1)
|
40
|
+
nokogiri (>= 1.8.5)
|
41
|
+
actionview (6.0.3.1)
|
42
|
+
activesupport (= 6.0.3.1)
|
30
43
|
builder (~> 3.1)
|
31
44
|
erubi (~> 1.4)
|
32
45
|
rails-dom-testing (~> 2.0)
|
33
|
-
rails-html-sanitizer (~> 1.
|
34
|
-
activejob (
|
35
|
-
activesupport (=
|
46
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
47
|
+
activejob (6.0.3.1)
|
48
|
+
activesupport (= 6.0.3.1)
|
36
49
|
globalid (>= 0.3.6)
|
37
|
-
activemodel (
|
38
|
-
activesupport (=
|
39
|
-
activerecord (
|
40
|
-
activemodel (=
|
41
|
-
activesupport (=
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
activerecord (=
|
50
|
+
activemodel (6.0.3.1)
|
51
|
+
activesupport (= 6.0.3.1)
|
52
|
+
activerecord (6.0.3.1)
|
53
|
+
activemodel (= 6.0.3.1)
|
54
|
+
activesupport (= 6.0.3.1)
|
55
|
+
activestorage (6.0.3.1)
|
56
|
+
actionpack (= 6.0.3.1)
|
57
|
+
activejob (= 6.0.3.1)
|
58
|
+
activerecord (= 6.0.3.1)
|
46
59
|
marcel (~> 0.3.1)
|
47
|
-
activesupport (
|
60
|
+
activesupport (6.0.3.1)
|
48
61
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
49
62
|
i18n (>= 0.7, < 2)
|
50
63
|
minitest (~> 5.1)
|
51
64
|
tzinfo (~> 1.1)
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
builder (3.2.
|
65
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
66
|
+
addressable (2.7.0)
|
67
|
+
public_suffix (>= 2.0.2, < 5.0)
|
68
|
+
builder (3.2.4)
|
56
69
|
capybara (2.18.0)
|
57
70
|
addressable
|
58
71
|
mini_mime (>= 0.1.3)
|
@@ -61,26 +74,26 @@ GEM
|
|
61
74
|
rack-test (>= 0.5.4)
|
62
75
|
xpath (>= 2.0, < 4.0)
|
63
76
|
coderay (1.1.2)
|
64
|
-
concurrent-ruby (1.1.
|
77
|
+
concurrent-ruby (1.1.6)
|
65
78
|
coveralls (0.8.23)
|
66
79
|
json (>= 1.8, < 3)
|
67
80
|
simplecov (~> 0.16.1)
|
68
81
|
term-ansicolor (~> 1.3)
|
69
82
|
thor (>= 0.19.4, < 2.0)
|
70
83
|
tins (~> 1.6)
|
71
|
-
crass (1.0.
|
72
|
-
csv (3.1.
|
84
|
+
crass (1.0.6)
|
85
|
+
csv (3.1.5)
|
73
86
|
daemons (1.3.1)
|
74
87
|
diff-lcs (1.3)
|
75
88
|
docile (1.3.2)
|
76
|
-
erubi (1.
|
89
|
+
erubi (1.9.0)
|
77
90
|
eventmachine (1.2.7)
|
78
|
-
ffi (1.
|
91
|
+
ffi (1.12.2)
|
79
92
|
formatador (0.2.5)
|
80
93
|
globalid (0.4.2)
|
81
94
|
activesupport (>= 4.2.0)
|
82
95
|
growl (1.0.3)
|
83
|
-
guard (2.
|
96
|
+
guard (2.16.2)
|
84
97
|
formatador (>= 0.2.4)
|
85
98
|
listen (>= 2.7, < 4.0)
|
86
99
|
lumberjack (>= 1.0.12, < 2.0)
|
@@ -94,35 +107,34 @@ GEM
|
|
94
107
|
guard (~> 2.1)
|
95
108
|
guard-compat (~> 1.1)
|
96
109
|
rspec (>= 2.99.0, < 4.0)
|
97
|
-
i18n (1.
|
110
|
+
i18n (1.8.2)
|
98
111
|
concurrent-ruby (~> 1.0)
|
99
|
-
jquery-rails (4.
|
112
|
+
jquery-rails (4.4.0)
|
100
113
|
rails-dom-testing (>= 1, < 3)
|
101
114
|
railties (>= 4.2.0)
|
102
115
|
thor (>= 0.14, < 2.0)
|
103
|
-
json (2.
|
104
|
-
listen (3.1
|
105
|
-
rb-fsevent (~> 0.
|
106
|
-
rb-inotify (~> 0.9, >= 0.9.
|
107
|
-
|
108
|
-
loofah (2.2.3)
|
116
|
+
json (2.3.0)
|
117
|
+
listen (3.2.1)
|
118
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
119
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
120
|
+
loofah (2.5.0)
|
109
121
|
crass (~> 1.0.2)
|
110
122
|
nokogiri (>= 1.5.9)
|
111
|
-
lumberjack (1.
|
123
|
+
lumberjack (1.2.4)
|
112
124
|
mail (2.7.1)
|
113
125
|
mini_mime (>= 0.1.1)
|
114
126
|
marcel (0.3.3)
|
115
127
|
mimemagic (~> 0.3.2)
|
116
128
|
method_source (0.9.2)
|
117
|
-
mimemagic (0.3.
|
118
|
-
mini_mime (1.0.
|
129
|
+
mimemagic (0.3.5)
|
130
|
+
mini_mime (1.0.2)
|
119
131
|
mini_portile2 (2.4.0)
|
120
|
-
minitest (5.
|
132
|
+
minitest (5.14.1)
|
121
133
|
nenv (0.3.0)
|
122
|
-
nio4r (2.
|
123
|
-
nokogiri (1.10.
|
134
|
+
nio4r (2.5.2)
|
135
|
+
nokogiri (1.10.9)
|
124
136
|
mini_portile2 (~> 2.4.0)
|
125
|
-
notiffany (0.1.
|
137
|
+
notiffany (0.1.3)
|
126
138
|
nenv (~> 0.1)
|
127
139
|
shellany (~> 0.0)
|
128
140
|
pry (0.12.2)
|
@@ -130,98 +142,102 @@ GEM
|
|
130
142
|
method_source (~> 0.9.0)
|
131
143
|
pry-nav (0.3.0)
|
132
144
|
pry (>= 0.9.10, < 0.13.0)
|
133
|
-
public_suffix (
|
134
|
-
rack (2.
|
145
|
+
public_suffix (4.0.5)
|
146
|
+
rack (2.2.2)
|
135
147
|
rack-test (1.1.0)
|
136
148
|
rack (>= 1.0, < 3)
|
137
|
-
rails (
|
138
|
-
actioncable (=
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
149
|
+
rails (6.0.3.1)
|
150
|
+
actioncable (= 6.0.3.1)
|
151
|
+
actionmailbox (= 6.0.3.1)
|
152
|
+
actionmailer (= 6.0.3.1)
|
153
|
+
actionpack (= 6.0.3.1)
|
154
|
+
actiontext (= 6.0.3.1)
|
155
|
+
actionview (= 6.0.3.1)
|
156
|
+
activejob (= 6.0.3.1)
|
157
|
+
activemodel (= 6.0.3.1)
|
158
|
+
activerecord (= 6.0.3.1)
|
159
|
+
activestorage (= 6.0.3.1)
|
160
|
+
activesupport (= 6.0.3.1)
|
147
161
|
bundler (>= 1.3.0)
|
148
|
-
railties (=
|
162
|
+
railties (= 6.0.3.1)
|
149
163
|
sprockets-rails (>= 2.0.0)
|
150
164
|
rails-dom-testing (2.0.3)
|
151
165
|
activesupport (>= 4.2.0)
|
152
166
|
nokogiri (>= 1.6)
|
153
|
-
rails-html-sanitizer (1.0
|
154
|
-
loofah (~> 2.
|
155
|
-
railties (
|
156
|
-
actionpack (=
|
157
|
-
activesupport (=
|
167
|
+
rails-html-sanitizer (1.3.0)
|
168
|
+
loofah (~> 2.3)
|
169
|
+
railties (6.0.3.1)
|
170
|
+
actionpack (= 6.0.3.1)
|
171
|
+
activesupport (= 6.0.3.1)
|
158
172
|
method_source
|
159
173
|
rake (>= 0.8.7)
|
160
|
-
thor (>= 0.
|
161
|
-
rake (
|
162
|
-
rb-fsevent (0.10.
|
163
|
-
rb-inotify (0.10.
|
174
|
+
thor (>= 0.20.3, < 2.0)
|
175
|
+
rake (13.0.1)
|
176
|
+
rb-fsevent (0.10.4)
|
177
|
+
rb-inotify (0.10.1)
|
164
178
|
ffi (~> 1.0)
|
165
|
-
rdoc (6.
|
166
|
-
responders (
|
167
|
-
actionpack (>=
|
168
|
-
railties (>=
|
169
|
-
roo (2.8.
|
179
|
+
rdoc (6.2.1)
|
180
|
+
responders (3.0.0)
|
181
|
+
actionpack (>= 5.0)
|
182
|
+
railties (>= 5.0)
|
183
|
+
roo (2.8.3)
|
170
184
|
nokogiri (~> 1)
|
171
|
-
rubyzip (>= 1.
|
172
|
-
rspec (3.
|
173
|
-
rspec-core (~> 3.
|
174
|
-
rspec-expectations (~> 3.
|
175
|
-
rspec-mocks (~> 3.
|
176
|
-
rspec-core (3.
|
177
|
-
rspec-support (~> 3.
|
178
|
-
rspec-expectations (3.
|
185
|
+
rubyzip (>= 1.3.0, < 3.0.0)
|
186
|
+
rspec (3.9.0)
|
187
|
+
rspec-core (~> 3.9.0)
|
188
|
+
rspec-expectations (~> 3.9.0)
|
189
|
+
rspec-mocks (~> 3.9.0)
|
190
|
+
rspec-core (3.9.2)
|
191
|
+
rspec-support (~> 3.9.3)
|
192
|
+
rspec-expectations (3.9.2)
|
179
193
|
diff-lcs (>= 1.2.0, < 2.0)
|
180
|
-
rspec-support (~> 3.
|
181
|
-
rspec-mocks (3.
|
194
|
+
rspec-support (~> 3.9.0)
|
195
|
+
rspec-mocks (3.9.1)
|
182
196
|
diff-lcs (>= 1.2.0, < 2.0)
|
183
|
-
rspec-support (~> 3.
|
184
|
-
rspec-rails (
|
185
|
-
actionpack (>=
|
186
|
-
activesupport (>=
|
187
|
-
railties (>=
|
188
|
-
rspec-core (~> 3.
|
189
|
-
rspec-expectations (~> 3.
|
190
|
-
rspec-mocks (~> 3.
|
191
|
-
rspec-support (~> 3.
|
192
|
-
rspec-support (3.
|
193
|
-
|
194
|
-
rubyzip (1.2.3)
|
197
|
+
rspec-support (~> 3.9.0)
|
198
|
+
rspec-rails (4.0.1)
|
199
|
+
actionpack (>= 4.2)
|
200
|
+
activesupport (>= 4.2)
|
201
|
+
railties (>= 4.2)
|
202
|
+
rspec-core (~> 3.9)
|
203
|
+
rspec-expectations (~> 3.9)
|
204
|
+
rspec-mocks (~> 3.9)
|
205
|
+
rspec-support (~> 3.9)
|
206
|
+
rspec-support (3.9.3)
|
207
|
+
rubyzip (2.3.0)
|
195
208
|
shellany (0.0.1)
|
196
209
|
simplecov (0.16.1)
|
197
210
|
docile (~> 1.1)
|
198
211
|
json (>= 1.8, < 3)
|
199
212
|
simplecov-html (~> 0.10.0)
|
200
213
|
simplecov-html (0.10.2)
|
201
|
-
sprockets (
|
214
|
+
sprockets (4.0.0)
|
202
215
|
concurrent-ruby (~> 1.0)
|
203
216
|
rack (> 1, < 3)
|
204
217
|
sprockets-rails (3.2.1)
|
205
218
|
actionpack (>= 4.0)
|
206
219
|
activesupport (>= 4.0)
|
207
220
|
sprockets (>= 3.0.0)
|
208
|
-
sqlite3 (1.4.
|
221
|
+
sqlite3 (1.4.2)
|
222
|
+
sync (0.5.0)
|
209
223
|
term-ansicolor (1.7.1)
|
210
224
|
tins (~> 1.0)
|
211
225
|
thin (1.7.2)
|
212
226
|
daemons (~> 1.0, >= 1.0.9)
|
213
227
|
eventmachine (~> 1.0, >= 1.0.4)
|
214
228
|
rack (>= 1, < 3)
|
215
|
-
thor (0.
|
229
|
+
thor (1.0.1)
|
216
230
|
thread_safe (0.3.6)
|
217
|
-
tins (1.
|
218
|
-
|
231
|
+
tins (1.25.0)
|
232
|
+
sync
|
233
|
+
tzinfo (1.2.7)
|
219
234
|
thread_safe (~> 0.1)
|
220
|
-
websocket-driver (0.7.
|
235
|
+
websocket-driver (0.7.2)
|
221
236
|
websocket-extensions (>= 0.1.0)
|
222
237
|
websocket-extensions (0.1.4)
|
223
238
|
xpath (3.2.0)
|
224
239
|
nokogiri (~> 1.8)
|
240
|
+
zeitwerk (2.3.0)
|
225
241
|
|
226
242
|
PLATFORMS
|
227
243
|
ruby
|
@@ -236,15 +252,15 @@ DEPENDENCIES
|
|
236
252
|
jquery-rails
|
237
253
|
pry
|
238
254
|
pry-nav
|
239
|
-
rails (~>
|
255
|
+
rails (~> 6.0.3, >= 6.0.3.1)
|
240
256
|
rake
|
241
257
|
rb-fsevent
|
242
258
|
rdoc
|
243
|
-
responders (~>
|
259
|
+
responders (~> 3.0)
|
244
260
|
roo
|
245
261
|
rspec-rails
|
246
262
|
sqlite3
|
247
263
|
thin
|
248
264
|
|
249
265
|
BUNDLED WITH
|
250
|
-
2.
|
266
|
+
2.1.4
|
data/README.md
CHANGED
@@ -1,12 +1,9 @@
|
|
1
|
-
CSVRb-Rails — Streaming CSVs with
|
1
|
+
CSVRb-Rails — Streaming CSVs with ActionView templates
|
2
2
|
===================================================
|
3
3
|
|
4
|
-
[](http://badge.fury.io/rb/csv_rb)
|
6
|
-
[](http://badge.fury.io/rb/csv_rb)
|
8
5
|

|
9
|
-

|
10
7
|
|
11
8
|
## Installation
|
12
9
|
|
@@ -19,7 +16,15 @@ gem 'csv_rb'
|
|
19
16
|
|
20
17
|
## Requirements
|
21
18
|
|
22
|
-
* Rails 5.2
|
19
|
+
* \>= Rails 5.2
|
20
|
+
- Latest Version Tested With:
|
21
|
+
- 5.2
|
22
|
+
- 6.0
|
23
|
+
* \>= Ruby 2.5
|
24
|
+
- Latest Version Tested With:
|
25
|
+
- 2.6
|
26
|
+
- 2.7
|
27
|
+
|
23
28
|
|
24
29
|
## Usage
|
25
30
|
|
@@ -89,12 +94,12 @@ format.csv {
|
|
89
94
|
}
|
90
95
|
```
|
91
96
|
|
92
|
-
If you use `render csv:` the gem will try to guess the file name
|
97
|
+
If you use `render csv:` the gem will try to guess the file name based on the `:csv` key value
|
93
98
|
|
94
99
|
```ruby
|
95
|
-
# filename of 'buttons'
|
100
|
+
# filename of 'buttons.csv'
|
96
101
|
render csv: 'buttons'
|
97
|
-
# filename of 'latest_buttons'
|
102
|
+
# filename of 'latest_buttons.csv'
|
98
103
|
render csv: 'latest_buttons', template: 'featured/latest'
|
99
104
|
```
|
100
105
|
|
@@ -110,13 +115,15 @@ Partials work as expected, but you must pass in relevant spreadsheet variables:
|
|
110
115
|
|
111
116
|
```ruby
|
112
117
|
csv << ['BEFORE']
|
113
|
-
render :partial => '
|
118
|
+
render :partial => 'csv_partial', :locals => { csv: csv }
|
114
119
|
csv << ['AFTER']
|
115
120
|
```
|
116
121
|
|
117
122
|
With the partial simply using the passed variables:
|
118
123
|
|
119
124
|
```ruby
|
125
|
+
# _csv_partial.csv.csvrb
|
126
|
+
|
120
127
|
csv << ['Partial Content']
|
121
128
|
```
|
122
129
|
|
@@ -130,8 +137,8 @@ class UserMailer < ActionMailer::Base
|
|
130
137
|
csv = render_to_string layout: false, handlers: [:csvrb], formats: [:csv], template: "users/export", locals: {users: users}
|
131
138
|
attachment = Base64.encode64(csv)
|
132
139
|
attachments["Users.csv"] = {mime_type: Mime[:csv], content: attachment, encoding: 'base64'}
|
133
|
-
# For rails 4 use Mime::
|
134
|
-
# attachments["Users.csv"] = {mime_type: Mime::
|
140
|
+
# For rails 4 use Mime::CSV
|
141
|
+
# attachments["Users.csv"] = {mime_type: Mime::CSV, content: attachment, encoding: 'base64'}
|
135
142
|
# self.instance_variable_set(:@_lookup_context, nil) # If attachments are rendered as content, try this and open an issue
|
136
143
|
...
|
137
144
|
end
|
@@ -139,8 +146,8 @@ end
|
|
139
146
|
```
|
140
147
|
|
141
148
|
* If the route specifies or suggests the `:csv` format you do not need to specify `formats` or `handlers`.
|
142
|
-
* If the template (`users/export`) can refer to only one file (
|
143
|
-
* Specifying the encoding as 'base64' can avoid UTF-8 errors.
|
149
|
+
* If the template (`users/export` in this case) can refer to only one file (`users/export.csv.csvrb`), you do not need to specify `handlers`, provided the `formats` key includes `:csv`.
|
150
|
+
* Specifying the encoding as 'base64' can help avoid UTF-8 errors.
|
144
151
|
|
145
152
|
### Testing
|
146
153
|
|