smart_assets 0.5.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +5 -0
- data/lib/smart_assets/rack.rb +11 -0
- data/lib/smart_assets/railtie.rb +1 -7
- data/lib/smart_assets/version.rb +3 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba7e64f833285ce837eaa898746c6801a297495c3dc4a14869a2b7dfb12ee97a
|
4
|
+
data.tar.gz: b19a832d43a12a70769d017bb38e59ef2da16b18e62a5d480c75379673d39156
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d18dacb103fb7fe11b10bfa1cc5be9242fd8d10d2a7756a80748d041a52dc1b08c0577a24b05b4b8c6955f5f711fd91e8ed93c5587d078da480576e67233349b
|
7
|
+
data.tar.gz: eff33c723ee6a2c2a8a6a08afeb57438da50892f04564ca35f82754ea5011c0a58e02f26dc7ecef44050d9de2b1bbe3e35394f7bae29a6b94a4329c076c7953d
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
data/lib/smart_assets/rack.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SmartAssets
|
2
4
|
class Rack
|
3
5
|
|
@@ -18,6 +20,15 @@ module SmartAssets
|
|
18
20
|
end
|
19
21
|
status, headers, body = @app.call(env)
|
20
22
|
if [200, 206].include?(status)
|
23
|
+
# rack 2 expects Mixed-Case headers, while rack 3 expects lower-case. rails doesn't ensure
|
24
|
+
# either one. normal controller actions use ActionDispatch::Response::Headers, which maps
|
25
|
+
# to rack 2's HeaderHash or rack 3's Headers, both of which are case-insensitive extensions
|
26
|
+
# to Hash. however, some responses (ActionDispatch::Static among them), just use Hash.
|
27
|
+
# more, Static relies on the user-configurable public_file_server.headers setting, which
|
28
|
+
# may have unpredictable casing regardless of the rails or rack version.
|
29
|
+
headers = ActionDispatch::Response::Headers[headers] if defined? ActionDispatch::Response::Headers
|
30
|
+
|
31
|
+
# keep Mixed-Case as long as supporting rails <= 7.0 or rack 2
|
21
32
|
headers['Cache-Control'] = @cache_control
|
22
33
|
headers['ETag'] ||= %("#{digest(digest_asset)}")
|
23
34
|
end
|
data/lib/smart_assets/railtie.rb
CHANGED
@@ -11,13 +11,7 @@ module SmartAssets
|
|
11
11
|
prefix = app.config.smart_assets.prefix || app.config.assets.prefix || '/assets'
|
12
12
|
cc = app.config.smart_assets.cache_control
|
13
13
|
|
14
|
-
|
15
|
-
app.config.public_file_server.enabled = true # >= 5.0
|
16
|
-
elsif app.config.respond_to?(:serve_static_files)
|
17
|
-
app.config.serve_static_files = true # = 4.2
|
18
|
-
else
|
19
|
-
app.config.serve_static_assets = true # <= 4.1
|
20
|
-
end
|
14
|
+
app.config.public_file_server.enabled = true
|
21
15
|
|
22
16
|
app.middleware.insert_after(::Rack::Sendfile, SmartAssets::Rack, prefix, cc)
|
23
17
|
end
|
data/lib/smart_assets/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thomas morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,27 +16,27 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6.1'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '8.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '6.1'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '8.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: sprockets-rails
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
39
|
+
version: '3'
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '4'
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
49
|
+
version: '3'
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '4'
|
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
127
|
- !ruby/object:Gem::Version
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
|
-
rubygems_version: 3.
|
130
|
+
rubygems_version: 3.5.22
|
131
131
|
signing_key:
|
132
132
|
specification_version: 4
|
133
133
|
summary: Rails/Rack middleware to enable delivery of non-digest assets
|