rad_assets 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rad/assets/require.rb +1 -0
- data/lib/rad/assets/static_files.rb +12 -6
- metadata +1 -1
data/lib/rad/assets/require.rb
CHANGED
@@ -3,9 +3,10 @@ class Rad::Assets::StaticFiles < Rack::File
|
|
3
3
|
@app, @filter = app, filter
|
4
4
|
end
|
5
5
|
|
6
|
-
def call(env)
|
6
|
+
def call(env)
|
7
7
|
path = env["PATH_INFO"]
|
8
|
-
|
8
|
+
|
9
|
+
if path != '/' and (!@filter or (@filter and @filter =~ path)) and (resolved_path = find_file(path))
|
9
10
|
@path = resolved_path
|
10
11
|
serving(env)
|
11
12
|
else
|
@@ -16,9 +17,14 @@ class Rad::Assets::StaticFiles < Rack::File
|
|
16
17
|
protected
|
17
18
|
inject assets: :assets
|
18
19
|
|
19
|
-
def find_file http_path
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
def find_file http_path
|
21
|
+
if rad.production? and rad.http.public_path?
|
22
|
+
fs_path = "#{rad.http.public_path}#{http_path}"
|
23
|
+
fs_path if fs_path.to_file.exist?
|
24
|
+
else
|
25
|
+
http_path = http_path.sub rad.assets.static_path_prefix, ''
|
26
|
+
fs_path = assets.fs_path http_path
|
27
|
+
fs_path.sub rad.http.public_path, '' if fs_path
|
28
|
+
end
|
23
29
|
end
|
24
30
|
end
|