enhance 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/enhance/enhancer.rb +4 -3
- data/lib/enhance/version.rb +1 -1
- metadata +8 -2
data/lib/enhance/enhancer.rb
CHANGED
@@ -11,12 +11,12 @@ class Enhance::Enhancer
|
|
11
11
|
@command_path += "/" unless @command_path.blank?
|
12
12
|
@cache = options[:cache] || File.join(root, "tmp")
|
13
13
|
@max_side = options[:max_side] || 1024
|
14
|
-
@
|
14
|
+
@file_root = (options[:file_root] || root).to_s
|
15
|
+
@server = Rack::File.new(@file_root)
|
15
16
|
end
|
16
17
|
|
17
18
|
def call env
|
18
19
|
matches = env['PATH_INFO'].match /(?<filename>(#{@routes.join("|")}).*(#{@extensions.join("|")}))\/(?<geometry>.*)/i
|
19
|
-
p matches
|
20
20
|
if matches && !matches['filename'].include?("..")
|
21
21
|
dup._call env, matches
|
22
22
|
else
|
@@ -27,7 +27,8 @@ class Enhance::Enhancer
|
|
27
27
|
def _call env, matches
|
28
28
|
request = @folders.collect_first{|f| File.join(f, matches['filename']) if File.exists?(File.join(f, matches['filename']))}
|
29
29
|
|
30
|
-
if request && filename = convert(request, matches['filename'], CGI.unescape(matches['geometry']))
|
30
|
+
if request && filename = convert(request, matches['filename'], CGI.unescape(matches['geometry'])).gsub(@file_root, '')
|
31
|
+
env["PATH_INFO"] = filename
|
31
32
|
@server.call env
|
32
33
|
else
|
33
34
|
@app.call env
|
data/lib/enhance/version.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enhance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Guillaume Malette
|
@@ -25,6 +26,7 @@ dependencies:
|
|
25
26
|
requirements:
|
26
27
|
- - ">="
|
27
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
28
30
|
segments:
|
29
31
|
- 0
|
30
32
|
version: "0"
|
@@ -38,6 +40,7 @@ dependencies:
|
|
38
40
|
requirements:
|
39
41
|
- - ">="
|
40
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
41
44
|
segments:
|
42
45
|
- 0
|
43
46
|
version: "0"
|
@@ -51,6 +54,7 @@ dependencies:
|
|
51
54
|
requirements:
|
52
55
|
- - ">="
|
53
56
|
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
54
58
|
segments:
|
55
59
|
- 0
|
56
60
|
version: "0"
|
@@ -84,6 +88,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
84
88
|
requirements:
|
85
89
|
- - ">="
|
86
90
|
- !ruby/object:Gem::Version
|
91
|
+
hash: 3
|
87
92
|
segments:
|
88
93
|
- 0
|
89
94
|
version: "0"
|
@@ -92,6 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
97
|
requirements:
|
93
98
|
- - ">="
|
94
99
|
- !ruby/object:Gem::Version
|
100
|
+
hash: 3
|
95
101
|
segments:
|
96
102
|
- 0
|
97
103
|
version: "0"
|