hike 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/hike.rb +1 -1
  2. data/lib/hike/trail.rb +5 -6
  3. metadata +4 -4
@@ -1,5 +1,5 @@
1
1
  module Hike
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
 
4
4
  autoload :DirectoryIndex, "hike/directory_index"
5
5
  autoload :Extensions, "hike/extensions"
@@ -41,7 +41,7 @@ module Hike
41
41
 
42
42
  def filename_pattern_for(basename)
43
43
  extension_pattern = extensions.map { |e| Regexp.escape(e) }.join("|")
44
- /^#{Regexp.escape(basename)}(?:#{extension_pattern}|)$/
44
+ /^#{Regexp.escape(basename)}(?:#{extension_pattern}|)+$/
45
45
  end
46
46
 
47
47
  def match_from(matches, basename)
@@ -53,11 +53,10 @@ module Hike
53
53
  end
54
54
 
55
55
  def ordered_match_from(matches, basename)
56
- extensions.each do |extension|
57
- candidate = basename + extension
58
- return candidate if matches.include?(candidate)
59
- end
60
- basename
56
+ matches.sort_by do |match|
57
+ extnames = match[basename.length..-1].scan(/.[^.]+/)
58
+ extnames.inject(0) { |sum, ext| sum + extensions.index(ext) + 1 }
59
+ end.first
61
60
  end
62
61
  end
63
62
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hike
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sam Stephenson
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-30 00:00:00 -05:00
18
+ date: 2010-11-07 01:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies: []
21
21