fspath 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.markdown CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Better than Pathname
4
4
 
5
- Check out fspath-mac and fspath-xattr.
5
+ Check out [fspath-mac](https://rubygems.org/gems/fspath-mac) and [fspath-xattr](https://rubygems.org/gems/fspath-xattr).
6
6
 
7
7
  ## Synopsis
8
8
 
data/fspath.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'fspath'
5
- s.version = '2.0.3'
5
+ s.version = '2.0.4'
6
6
  s.summary = %q{Better than Pathname}
7
7
  s.homepage = "http://github.com/toy/#{s.name}"
8
8
  s.authors = ['Ivan Kuchin']
data/lib/fspath.rb CHANGED
@@ -96,13 +96,13 @@ class FSPath < Pathname
96
96
 
97
97
  # Escape characters in glob pattern
98
98
  def escape_glob
99
- self.class.new(@path.gsub(/([\*\?\[\]\{\}])/, '\\\\\1'))
99
+ self.class.new(escape_glob_string)
100
100
  end
101
101
 
102
102
  # Expand glob
103
103
  def glob(*args, &block)
104
104
  flags = args.last.is_a?(Fixnum) ? args.pop : nil
105
- args = [File.join(self, *args)]
105
+ args = [File.join(escape_glob_string, *args)]
106
106
  args << flags if flags
107
107
  self.class.glob(*args, &block)
108
108
  end
@@ -136,6 +136,12 @@ class FSPath < Pathname
136
136
  def parts(&block)
137
137
  split_names(@path).flatten
138
138
  end
139
+
140
+ private
141
+
142
+ def escape_glob_string
143
+ @path.gsub(/([\*\?\[\]\{\}])/, '\\\\\1')
144
+ end
139
145
  end
140
146
 
141
147
  module Kernel
data/spec/fspath_spec.rb CHANGED
@@ -1,4 +1,5 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
1
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
2
+ require 'rspec'
2
3
  require 'fspath'
3
4
 
4
5
  describe FSPath do
@@ -189,6 +190,11 @@ describe FSPath do
189
190
  FSPath.should_receive(:glob).with('a/b/c/**/*', @flags)
190
191
  FSPath('a/b/c').glob('**', '*', @flags)
191
192
  end
193
+
194
+ it "should escape glob characters in path itself" do
195
+ FSPath.should_receive(:glob).with('somewhere \[a b c\]/**/*')
196
+ FSPath('somewhere [a b c]').glob('**', '*')
197
+ end
192
198
  end
193
199
 
194
200
  describe "path parts" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fspath
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 3
10
- version: 2.0.3
9
+ - 4
10
+ version: 2.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ivan Kuchin
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-10 00:00:00 Z
18
+ date: 2012-03-05 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rspec
@@ -46,7 +46,6 @@ files:
46
46
  - fspath.gemspec
47
47
  - lib/fspath.rb
48
48
  - spec/fspath_spec.rb
49
- - spec/spec_helper.rb
50
49
  homepage: http://github.com/toy/fspath
51
50
  licenses:
52
51
  - MIT
@@ -76,11 +75,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
75
  requirements: []
77
76
 
78
77
  rubyforge_project: fspath
79
- rubygems_version: 1.8.13
78
+ rubygems_version: 1.8.17
80
79
  signing_key:
81
80
  specification_version: 3
82
81
  summary: Better than Pathname
83
82
  test_files:
84
83
  - spec/fspath_spec.rb
85
- - spec/spec_helper.rb
86
84
  has_rdoc:
data/spec/spec_helper.rb DELETED
@@ -1,2 +0,0 @@
1
- $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
2
- require 'rspec'