utopia 0.9.50 → 0.9.51

Sign up to get free protection for your applications and to get access to all the features.
@@ -81,6 +81,16 @@ module Utopia
81
81
  ExceptionRedirector = ExceptionHandler
82
82
 
83
83
  class Redirector
84
+ # Redirects a whole source tree to a destination tree, given by the roots.
85
+ def self.moved(source_root, destination_root)
86
+ return [
87
+ /^#{Regexp.escape(source_root)}(.*)$/,
88
+ lambda do |match|
89
+ [301, {"Location" => (destination_root + match[1]).to_s}, []]
90
+ end
91
+ ]
92
+ end
93
+
84
94
  private
85
95
  def normalize_strings(strings)
86
96
  normalized = {}
@@ -117,6 +127,14 @@ module Utopia
117
127
  @strings = options[:strings] || {}
118
128
  @patterns = options[:patterns] || {}
119
129
 
130
+ @patterns.collect! do |rule|
131
+ if Symbol === rule[0]
132
+ self.class.send(*rule)
133
+ else
134
+ rule
135
+ end
136
+ end
137
+
120
138
  @strings = normalize_strings(@strings)
121
139
  @patterns = normalize_patterns(@patterns)
122
140
 
@@ -6,7 +6,7 @@ module Utopia
6
6
  module VERSION
7
7
  MAJOR = 0
8
8
  MINOR = 9
9
- TINY = 50
9
+ TINY = 51
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: 95
4
+ hash: 93
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 50
10
- version: 0.9.50
9
+ - 51
10
+ version: 0.9.51
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-05-06 00:00:00 +12:00
18
+ date: 2011-05-24 00:00:00 +12:00
19
19
  default_executable: utopia
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency