non-digest-assets 1.1.0 → 1.2.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/README.md +4 -4
- data/lib/non-digest-assets.rb +31 -17
- metadata +68 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52ec82545e132f58fcccffc6919e17cb7458f293703039e64774824e0d115d42
|
4
|
+
data.tar.gz: b616bfa6fbcf8a8701db9f33ea27cdc9684cababfff96d9c96fe538067aa530e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d6653fd4f4538997715f6583ece7dbafa942a8990c0ed5b77f91004a4db1619b2291e9df24f58721709c08f87dc75c8e63e4240f2351e440ddefab890721888
|
7
|
+
data.tar.gz: bb926937f8faa5ca937faf754af3b1aaca51317617a288254e9bf15242633c3b7b324c1b1f721b50e292c8b5c7b8e1ed72b539fb3741259adf4124ca5e03556d
|
data/README.md
CHANGED
@@ -18,13 +18,13 @@ Just put it in your Gemfile
|
|
18
18
|
gem "non-digest-assets"
|
19
19
|
```
|
20
20
|
|
21
|
-
If you want to
|
22
|
-
configure a
|
21
|
+
If you want to generate non-digest assets for only certain files, you can
|
22
|
+
configure a list of asset selectors like this:
|
23
23
|
|
24
24
|
```ruby
|
25
25
|
# config/initializers/non_digest_assets.rb
|
26
26
|
|
27
|
-
NonDigestAssets.
|
27
|
+
NonDigestAssets.asset_selectors += [/tinymce\/.*/, "image.png"]
|
28
28
|
```
|
29
29
|
|
30
30
|
Be sure to give either a regex that will match the right assets or the logical
|
@@ -72,7 +72,7 @@ The sprockets-rails developers do not want to support it.
|
|
72
72
|
Which versions of Ruby and Rails are supported?
|
73
73
|
--------------------------------------
|
74
74
|
|
75
|
-
This gem is tested with Rails 5.
|
75
|
+
This gem is tested with Rails 5.2 and 6.0 and targets Ruby 2.5 and up.
|
76
76
|
|
77
77
|
Who wrote this?
|
78
78
|
---------------
|
data/lib/non-digest-assets.rb
CHANGED
@@ -2,41 +2,55 @@
|
|
2
2
|
|
3
3
|
require "sprockets/manifest"
|
4
4
|
require "active_support/core_ext/module/attribute_accessors"
|
5
|
+
require "active_support/deprecation"
|
5
6
|
|
6
7
|
module NonDigestAssets
|
7
8
|
mattr_accessor :whitelist
|
8
9
|
@@whitelist = []
|
9
10
|
|
10
11
|
class << self
|
11
|
-
def
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
def whitelisted_assets(assets)
|
20
|
-
assets.select do |logical_path, _digest_path|
|
21
|
-
whitelist.any? do |item|
|
22
|
-
item === logical_path
|
12
|
+
def filter_assets(asset_list)
|
13
|
+
if asset_selectors.empty?
|
14
|
+
asset_list
|
15
|
+
else
|
16
|
+
asset_list.select do |logical_path, _digest_path|
|
17
|
+
asset_selectors.any? do |item|
|
18
|
+
item === logical_path
|
19
|
+
end
|
23
20
|
end
|
24
21
|
end
|
25
22
|
end
|
26
|
-
end
|
27
23
|
|
28
|
-
module CompileWithNonDigest
|
29
24
|
# Copy an asset and preserve atime and mtime attributes. If the file exists
|
30
25
|
# and is not owned by the calling user, the utime call will fail so we just
|
31
26
|
# delete the target file first in any case.
|
32
27
|
def copy_file(from, to)
|
28
|
+
return if from == to
|
29
|
+
|
33
30
|
FileUtils.rm_f to
|
34
31
|
FileUtils.copy_file from, to, :preserve_attributes
|
35
32
|
end
|
36
33
|
|
34
|
+
def assets(asset_list)
|
35
|
+
filter_assets(asset_list)
|
36
|
+
end
|
37
|
+
|
38
|
+
alias asset_selectors whitelist
|
39
|
+
alias asset_selectors= whitelist=
|
40
|
+
|
41
|
+
ActiveSupport::Deprecation
|
42
|
+
.deprecate_methods(self,
|
43
|
+
assets: "use filter_assets instead",
|
44
|
+
whitelist: "use asset_selectors instead",
|
45
|
+
"whitelist=": "use asset_selectors= instead",
|
46
|
+
deprecator: ActiveSupport::Deprecation.new("2.0.0",
|
47
|
+
"non-digest-assets"))
|
48
|
+
end
|
49
|
+
|
50
|
+
module CompileWithNonDigest
|
37
51
|
def compile(*args)
|
38
52
|
paths = super
|
39
|
-
NonDigestAssets.
|
53
|
+
NonDigestAssets.filter_assets(assets).each do |(logical_path, digest_path)|
|
40
54
|
full_digest_path = File.join dir, digest_path
|
41
55
|
full_digest_gz_path = "#{full_digest_path}.gz"
|
42
56
|
full_non_digest_path = File.join dir, logical_path
|
@@ -44,13 +58,13 @@ module NonDigestAssets
|
|
44
58
|
|
45
59
|
if File.exist? full_digest_path
|
46
60
|
logger.debug "Writing #{full_non_digest_path}"
|
47
|
-
copy_file full_digest_path, full_non_digest_path
|
61
|
+
NonDigestAssets.copy_file full_digest_path, full_non_digest_path
|
48
62
|
else
|
49
63
|
logger.debug "Could not find: #{full_digest_path}"
|
50
64
|
end
|
51
65
|
if File.exist? full_digest_gz_path
|
52
66
|
logger.debug "Writing #{full_non_digest_gz_path}"
|
53
|
-
copy_file full_digest_gz_path, full_non_digest_gz_path
|
67
|
+
NonDigestAssets.copy_file full_digest_gz_path, full_non_digest_gz_path
|
54
68
|
else
|
55
69
|
logger.debug "Could not find: #{full_digest_gz_path}"
|
56
70
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: non-digest-assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Speller
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-07-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -17,7 +17,7 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '5.2'
|
21
21
|
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: '6.2'
|
@@ -27,7 +27,7 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - ">="
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version: '
|
30
|
+
version: '5.2'
|
31
31
|
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '6.2'
|
@@ -71,14 +71,14 @@ dependencies:
|
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
74
|
+
version: '2.0'
|
75
75
|
type: :development
|
76
76
|
prerelease: false
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
81
|
+
version: '2.0'
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: pry
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
@@ -147,28 +147,84 @@ dependencies:
|
|
147
147
|
requirements:
|
148
148
|
- - "~>"
|
149
149
|
- !ruby/object:Gem::Version
|
150
|
-
version: 1.
|
150
|
+
version: 1.18.1
|
151
151
|
type: :development
|
152
152
|
prerelease: false
|
153
153
|
version_requirements: !ruby/object:Gem::Requirement
|
154
154
|
requirements:
|
155
155
|
- - "~>"
|
156
156
|
- !ruby/object:Gem::Version
|
157
|
-
version: 1.
|
157
|
+
version: 1.18.1
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: rubocop-packaging
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - "~>"
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: 0.5.1
|
165
|
+
type: :development
|
166
|
+
prerelease: false
|
167
|
+
version_requirements: !ruby/object:Gem::Requirement
|
168
|
+
requirements:
|
169
|
+
- - "~>"
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: 0.5.1
|
158
172
|
- !ruby/object:Gem::Dependency
|
159
173
|
name: rubocop-performance
|
160
174
|
requirement: !ruby/object:Gem::Requirement
|
161
175
|
requirements:
|
162
176
|
- - "~>"
|
163
177
|
- !ruby/object:Gem::Version
|
164
|
-
version: 1.
|
178
|
+
version: 1.11.3
|
179
|
+
type: :development
|
180
|
+
prerelease: false
|
181
|
+
version_requirements: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - "~>"
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: 1.11.3
|
186
|
+
- !ruby/object:Gem::Dependency
|
187
|
+
name: rubocop-rails
|
188
|
+
requirement: !ruby/object:Gem::Requirement
|
189
|
+
requirements:
|
190
|
+
- - "~>"
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: 2.11.0
|
193
|
+
type: :development
|
194
|
+
prerelease: false
|
195
|
+
version_requirements: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - "~>"
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: 2.11.0
|
200
|
+
- !ruby/object:Gem::Dependency
|
201
|
+
name: rubocop-rake
|
202
|
+
requirement: !ruby/object:Gem::Requirement
|
203
|
+
requirements:
|
204
|
+
- - "~>"
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: 0.6.0
|
207
|
+
type: :development
|
208
|
+
prerelease: false
|
209
|
+
version_requirements: !ruby/object:Gem::Requirement
|
210
|
+
requirements:
|
211
|
+
- - "~>"
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: 0.6.0
|
214
|
+
- !ruby/object:Gem::Dependency
|
215
|
+
name: rubocop-rspec
|
216
|
+
requirement: !ruby/object:Gem::Requirement
|
217
|
+
requirements:
|
218
|
+
- - "~>"
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
version: 2.4.0
|
165
221
|
type: :development
|
166
222
|
prerelease: false
|
167
223
|
version_requirements: !ruby/object:Gem::Requirement
|
168
224
|
requirements:
|
169
225
|
- - "~>"
|
170
226
|
- !ruby/object:Gem::Version
|
171
|
-
version:
|
227
|
+
version: 2.4.0
|
172
228
|
description: |2
|
173
229
|
Rails provides no option to generate both digest and non-digest
|
174
230
|
assets. Installing this gem automatically creates both digest and
|
@@ -194,14 +250,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
194
250
|
requirements:
|
195
251
|
- - ">="
|
196
252
|
- !ruby/object:Gem::Version
|
197
|
-
version: '2.
|
253
|
+
version: '2.5'
|
198
254
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
199
255
|
requirements:
|
200
256
|
- - ">="
|
201
257
|
- !ruby/object:Gem::Version
|
202
258
|
version: '0'
|
203
259
|
requirements: []
|
204
|
-
rubygems_version: 3.2.
|
260
|
+
rubygems_version: 3.2.22
|
205
261
|
signing_key:
|
206
262
|
specification_version: 4
|
207
263
|
summary: Make the Rails asset pipeline generate non-digest along with digest assets
|