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.
@@ -15,4 +15,5 @@ end
15
15
  view_helper
16
16
  ).each{|f| require "rad/assets/#{f}"}
17
17
 
18
+
18
19
  Rad::Template::Context.include Rad::Assets::ViewHelper
@@ -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
- if path != '/' and (!@filter or (@filter and @filter =~ path)) and (resolved_path = find_file(path))
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
- http_path = http_path.sub rad.assets.static_path_prefix, ''
21
- fs_path = assets.fs_path http_path
22
- fs_path.sub rad.http.public_path, '' if fs_path
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rad_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: