sinatra-packrat 0.2.2 → 0.2.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/sinatra/packrat.rb +20 -6
- metadata +6 -8
data/lib/sinatra/packrat.rb
CHANGED
@@ -17,9 +17,14 @@ module Sinatra
|
|
17
17
|
# Allow settings.public to be an Array (or Enumerable...)
|
18
18
|
# for multiple-path static file lookup.
|
19
19
|
def static!
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
if settings.respond_to? :public_folder
|
21
|
+
cur_view = settings.public_folder || []
|
22
|
+
else
|
23
|
+
cur_view = settings.public || []
|
24
|
+
end
|
25
|
+
return if cur_view.nil?
|
26
|
+
if cur_view.respond_to? :each
|
27
|
+
cur_view.each do |dir|
|
23
28
|
public_dir = File.expand_path(dir)
|
24
29
|
path = File.expand_path(public_dir + unescape(request.path_info))
|
25
30
|
next unless path.start_with?(public_dir) and File.file?(path)
|
@@ -73,14 +78,23 @@ module Sinatra
|
|
73
78
|
end
|
74
79
|
|
75
80
|
def add_public_path(path)
|
76
|
-
|
81
|
+
if settings.respond_to? :public_folder
|
82
|
+
cur_view = settings.public_folder || []
|
83
|
+
else
|
84
|
+
cur_view = settings.public || []
|
85
|
+
end
|
77
86
|
|
78
87
|
if cur_view.class == String
|
79
88
|
cur_view = Array(cur_view)
|
80
89
|
end
|
81
90
|
|
82
91
|
cur_view << path
|
83
|
-
|
92
|
+
|
93
|
+
if settings.respond_to? :public_folder
|
94
|
+
set :public_folder, cur_view
|
95
|
+
else
|
96
|
+
set :public, cur_view
|
97
|
+
end
|
84
98
|
end
|
85
99
|
|
86
100
|
def register_modules_from_yaml(path)
|
@@ -143,4 +157,4 @@ module Sinatra
|
|
143
157
|
end
|
144
158
|
|
145
159
|
register Packrat
|
146
|
-
end
|
160
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-packrat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 3
|
10
|
+
version: 0.2.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brennan Roberts
|
@@ -16,8 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-09-21 00:00:00
|
20
|
-
default_executable:
|
19
|
+
date: 2011-09-21 00:00:00 Z
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
23
22
|
name: sinatra
|
@@ -25,7 +24,7 @@ dependencies:
|
|
25
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
25
|
none: false
|
27
26
|
requirements:
|
28
|
-
- -
|
27
|
+
- - ">="
|
29
28
|
- !ruby/object:Gem::Version
|
30
29
|
hash: 19
|
31
30
|
segments:
|
@@ -46,7 +45,6 @@ extra_rdoc_files: []
|
|
46
45
|
files:
|
47
46
|
- lib/sinatra/packrat.rb
|
48
47
|
- bin/packrat
|
49
|
-
has_rdoc: true
|
50
48
|
homepage: http://rubygems.org/gems/sinatra-packrat
|
51
49
|
licenses: []
|
52
50
|
|
@@ -76,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
74
|
requirements: []
|
77
75
|
|
78
76
|
rubyforge_project:
|
79
|
-
rubygems_version: 1.
|
77
|
+
rubygems_version: 1.8.15
|
80
78
|
signing_key:
|
81
79
|
specification_version: 3
|
82
80
|
summary: Sinatra extension to enable modular application design
|