utopia 0.9.55 → 0.9.56

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,6 +30,8 @@ module Utopia
30
30
 
31
31
  @default_locale = options[:default] || "en"
32
32
  @all_locales = options[:all] || ["en"]
33
+
34
+ @nonlocalized = options[:nonlocalized] || []
33
35
  end
34
36
 
35
37
  def named_locale(resource_name)
@@ -55,7 +57,28 @@ module Utopia
55
57
  return [localized_path, @app.call(localization_probe)]
56
58
  end
57
59
 
60
+ def nonlocalized?(env)
61
+ @nonlocalized.each do |pattern|
62
+ case pattern
63
+ when String
64
+ return true if pattern == env["PATH_INFO"]
65
+ when Regexp
66
+ return true if pattern.match(env["PATH_INFO"])
67
+ when pattern.respond_to?(:call)
68
+ return true if pattern.call(env)
69
+ end
70
+ end
71
+
72
+ return false
73
+ end
74
+
58
75
  def call(env)
76
+ # Check for a non-localized resource.
77
+ if nonlocalized?(env)
78
+ return @app.call(env)
79
+ end
80
+
81
+ # Otherwise, we need to check if the resource has been localized based on the request and referer parameters.
59
82
  path = Path.create(env["PATH_INFO"])
60
83
  env["utopia.localization"] = self
61
84
 
@@ -0,0 +1 @@
1
+ This is a place-holder file so that this directory is created correctly.
@@ -0,0 +1 @@
1
+ This is a place-holder file so that this directory is created correctly.
@@ -44,6 +44,9 @@ use Utopia::Middleware::Redirector, {
44
44
  use Utopia::Middleware::Requester
45
45
  use Utopia::Middleware::DirectoryIndex
46
46
  use Utopia::Middleware::Controller
47
+
48
+ # To enable full Sendfile support, please refer to the Rack::Sendfile documentation for your webserver.
49
+ use Rack::Sendfile
47
50
  use Utopia::Middleware::Static
48
51
 
49
52
  if UTOPIA_ENV == :production
@@ -6,7 +6,7 @@ module Utopia
6
6
  module VERSION
7
7
  MAJOR = 0
8
8
  MINOR = 9
9
- TINY = 55
9
+ TINY = 56
10
10
 
11
11
  STRING = [MAJOR, MINOR, TINY].join('.')
12
12
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utopia
3
3
  version: !ruby/object:Gem::Version
4
- hash: 85
4
+ hash: 75
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 55
10
- version: 0.9.55
9
+ - 56
10
+ version: 0.9.56
11
11
  platform: ruby
12
12
  authors:
13
13
  - Samuel Williams
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-30 00:00:00 +12:00
18
+ date: 2011-07-01 00:00:00 +12:00
19
19
  default_executable: utopia
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -124,6 +124,8 @@ files:
124
124
  - lib/utopia/path.rb
125
125
  - lib/utopia/session/encrypted_cookie.rb
126
126
  - lib/utopia/setup/access_log/readme.txt
127
+ - lib/utopia/setup/cache/head/readme.txt
128
+ - lib/utopia/setup/cache/meta/readme.txt
127
129
  - lib/utopia/setup/config.ru
128
130
  - lib/utopia/setup/lib/readme.txt
129
131
  - lib/utopia/setup/pages/_heading.xnode