adamh-glob_fu 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/glob_fu.gemspec +1 -1
- data/lib/glob_fu.rb +3 -3
- data/spec/glob_fu_spec.rb +5 -0
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/glob_fu.gemspec
CHANGED
data/lib/glob_fu.rb
CHANGED
@@ -41,11 +41,11 @@ module GlobFu
|
|
41
41
|
|
42
42
|
suffix_regex = ""
|
43
43
|
if options[:extra_suffix]
|
44
|
-
suffix_regex << "
|
44
|
+
suffix_regex << "\\.#{Regexp.quote(options[:extra_suffix])}"
|
45
45
|
end
|
46
|
-
suffix_regex << "
|
46
|
+
suffix_regex << "\\.#{Regexp.quote(options[:suffix])}"
|
47
47
|
if options[:optional_suffix]
|
48
|
-
suffix_regex << "(
|
48
|
+
suffix_regex << "(\\.#{Regexp.quote(options[:optional_suffix])})?"
|
49
49
|
end
|
50
50
|
|
51
51
|
regex = %r{(/|^)#{basename_regex}#{suffix_regex}$}
|
data/spec/glob_fu_spec.rb
CHANGED
@@ -93,6 +93,11 @@ describe(GlobFu) do
|
|
93
93
|
f('x', :root => prefix, :suffix => 'txt', :extra_suffix => 'X').should == []
|
94
94
|
end
|
95
95
|
|
96
|
+
it('should need a dot before :extra_suffix') do
|
97
|
+
fs('xX.txt', 'xX.X.txt')
|
98
|
+
f('xX', :root => prefix, :suffix => 'txt', :extra_suffix => 'X').should == [ "#{prefix}/xX.X.txt" ]
|
99
|
+
end
|
100
|
+
|
96
101
|
it('should allow :extra_suffix and :optional_suffix in combination') do
|
97
102
|
fs('x.X.txt.gz')
|
98
103
|
f('x', :root => prefix, :suffix => 'txt', :extra_suffix => 'X', :optional_suffix => 'gz').should == ["#{prefix}/x.X.txt.gz"]
|