utopia 0.9.24 → 0.9.25

Sign up to get free protection for your applications and to get access to all the features.
@@ -39,7 +39,7 @@ class String
39
39
  end
40
40
 
41
41
  def to_title
42
- (" " + self).gsub(/[ \-_](.)/){" " + $1.upcase}
42
+ (" " + self).gsub(/[ \-_](.)/){" " + $1.upcase}.strip
43
43
  end
44
44
 
45
45
  def to_snake
@@ -239,15 +239,26 @@ module Utopia
239
239
  end
240
240
 
241
241
  if options[:sort]
242
+ sort_key = options[:sort]
243
+ sort_default = options[:sort_default] || 0
244
+
242
245
  links = links.sort do |a, b|
243
246
  result = nil
247
+
248
+ lhs = a[sort_key] || sort_default
249
+ rhs = b[sort_key] || sort_default
250
+
244
251
  begin
245
- result ||= (a[options[:sort]] <=> b[options[:sort]])
252
+ result ||= lhs <=> rhs
246
253
  rescue
247
254
  # LOG.debug("Invalid comparison between #{a.path} and #{b.path} using key #{options[:sort]}!")
248
255
  end
249
256
 
250
- result ||= (a.title <=> b.title)
257
+ if result == 0 || result == nil
258
+ a.title <=> b.title
259
+ else
260
+ result
261
+ end
251
262
  end
252
263
  end
253
264
 
@@ -115,7 +115,13 @@ module Utopia
115
115
  directory_path = File.join(@root, path.dirname.components, name)
116
116
 
117
117
  if File.directory? directory_path
118
- return [307, {"Location" => path.dirname.join([name, "index.#{extensions}"]).to_s}, []]
118
+ if extensions
119
+ index_path = [name, "index.#{extensions}"]
120
+ else
121
+ index_path = [name, "index"]
122
+ end
123
+
124
+ return [307, {"Location" => path.dirname.join(index_path).to_s}, []]
119
125
  end
120
126
 
121
127
  # Otherwise look up the node
@@ -17,7 +17,7 @@ module Utopia
17
17
  module VERSION #:nodoc:
18
18
  MAJOR = 0
19
19
  MINOR = 9
20
- TINY = 24
20
+ TINY = 25
21
21
 
22
22
  STRING = [MAJOR, MINOR, TINY].join('.')
23
23
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 24
9
- version: 0.9.24
8
+ - 25
9
+ version: 0.9.25
10
10
  platform: ruby
11
11
  authors:
12
12
  - Samuel Williams
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-16 00:00:00 +12:00
17
+ date: 2010-04-18 00:00:00 +12:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency