rack-offline 0.6.2 → 0.6.3
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.
- data/lib/rack-offline.rb +17 -13
- data/lib/rack/offline.rb +2 -3
- data/lib/rack/offline/version.rb +1 -1
- metadata +3 -3
data/lib/rack-offline.rb
CHANGED
@@ -9,36 +9,40 @@ module Rails
|
|
9
9
|
|
10
10
|
def initialize(options = {}, app = Rails.application, &block)
|
11
11
|
config = app.config
|
12
|
-
root
|
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
|
18
|
-
:root
|
16
|
+
:cache => config.cache_classes,
|
17
|
+
:root => root,
|
19
18
|
:logger => Rails.logger
|
20
19
|
}.merge(options)
|
21
20
|
|
22
|
-
super
|
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
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
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
|
data/lib/rack/offline.rb
CHANGED
data/lib/rack/offline/version.rb
CHANGED
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.
|
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:
|
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.
|
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
|