classy_assets 0.11.0 → 0.11.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/lib/classy_assets/version.rb +1 -1
- data/lib/rack/classy_assets.rb +8 -11
- data/spec/rack/classy_assets_spec.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7b490bf26a7551e8d77d667fb007505bfb17422
|
4
|
+
data.tar.gz: d2b4b3dec4a2ee72b919799c5f96247bb0c3089f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b1310675cb0784d599f2735ee40ef09861d103faee20bb731e1ed8f6dcf0c1da506eb92e14bcf1e5ddc9ab70c19edf00e4cc68f8d8c53bc7550ca35a3741ced
|
7
|
+
data.tar.gz: ca1db9df2995163d5abb05f83a753058ba536ab9f55aef62d615d2c419da86e775e8e192fa4d01b5e74b7da8cb20bf98d90d308c1e44b41b974a2d9908359c02
|
data/lib/rack/classy_assets.rb
CHANGED
@@ -14,18 +14,15 @@ module Rack
|
|
14
14
|
|
15
15
|
def call(env)
|
16
16
|
if %w(GET HEAD).include?(env['REQUEST_METHOD']) and env['PATH_INFO'].start_with?("/#{::ClassyAssets.config.asset_prefix}")
|
17
|
-
puts "ClassyAssets: GET or HEAD request"
|
18
17
|
request = Rack::Request.new(env)
|
19
18
|
encoding = Rack::Utils.select_best_encoding(%w(gzip identity), request.accept_encoding)
|
20
19
|
if encoding == 'gzip'
|
21
|
-
puts "ClassyAssets: encoding == gzip"
|
22
20
|
return serve_gzipped_asset(env)
|
23
21
|
else
|
24
|
-
puts "ClassyAssets: encoding != gzip"
|
25
22
|
return serve_asset(env)
|
26
23
|
end
|
27
24
|
end
|
28
|
-
|
25
|
+
|
29
26
|
status, headers, body = @app.call(env)
|
30
27
|
body.close if body.respond_to?(:close)
|
31
28
|
[status, headers, body]
|
@@ -41,7 +38,6 @@ module Rack
|
|
41
38
|
def serve_gzipped_asset(env)
|
42
39
|
compressed_path = env['PATH_INFO'] + '.gz'
|
43
40
|
if asset_path_exists?(compressed_path)
|
44
|
-
puts "ClassyAssets: gzip asset path exists"
|
45
41
|
env["PATH_INFO"] = compressed_path
|
46
42
|
status, headers, body = @file_server.call(env)
|
47
43
|
path = env["PATH_INFO"] = env["PATH_INFO"].chomp('.gz')
|
@@ -61,9 +57,7 @@ module Rack
|
|
61
57
|
headers['Cache-Control'] = 'no-transform'
|
62
58
|
end
|
63
59
|
else
|
64
|
-
|
65
|
-
env["PATH_INFO"].gsub!("/#{::ClassyAssets.config.asset_prefix}", '')
|
66
|
-
status, headers, body = ::ClassyAssets.sprockets.call(env)
|
60
|
+
status, headers, body = serve_sprockets_asset(env)
|
67
61
|
end
|
68
62
|
|
69
63
|
[status, headers, body]
|
@@ -71,14 +65,17 @@ module Rack
|
|
71
65
|
|
72
66
|
def serve_asset(env)
|
73
67
|
if asset_path_exists?(env['PATH_INFO'])
|
74
|
-
puts "ClassyAssets: asset path exists"
|
75
68
|
status, headers, body = @file_server.call(env)
|
76
69
|
else
|
77
|
-
|
78
|
-
status, headers, body = ::ClassyAssets.sprockets.call(env)
|
70
|
+
status, headers, body = serve_sprockets_asset(env)
|
79
71
|
end
|
80
72
|
|
81
73
|
[status, headers, body]
|
82
74
|
end
|
75
|
+
|
76
|
+
def serve_sprockets_asset(env)
|
77
|
+
env["PATH_INFO"].gsub!("/#{::ClassyAssets.config.asset_prefix}", '')
|
78
|
+
::ClassyAssets.sprockets.call(env)
|
79
|
+
end
|
83
80
|
end
|
84
81
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: classy_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- StyleSeek Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sprockets
|