rack-offline 0.5.2 → 0.5.4

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.
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class Offline
3
- VERSION = "0.5.2"
3
+ VERSION = "0.5.4"
4
4
  end
5
5
  end
data/lib/rack-offline.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require "rack/offline"
2
2
 
3
3
  module Rails
4
- class Offline < Rack::Offline
4
+ class Offline < ::Rack::Offline
5
5
  def self.call(env)
6
6
  @app ||= new
7
7
  @app.call(env)
@@ -9,9 +9,9 @@ module Rails
9
9
 
10
10
  def initialize(app = Rails.application, &block)
11
11
  config = app.config
12
- root = Rails.public_path
12
+ root = config.paths.public.to_a.first
13
13
 
14
- block = cache_block unless block_given?
14
+ block = cache_block(Pathname.new(root)) unless block_given?
15
15
 
16
16
  opts = {
17
17
  :cache => config.cache_classes,
@@ -24,7 +24,7 @@ module Rails
24
24
 
25
25
  private
26
26
 
27
- def cache_block
27
+ def cache_block(root)
28
28
  Proc.new do
29
29
  files = Dir[
30
30
  "#{root}/**/*.html",
@@ -33,10 +33,9 @@ module Rails
33
33
  "#{root}/images/**"]
34
34
 
35
35
  files.each do |file|
36
- cache file.relative_path_from(root)
36
+ cache Pathname.new(file).relative_path_from(root)
37
37
  end
38
38
 
39
- cache *files
40
39
  network "/"
41
40
  end
42
41
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 2
9
- version: 0.5.2
8
+ - 4
9
+ version: 0.5.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Yehuda Katz
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-20 00:00:00 -07:00
17
+ date: 2010-04-21 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies: []
20
20