rack-offline 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,36 +9,40 @@ module Rails
9
9
 
10
10
  def initialize(options = {}, app = Rails.application, &block)
11
11
  config = app.config
12
- root = config.paths.public.to_a.first
13
-
14
- block = cache_block(Pathname.new(root)) unless block_given?
12
+ root = config.paths['public'].first
13
+ block = cache_block(Pathname.new(root)) unless block_given?
15
14
 
16
15
  opts = {
17
- :cache => config.cache_classes,
18
- :root => root,
16
+ :cache => config.cache_classes,
17
+ :root => root,
19
18
  :logger => Rails.logger
20
19
  }.merge(options)
21
20
 
22
- super opts, &block
21
+ super(opts, &block)
23
22
  end
24
23
 
25
24
  private
26
25
 
27
26
  def cache_block(root)
28
27
  Proc.new do
29
- files = Dir[
30
- "#{root}/**/*.html",
31
- "#{root}/stylesheets/**/*.css",
32
- "#{root}/javascripts/**/*.js",
33
- "#{root}/images/**/*.*"]
28
+ if Rails.version >= "3.1" && Rails.configuration.assets.enabled
29
+ files = Dir[
30
+ "#{root}/**/*.html",
31
+ "#{root}/assets/**/*.{js,css,jpg,png,gif}"]
32
+ else
33
+ files = Dir[
34
+ "#{root}/**/*.html",
35
+ "#{root}/stylesheets/**/*.css",
36
+ "#{root}/javascripts/**/*.js",
37
+ "#{root}/images/**/*.*"]
38
+ end
34
39
 
35
40
  files.each do |file|
36
41
  cache Pathname.new(file).relative_path_from(root)
37
42
  end
38
43
 
39
- network "/"
44
+ network "*"
40
45
  end
41
46
  end
42
-
43
47
  end
44
48
  end
@@ -83,7 +83,6 @@ module Rack
83
83
  def uncached_key
84
84
  now = Time.now.to_i - Time.now.to_i % @cache_interval
85
85
  Digest::SHA2.hexdigest(now.to_s)
86
- end
87
-
86
+ end
88
87
  end
89
- end
88
+ end
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class Offline
3
- VERSION = "0.6.2"
3
+ VERSION = "0.6.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-offline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-16 00:00:00.000000000 Z
12
+ date: 2012-09-07 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A Rack endpoint that generates cache manifests and other useful HTML5
15
15
  offline utilities that are useful on the server-side. Rack::Offline also provides
@@ -45,7 +45,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
45
45
  version: '0'
46
46
  requirements: []
47
47
  rubyforge_project: rack-offline
48
- rubygems_version: 1.8.8
48
+ rubygems_version: 1.8.24
49
49
  signing_key:
50
50
  specification_version: 3
51
51
  summary: A Rack toolkit for working with offline applications