jamis-fuzzy_file_finder 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,14 +1,14 @@
1
1
 
2
- # Gem::Specification for Fuzzy_file_finder-1.0.2
2
+ # Gem::Specification for Fuzzy_file_finder-1.0.3
3
3
  # Originally generated by Echoe
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = %q{fuzzy_file_finder}
7
- s.version = "1.0.2"
7
+ s.version = "1.0.3"
8
8
 
9
9
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
10
10
  s.authors = ["Jamis Buck"]
11
- s.date = %q{2008-10-11}
11
+ s.date = %q{2008-10-12}
12
12
  s.description = %q{an implementation of TextMate's cmd-T search functionality}
13
13
  s.email = %q{jamis@jamisbuck.org}
14
14
  s.extra_rdoc_files = ["lib/fuzzy_file_finder.rb", "README.rdoc"]
@@ -37,7 +37,7 @@ class FuzzyFileFinder
37
37
  module Version
38
38
  MAJOR = 1
39
39
  MINOR = 0
40
- TINY = 2
40
+ TINY = 3
41
41
  STRING = [MAJOR, MINOR, TINY].join(".")
42
42
  end
43
43
 
@@ -284,7 +284,9 @@ class FuzzyFileFinder
284
284
  def match_path(path, path_matches, path_regex, path_segments)
285
285
  return path_matches[path] if path_matches.key?(path)
286
286
 
287
- matchable_name = path.name.sub(@shared_prefix_re, "")
287
+ name_with_slash = path.name + "/" # add a trailing slash for matching the prefix
288
+ matchable_name = name_with_slash.sub(@shared_prefix_re, "")
289
+ matchable_name.chop! # kill the trailing slash
288
290
 
289
291
  if path_regex
290
292
  match = matchable_name.match(path_regex)
@@ -302,8 +304,9 @@ class FuzzyFileFinder
302
304
  def match_file(file, file_regex, path_match, &block)
303
305
  if file_match = file.name.match(file_regex)
304
306
  match_result = build_match_result(file_match, 1)
305
- full_match_result = File.join(path_match[:result], match_result[:result])
306
- abbr = File.join(path_match[:result].gsub(/[^\/]+/) { |m| m.index("(") ? m : m[0,1] }, match_result[:result])
307
+ full_match_result = path_match[:result].empty? ? match_result[:result] : File.join(path_match[:result], match_result[:result])
308
+ shortened_path = path_match[:result].gsub(/[^\/]+/) { |m| m.index("(") ? m : m[0,1] }
309
+ abbr = shortened_path.empty? ? match_result[:result] : File.join(shortened_path, match_result[:result])
307
310
 
308
311
  result = { :path => file.path,
309
312
  :abbr => abbr,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jamis-fuzzy_file_finder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamis Buck
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-11 00:00:00 -07:00
12
+ date: 2008-10-12 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15