webpacker_uploader 0.3.0 → 0.7.0
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/.gitignore +1 -0
- data/.rubocop.yml +197 -10
- data/.yardopts +8 -0
- data/CHANGELOG.md +29 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +58 -44
- data/README.md +38 -5
- data/Rakefile +13 -0
- data/lib/webpacker_uploader/configuration.rb +22 -2
- data/lib/webpacker_uploader/instance.rb +35 -6
- data/lib/webpacker_uploader/manifest.rb +1 -1
- data/lib/webpacker_uploader/mime.rb +6 -0
- data/lib/webpacker_uploader/providers/aws.rb +84 -13
- data/lib/webpacker_uploader/version.rb +3 -1
- data/lib/webpacker_uploader.rb +14 -3
- data/test/configuration_test.rb +87 -0
- data/test/manifest_test.rb +27 -0
- data/test/mime_test.rb +14 -0
- data/test/providers/aws_test.rb +16 -0
- data/test/test_app/config/webpacker.yml +103 -0
- data/test/test_app/public/packs/manifest.json +33 -0
- data/test/test_helper.rb +35 -0
- data/test/webpacker_uploader_test.rb +37 -0
- data/webpacker_uploader.gemspec +5 -9
- metadata +54 -13
- data/.github/workflows/rubocop.yml +0 -35
- data/.github/workflows/ruby.yml +0 -39
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c6cbb5cf694108a74e0cf8bb306acf9adca3ccedfef971a30c33503e7ccc1a1
|
4
|
+
data.tar.gz: 542dd824922fb799670706955b354564f17a467b2e4cb5a5860d4380f4b5ee1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96aba1a007135c90161ad63baeec1d2a3ea7e6aec85561d7e6e6919c614e00bb7c6252afd9e31f8263a2d121646c42e63eb3de26d79b789e0b9ccde1bd0a2c35
|
7
|
+
data.tar.gz: 522bb686c11ce429880befc7015b106f1230264aedde757e8ce7b47dd015485fbab45b71d69712cbe5c75488229c684dc3175ca9137f1ad60c795f5be04c4448
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,20 +1,18 @@
|
|
1
|
-
require:
|
1
|
+
require:
|
2
|
+
- rubocop-performance
|
3
|
+
- rubocop-minitest
|
2
4
|
|
3
5
|
AllCops:
|
4
6
|
TargetRubyVersion: 2.5
|
5
7
|
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
|
6
8
|
# to ignore them, so only the ones explicitly set in this file are enabled.
|
7
9
|
DisabledByDefault: true
|
10
|
+
SuggestExtensions: false
|
8
11
|
|
9
12
|
# Prefer &&/|| over and/or.
|
10
13
|
Style/AndOr:
|
11
14
|
Enabled: true
|
12
15
|
|
13
|
-
# Do not use braces for hash literals when they are the last argument of a
|
14
|
-
# method call.
|
15
|
-
Style/BracesAroundHashParameters:
|
16
|
-
Enabled: true
|
17
|
-
|
18
16
|
# Align `when` with `case`.
|
19
17
|
Layout/CaseIndentation:
|
20
18
|
Enabled: true
|
@@ -47,7 +45,7 @@ Style/HashSyntax:
|
|
47
45
|
# extra level of indentation.
|
48
46
|
Layout/IndentationConsistency:
|
49
47
|
Enabled: true
|
50
|
-
EnforcedStyle:
|
48
|
+
EnforcedStyle: indented_internal_methods
|
51
49
|
|
52
50
|
# Two spaces, no tabs (for indentation).
|
53
51
|
Layout/IndentationWidth:
|
@@ -96,11 +94,11 @@ Style/StringLiterals:
|
|
96
94
|
EnforcedStyle: double_quotes
|
97
95
|
|
98
96
|
# Detect hard tabs, no hard tabs.
|
99
|
-
Layout/
|
97
|
+
Layout/IndentationStyle:
|
100
98
|
Enabled: true
|
101
99
|
|
102
100
|
# Blank lines should not have any spaces.
|
103
|
-
Layout/
|
101
|
+
Layout/TrailingEmptyLines:
|
104
102
|
Enabled: true
|
105
103
|
|
106
104
|
# No trailing whitespace.
|
@@ -108,7 +106,7 @@ Layout/TrailingWhitespace:
|
|
108
106
|
Enabled: true
|
109
107
|
|
110
108
|
# Use quotes for string literals when they are enough.
|
111
|
-
Style/
|
109
|
+
Style/RedundantPercentQ:
|
112
110
|
Enabled: true
|
113
111
|
|
114
112
|
# Align `end` with the matching keyword or starting expression except for
|
@@ -120,3 +118,192 @@ Layout/EndAlignment:
|
|
120
118
|
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
121
119
|
Lint/RequireParentheses:
|
122
120
|
Enabled: true
|
121
|
+
|
122
|
+
Minitest/AssertEmpty:
|
123
|
+
Enabled: true
|
124
|
+
|
125
|
+
Minitest/AssertEmptyLiteral:
|
126
|
+
Enabled: true
|
127
|
+
|
128
|
+
Minitest/AssertEqual:
|
129
|
+
Enabled: true
|
130
|
+
|
131
|
+
Minitest/AssertionInLifecycleHook:
|
132
|
+
Enabled: true
|
133
|
+
|
134
|
+
Minitest/AssertMatch:
|
135
|
+
Enabled: true
|
136
|
+
|
137
|
+
Minitest/AssertIncludes:
|
138
|
+
Enabled: true
|
139
|
+
|
140
|
+
Minitest/AssertInstanceOf:
|
141
|
+
Enabled: true
|
142
|
+
|
143
|
+
Minitest/AssertKindOf:
|
144
|
+
Enabled: true
|
145
|
+
|
146
|
+
Minitest/AssertNil:
|
147
|
+
Enabled: true
|
148
|
+
|
149
|
+
Minitest/AssertOutput:
|
150
|
+
Enabled: true
|
151
|
+
|
152
|
+
Minitest/AssertPathExists:
|
153
|
+
Enabled: true
|
154
|
+
|
155
|
+
Minitest/AssertRespondTo:
|
156
|
+
Enabled: true
|
157
|
+
|
158
|
+
Minitest/AssertSilent:
|
159
|
+
Enabled: true
|
160
|
+
|
161
|
+
Minitest/AssertTruthy:
|
162
|
+
Enabled: true
|
163
|
+
|
164
|
+
Minitest/GlobalExpectations:
|
165
|
+
Enabled: true
|
166
|
+
|
167
|
+
Minitest/LiteralAsActualArgument:
|
168
|
+
Enabled: true
|
169
|
+
|
170
|
+
Minitest/RefuteEmpty:
|
171
|
+
Enabled: true
|
172
|
+
|
173
|
+
Minitest/RefuteEqual:
|
174
|
+
Enabled: true
|
175
|
+
|
176
|
+
Minitest/RefuteFalse:
|
177
|
+
Enabled: true
|
178
|
+
|
179
|
+
Minitest/RefuteIncludes:
|
180
|
+
Enabled: true
|
181
|
+
|
182
|
+
Minitest/RefuteMatch:
|
183
|
+
Enabled: true
|
184
|
+
|
185
|
+
Minitest/RefuteInstanceOf:
|
186
|
+
Enabled: true
|
187
|
+
|
188
|
+
Minitest/RefuteKindOf:
|
189
|
+
Enabled: true
|
190
|
+
|
191
|
+
Minitest/RefuteNil:
|
192
|
+
Enabled: true
|
193
|
+
|
194
|
+
Minitest/RefutePathExists:
|
195
|
+
Enabled: true
|
196
|
+
|
197
|
+
Minitest/RefuteRespondTo:
|
198
|
+
Enabled: true
|
199
|
+
|
200
|
+
Minitest/TestMethodName:
|
201
|
+
Enabled: true
|
202
|
+
|
203
|
+
Minitest/UnspecifiedException:
|
204
|
+
Enabled: true
|
205
|
+
|
206
|
+
# Use `bind_call(obj, args, ...)` instead of `bind(obj).call(args, ...)`.
|
207
|
+
Performance/BindCall:
|
208
|
+
Enabled: true
|
209
|
+
|
210
|
+
# Use `caller(n..n)` instead of `caller`.
|
211
|
+
Performance/Caller:
|
212
|
+
Enabled: true
|
213
|
+
|
214
|
+
# Use `casecmp` for case comparison.
|
215
|
+
Performance/Casecmp:
|
216
|
+
Enabled: true
|
217
|
+
|
218
|
+
# Extract Array and Hash literals outside of loops into local variables or constants.
|
219
|
+
Performance/CollectionLiteralInLoop:
|
220
|
+
Enabled: true
|
221
|
+
|
222
|
+
# Prefer `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`.
|
223
|
+
Performance/CompareWithBlock:
|
224
|
+
Enabled: true
|
225
|
+
|
226
|
+
# Use `count` instead of `{select,find_all,filter,reject}...{size,count,length}`.
|
227
|
+
Performance/Count:
|
228
|
+
Enabled: true
|
229
|
+
|
230
|
+
# Use `delete_prefix` instead of `gsub`.
|
231
|
+
Performance/DeletePrefix:
|
232
|
+
Enabled: true
|
233
|
+
|
234
|
+
# Use `delete_suffix` instead of `gsub`.
|
235
|
+
Performance/DeleteSuffix:
|
236
|
+
Enabled: true
|
237
|
+
|
238
|
+
# Use `detect` instead of `select.first`, `find_all.first`, `filter.first`, `select.last`, `find_all.last`, and `filter.last`.
|
239
|
+
Performance/Detect:
|
240
|
+
Enabled: true
|
241
|
+
|
242
|
+
# Use `str.{start,end}_with?(x, ..., y, ...)` instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
|
243
|
+
Performance/DoubleStartEndWith:
|
244
|
+
Enabled: true
|
245
|
+
|
246
|
+
# Use `end_with?` instead of a regex match anchored to the end of a string.
|
247
|
+
Performance/EndWith:
|
248
|
+
Enabled: true
|
249
|
+
|
250
|
+
# Do not compute the size of statically sized objects except in constants.
|
251
|
+
Performance/FixedSize:
|
252
|
+
Enabled: true
|
253
|
+
|
254
|
+
# Use `Enumerable#flat_map` instead of `Enumerable#map...Array#flatten(1).
|
255
|
+
Performance/FlatMap:
|
256
|
+
Enabled: true
|
257
|
+
|
258
|
+
# Use `key?` or `value?` instead of `keys.include?` or `values.include?`.
|
259
|
+
Performance/InefficientHashSearch:
|
260
|
+
Enabled: true
|
261
|
+
|
262
|
+
# Use `Range#cover?` instead of `Range#include?` (or `Range#member?`).
|
263
|
+
Performance/RangeInclude:
|
264
|
+
Enabled: true
|
265
|
+
|
266
|
+
# Use `yield` instead of `block.call`.
|
267
|
+
Performance/RedundantBlockCall:
|
268
|
+
Enabled: true
|
269
|
+
|
270
|
+
# Use `=~` instead of `String#match` or `Regexp#match` in a context where the returned `MatchData` is not needed.
|
271
|
+
Performance/RedundantMatch:
|
272
|
+
Enabled: true
|
273
|
+
|
274
|
+
# Use Hash#[]=, rather than Hash#merge! with a single key-value pair.
|
275
|
+
Performance/RedundantMerge:
|
276
|
+
Enabled: true
|
277
|
+
|
278
|
+
# Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`, `Regexp#===`, or `=~` when `MatchData` is not used.
|
279
|
+
Performance/RegexpMatch:
|
280
|
+
Enabled: true
|
281
|
+
|
282
|
+
# Use `reverse_each` instead of `reverse.each`.
|
283
|
+
Performance/ReverseEach:
|
284
|
+
Enabled: true
|
285
|
+
|
286
|
+
# Use `size` instead of `count` for counting the number of elements in `Array` and `Hash`.
|
287
|
+
Performance/Size:
|
288
|
+
Enabled: true
|
289
|
+
|
290
|
+
# Use `start_with?` instead of a regex match anchored to the beginning of a string.
|
291
|
+
Performance/StartWith:
|
292
|
+
Enabled: true
|
293
|
+
|
294
|
+
# Use `tr` instead of `gsub` when you are replacing the same number of characters.
|
295
|
+
# Use `delete` instead of `gsub` when you are deleting characters.
|
296
|
+
Performance/StringReplacement:
|
297
|
+
Enabled: true
|
298
|
+
|
299
|
+
# Checks for .times.map calls.
|
300
|
+
Performance/TimesMap:
|
301
|
+
Enabled: true
|
302
|
+
|
303
|
+
# Use unary plus to get an unfrozen string literal.
|
304
|
+
Performance/UnfreezeString:
|
305
|
+
Enabled: true
|
306
|
+
|
307
|
+
# Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`.
|
308
|
+
Performance/UriDefaultParser:
|
309
|
+
Enabled: true
|
data/.yardopts
ADDED
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,35 @@ All notable changes to this project will be documented in this file. The format
|
|
4
4
|
|
5
5
|
## [Unreleased]
|
6
6
|
|
7
|
+
## [[0.7.0]](https://github.com/tlatsas/webpacker_uploader/releases/tag/v0.7.0) - 2021-11-27
|
8
|
+
|
9
|
+
### Added
|
10
|
+
|
11
|
+
- Support setting Cache-Control on uploaded files. ([#16](https://github.com/tlatsas/webpacker_uploader/pull/16), [@Dimitris24sta23](https://github.com/Dimitris24sta23))
|
12
|
+
|
13
|
+
## [[0.6.0]](https://github.com/tlatsas/webpacker_uploader/releases/tag/v0.6.0) - 2021-07-20
|
14
|
+
|
15
|
+
### Added
|
16
|
+
|
17
|
+
- Allow passing arbitrary options to the AWS S3 Client through the AWS provider. ([#11](https://github.com/tlatsas/webpacker_uploader/pull/11), [@tlatsas](https://github.com/tlatsas))
|
18
|
+
|
19
|
+
### Fixed
|
20
|
+
|
21
|
+
- Fix undefined method delegate for WebpackerUploader:Module when using the console script. ([#13](https://github.com/tlatsas/webpacker_uploader/pull/13), [@tlatsas](https://github.com/tlatsas))
|
22
|
+
|
23
|
+
## [[0.5.0]](https://github.com/tlatsas/webpacker_uploader/releases/tag/v0.5.0) - 2021-07-12
|
24
|
+
|
25
|
+
### Fixed
|
26
|
+
|
27
|
+
- Change the way we pass the named profile option in the AWS provider. This allows the full resolution of credentials implemented
|
28
|
+
in Aws::CredentialProviderChain to work for all kinds of role assumptions, profile extensions, etc. ([#10](https://github.com/tlatsas/webpacker_uploader/pull/10), [@eirc](https://github.com/eirc))
|
29
|
+
|
30
|
+
## [[0.4.0]](https://github.com/tlatsas/webpacker_uploader/releases/tag/v0.4.0) - 2021-05-25
|
31
|
+
|
32
|
+
### Changed
|
33
|
+
|
34
|
+
- Logger is now part of the configuration object instead of a class attribute. ([#9](https://github.com/tlatsas/webpacker_uploader/pull/9), [@tlatsas](https://github.com/tlatsas))
|
35
|
+
|
7
36
|
## [[0.3.0]](https://github.com/tlatsas/webpacker_uploader/releases/tag/v0.3.0) - 2021-03-06
|
8
37
|
|
9
38
|
### Added
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,109 +1,121 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
webpacker_uploader (0.
|
4
|
+
webpacker_uploader (0.7.0)
|
5
5
|
mime-types
|
6
|
+
rack (~> 2.0)
|
6
7
|
webpacker (>= 5.1)
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
10
11
|
specs:
|
11
|
-
actionpack (6.1.
|
12
|
-
actionview (= 6.1.
|
13
|
-
activesupport (= 6.1.
|
12
|
+
actionpack (6.1.4.1)
|
13
|
+
actionview (= 6.1.4.1)
|
14
|
+
activesupport (= 6.1.4.1)
|
14
15
|
rack (~> 2.0, >= 2.0.9)
|
15
16
|
rack-test (>= 0.6.3)
|
16
17
|
rails-dom-testing (~> 2.0)
|
17
18
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
18
|
-
actionview (6.1.
|
19
|
-
activesupport (= 6.1.
|
19
|
+
actionview (6.1.4.1)
|
20
|
+
activesupport (= 6.1.4.1)
|
20
21
|
builder (~> 3.1)
|
21
22
|
erubi (~> 1.4)
|
22
23
|
rails-dom-testing (~> 2.0)
|
23
24
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
24
|
-
activesupport (6.1.
|
25
|
+
activesupport (6.1.4.1)
|
25
26
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
26
27
|
i18n (>= 1.6, < 2)
|
27
28
|
minitest (>= 5.1)
|
28
29
|
tzinfo (~> 2.0)
|
29
30
|
zeitwerk (~> 2.3)
|
30
|
-
ast (2.4.
|
31
|
-
aws-eventstream (1.
|
32
|
-
aws-partitions (1.
|
33
|
-
aws-sdk-core (3.
|
31
|
+
ast (2.4.2)
|
32
|
+
aws-eventstream (1.2.0)
|
33
|
+
aws-partitions (1.507.0)
|
34
|
+
aws-sdk-core (3.121.1)
|
34
35
|
aws-eventstream (~> 1, >= 1.0.2)
|
35
36
|
aws-partitions (~> 1, >= 1.239.0)
|
36
37
|
aws-sigv4 (~> 1.1)
|
37
38
|
jmespath (~> 1.0)
|
38
|
-
aws-sdk-kms (1.
|
39
|
-
aws-sdk-core (~> 3, >= 3.
|
39
|
+
aws-sdk-kms (1.48.0)
|
40
|
+
aws-sdk-core (~> 3, >= 3.120.0)
|
40
41
|
aws-sigv4 (~> 1.1)
|
41
|
-
aws-sdk-s3 (1.
|
42
|
-
aws-sdk-core (~> 3, >= 3.
|
42
|
+
aws-sdk-s3 (1.103.0)
|
43
|
+
aws-sdk-core (~> 3, >= 3.120.0)
|
43
44
|
aws-sdk-kms (~> 1)
|
44
|
-
aws-sigv4 (~> 1.
|
45
|
-
aws-sigv4 (1.
|
45
|
+
aws-sigv4 (~> 1.4)
|
46
|
+
aws-sigv4 (1.4.0)
|
46
47
|
aws-eventstream (~> 1, >= 1.0.2)
|
47
48
|
builder (3.2.4)
|
48
|
-
concurrent-ruby (1.1.
|
49
|
+
concurrent-ruby (1.1.9)
|
49
50
|
crass (1.0.6)
|
50
51
|
erubi (1.10.0)
|
51
|
-
i18n (1.8.
|
52
|
+
i18n (1.8.10)
|
52
53
|
concurrent-ruby (~> 1.0)
|
53
|
-
jaro_winkler (1.5.4)
|
54
54
|
jmespath (1.4.0)
|
55
|
-
loofah (2.
|
55
|
+
loofah (2.12.0)
|
56
56
|
crass (~> 1.0.2)
|
57
57
|
nokogiri (>= 1.5.9)
|
58
58
|
method_source (1.0.0)
|
59
59
|
mime-types (3.3.1)
|
60
60
|
mime-types-data (~> 3.2015)
|
61
|
-
mime-types-data (3.
|
62
|
-
|
63
|
-
|
61
|
+
mime-types-data (3.2021.0901)
|
62
|
+
mini_portile2 (2.6.1)
|
63
|
+
minitest (5.14.4)
|
64
|
+
nokogiri (1.12.5)
|
65
|
+
mini_portile2 (~> 2.6.1)
|
64
66
|
racc (~> 1.4)
|
65
|
-
parallel (1.
|
66
|
-
parser (
|
67
|
+
parallel (1.21.0)
|
68
|
+
parser (3.0.2.0)
|
67
69
|
ast (~> 2.4.1)
|
68
70
|
racc (1.5.2)
|
69
71
|
rack (2.2.3)
|
70
|
-
rack-proxy (0.
|
72
|
+
rack-proxy (0.7.0)
|
71
73
|
rack
|
72
74
|
rack-test (1.1.0)
|
73
75
|
rack (>= 1.0, < 3)
|
74
76
|
rails-dom-testing (2.0.3)
|
75
77
|
activesupport (>= 4.2.0)
|
76
78
|
nokogiri (>= 1.6)
|
77
|
-
rails-html-sanitizer (1.
|
79
|
+
rails-html-sanitizer (1.4.2)
|
78
80
|
loofah (~> 2.3)
|
79
|
-
railties (6.1.
|
80
|
-
actionpack (= 6.1.
|
81
|
-
activesupport (= 6.1.
|
81
|
+
railties (6.1.4.1)
|
82
|
+
actionpack (= 6.1.4.1)
|
83
|
+
activesupport (= 6.1.4.1)
|
82
84
|
method_source
|
83
|
-
rake (>= 0.
|
85
|
+
rake (>= 0.13)
|
84
86
|
thor (~> 1.0)
|
85
87
|
rainbow (3.0.0)
|
86
|
-
rake (
|
87
|
-
|
88
|
-
|
88
|
+
rake (13.0.6)
|
89
|
+
regexp_parser (2.1.1)
|
90
|
+
rexml (3.2.5)
|
91
|
+
rubocop (1.11.0)
|
89
92
|
parallel (~> 1.10)
|
90
|
-
parser (>=
|
93
|
+
parser (>= 3.0.0.0)
|
91
94
|
rainbow (>= 2.2.2, < 4.0)
|
95
|
+
regexp_parser (>= 1.8, < 3.0)
|
96
|
+
rexml
|
97
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
92
98
|
ruby-progressbar (~> 1.7)
|
93
|
-
unicode-display_width (>= 1.4.0, <
|
94
|
-
rubocop-
|
95
|
-
|
96
|
-
|
97
|
-
|
99
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
100
|
+
rubocop-ast (1.12.0)
|
101
|
+
parser (>= 3.0.1.1)
|
102
|
+
rubocop-minitest (0.15.1)
|
103
|
+
rubocop (>= 0.90, < 2.0)
|
104
|
+
rubocop-performance (1.11.5)
|
105
|
+
rubocop (>= 1.7.0, < 2.0)
|
106
|
+
rubocop-ast (>= 0.4.0)
|
107
|
+
ruby-progressbar (1.11.0)
|
108
|
+
semantic_range (3.0.0)
|
98
109
|
thor (1.1.0)
|
99
110
|
tzinfo (2.0.4)
|
100
111
|
concurrent-ruby (~> 1.0)
|
101
|
-
unicode-display_width (1.
|
102
|
-
webpacker (5.
|
112
|
+
unicode-display_width (2.1.0)
|
113
|
+
webpacker (5.4.3)
|
103
114
|
activesupport (>= 5.2)
|
104
115
|
rack-proxy (>= 0.6.1)
|
105
116
|
railties (>= 5.2)
|
106
117
|
semantic_range (>= 2.3.0)
|
118
|
+
yard (0.9.26)
|
107
119
|
zeitwerk (2.4.2)
|
108
120
|
|
109
121
|
PLATFORMS
|
@@ -114,9 +126,11 @@ DEPENDENCIES
|
|
114
126
|
bundler (>= 1.3.0)
|
115
127
|
minitest (~> 5.0)
|
116
128
|
rake (>= 11.1)
|
117
|
-
rubocop (
|
129
|
+
rubocop (= 1.11.0)
|
130
|
+
rubocop-minitest
|
118
131
|
rubocop-performance
|
119
132
|
webpacker_uploader!
|
133
|
+
yard (~> 0.9)
|
120
134
|
|
121
135
|
BUNDLED WITH
|
122
136
|
2.1.4
|
data/README.md
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
[](https://github.com/tlatsas/webpacker_uploader/actions)
|
4
4
|
[](https://github.com/tlatsas/webpacker_uploader/actions)
|
5
5
|
[](https://rubygems.org/gems/webpacker_uploader)
|
6
|
+
[](https://www.rubydoc.info/gems/webpacker_uploader)
|
6
7
|
|
7
8
|
Webpacker uploader provides an easy way to upload your assets to AWS S3.
|
8
9
|
It knows which files to upload by reading the `manifest.json` file.
|
@@ -15,16 +16,20 @@ S3 + CDN, outside of your Rails application.
|
|
15
16
|
Add this line to your application's Gemfile:
|
16
17
|
|
17
18
|
```ruby
|
18
|
-
gem "webpacker_uploader"
|
19
|
+
gem "webpacker_uploader", require: false
|
19
20
|
```
|
20
21
|
|
21
|
-
|
22
|
+
and run:
|
22
23
|
|
23
|
-
|
24
|
+
```sh
|
25
|
+
bundle install
|
26
|
+
```
|
24
27
|
|
25
|
-
|
28
|
+
or:
|
26
29
|
|
27
|
-
|
30
|
+
```sh
|
31
|
+
gem install webpacker_uploader
|
32
|
+
```
|
28
33
|
|
29
34
|
To use the aws provider install the aws-sdk-s3 gem. Add in your Gemfile:
|
30
35
|
|
@@ -34,6 +39,8 @@ gem "aws-sdk-s3", require: false
|
|
34
39
|
|
35
40
|
## Usage
|
36
41
|
|
42
|
+
Usually, in a Rake task you would add the following to upload the assets to AWS S3:
|
43
|
+
|
37
44
|
```ruby
|
38
45
|
require "webpacker_uploader"
|
39
46
|
require "webpacker_uploader/providers/aws"
|
@@ -100,6 +107,18 @@ WebpackerUploader.upload!(provider, prefix: "assets")
|
|
100
107
|
This will prefix all remote file paths with `assets` so instead of storing `packs/application-dd6b1cd38bfa093df600.css` it
|
101
108
|
will store `assets/packs/application-dd6b1cd38bfa093df600.css`.
|
102
109
|
|
110
|
+
### Add a cache-control directive to remote files
|
111
|
+
|
112
|
+
```ruby
|
113
|
+
WebpackerUploader.upload!(provider, cache_control: "public, max-age=3600")
|
114
|
+
```
|
115
|
+
|
116
|
+
This option is used to specify caching behavior along the request/reply chain.
|
117
|
+
|
118
|
+
```text
|
119
|
+
⚠️ This option is applied to all uploaded files, not on a per-file basis.
|
120
|
+
```
|
121
|
+
|
103
122
|
### Configuration
|
104
123
|
|
105
124
|
WebpackerUploader currently supports the following configuration options:
|
@@ -107,6 +126,7 @@ WebpackerUploader currently supports the following configuration options:
|
|
107
126
|
| option | description | default value |
|
108
127
|
|----------------------|--------------------------------------------------------------|---------------------------------------|
|
109
128
|
| ignored_extensions | Which files uploader should skip based on the file extension | [] |
|
129
|
+
| logger | The logger to use for logging | ActiveSupport::Logger.new(STDOUT) |
|
110
130
|
| log_output | Log output as we upload files | true |
|
111
131
|
| public_manifest_path | The webpack manifest path | Webpacker.config.public_manifest_path |
|
112
132
|
| public_path | The webpack public output path | Webpacker.config.public_path |
|
@@ -144,6 +164,19 @@ interactive prompt that will allow you to experiment.
|
|
144
164
|
|
145
165
|
To install this gem onto your local machine, run `bundle exec rake install`.
|
146
166
|
|
167
|
+
## Integration tests
|
168
|
+
|
169
|
+
This gem also provides an integration test suite. It runs using [localstack](https://github.com/localstack/localstack/).
|
170
|
+
To run the integration tests, install docker on your system and spin up a localstack container running the s3 service.
|
171
|
+
|
172
|
+
```shell
|
173
|
+
docker compose -f "integration/docker-compose.yml" up --detach
|
174
|
+
```
|
175
|
+
|
176
|
+
To run the tests, use `rake test:integration`.
|
177
|
+
|
178
|
+
To stop the container once done run: `docker-compose -f "integration/docker-compose.yml" down`
|
179
|
+
|
147
180
|
## Contributing
|
148
181
|
|
149
182
|
Bug reports and pull requests are welcome on GitHub at https://github.com/tlatsas/webpacker_uploader.
|
data/Rakefile
CHANGED
@@ -1,10 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "bundler/gem_tasks"
|
2
4
|
require "rake/testtask"
|
3
5
|
|
6
|
+
require "yard"
|
7
|
+
YARD::Rake::YardocTask.new
|
8
|
+
|
4
9
|
Rake::TestTask.new(:test) do |t|
|
5
10
|
t.libs << "test"
|
6
11
|
t.libs << "lib"
|
7
12
|
t.test_files = FileList["test/**/*_test.rb"]
|
8
13
|
end
|
9
14
|
|
15
|
+
namespace :test do
|
16
|
+
desc "Run integration tests using localstack"
|
17
|
+
Rake::TestTask.new(:integration) do |t|
|
18
|
+
t.libs << "integration"
|
19
|
+
t.test_files = FileList["integration/**/*_test.rb"]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
10
23
|
task default: :test
|
@@ -1,13 +1,33 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "active_support/logger"
|
4
|
+
require "active_support/tagged_logging"
|
5
|
+
|
6
|
+
# This is the class which holds the configuration options.
|
7
|
+
#
|
8
|
+
# Options are set and retrieved using `WebpackerUploader.config`
|
9
|
+
# and `WebpackerUploader.configure`.
|
3
10
|
class WebpackerUploader::Configuration
|
4
|
-
|
5
|
-
|
11
|
+
# @return [Array] the file extentions ignored by the uploader.
|
12
|
+
attr_accessor :ignored_extensions
|
13
|
+
|
14
|
+
# @return [ActiveSupport::Logger] the logger to use.
|
15
|
+
attr_accessor :logger
|
16
|
+
|
17
|
+
# @return [Boolean] whether or not to log operations.
|
18
|
+
attr_accessor :log_output
|
19
|
+
|
20
|
+
# @return [Pathname] the path to manifest.json, defaults to Webpacker public manifest path.
|
21
|
+
attr_reader :public_manifest_path
|
22
|
+
|
23
|
+
# @return [Pathname] the public root path, defaults to Webpacker public root path.
|
24
|
+
attr_reader :public_path
|
6
25
|
|
7
26
|
alias_method :log_output?, :log_output
|
8
27
|
|
9
28
|
def initialize
|
10
29
|
@ignored_extensions = []
|
30
|
+
@logger = ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(STDOUT))
|
11
31
|
@log_output = true
|
12
32
|
@public_manifest_path = ::Webpacker.config.public_manifest_path
|
13
33
|
@public_path = ::Webpacker.config.public_path
|