fakefs 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed6afbd6cc78d88527ac85b6bb0017a737a29b32
4
- data.tar.gz: 79904ccdd7d7974cbda597ff28d986fda601ef83
3
+ metadata.gz: 1756dfd4964229d1598029e509f5b24d467be877
4
+ data.tar.gz: 155b59626308b2de917a6856746ef4e3edc9acd7
5
5
  SHA512:
6
- metadata.gz: 72ba95d6739f30d35cb24735b20f94d919875bfe1576e43e51a868b7458e15e1978f52578f0ff4cb6b14c8da4b5a3d790577f8c6b70e0bb76998021156bb82ce
7
- data.tar.gz: 7fd93d529856d687558b60dc12b0a03056691b88673ca373f688615c0eee27b6a9fc71e0b7231d71c8dceb57542f852803cc055e54f0cc9243aa2557202d8812
6
+ metadata.gz: fac2235d6787be8205d1a5c748763e00fc0336398460b6b16e788f56668ec5f6eda261e3f8dbf00b88b1d4031a165c03a382cdc48629b13f7db10da558592bf5
7
+ data.tar.gz: 588986354e6fc268fea224d4a699a84e98bb894e486c6fd77f6e5675492370285cd831aa9aa2cf099d2ca84976ef7f7bc4117666e813993efcb11385bc734df0
@@ -4,6 +4,8 @@ module FakeFS
4
4
  extend self
5
5
 
6
6
  def expand(pattern)
7
+ pattern = pattern.to_s
8
+
7
9
  return [pattern] if pattern[0] != '{' || pattern[-1] != '}'
8
10
 
9
11
  part = ''
@@ -39,6 +41,8 @@ module FakeFS
39
41
  end
40
42
 
41
43
  def path_components(pattern)
44
+ pattern = pattern.to_s
45
+
42
46
  part = ''
43
47
  result = []
44
48
 
@@ -57,16 +61,27 @@ module FakeFS
57
61
  end
58
62
 
59
63
  def regexp(pattern)
64
+ pattern = pattern.to_s
65
+
60
66
  regex_body = pattern.gsub('.', '\.')
67
+ .gsub('+') { '\+' }
61
68
  .gsub('?', '.')
62
69
  .gsub('*', '.*')
63
70
  .gsub('(', '\(')
64
71
  .gsub(')', '\)')
65
72
  .gsub('$', '\$')
66
- .gsub(/\{(.*?)\}/) do
67
- "(#{Regexp.last_match[1].gsub(',', '|')})"
68
- end
69
- .gsub(/\A\./, '(?!\.).')
73
+
74
+ # This matches nested braces and attempts to do something correct most of the time
75
+ # There are known issues (i.e. {,*,*/*}) that cannot be resolved with out a total
76
+ # refactoring
77
+ loop do
78
+ break unless regex_body.gsub!(/(?<re>\{(?:(?>[^{}]+)|\g<re>)*\})/) do
79
+ "(#{Regexp.last_match[1][1..-2].gsub(',', '|')})"
80
+ end
81
+ end
82
+
83
+ regex_body = regex_body.gsub(/\A\./, '(?!\.).')
84
+
70
85
  /\A#{regex_body}\Z/
71
86
  end
72
87
 
@@ -1,7 +1,7 @@
1
1
  module FakeFS
2
2
  # Version module
3
3
  module Version
4
- VERSION = '0.8.1'
4
+ VERSION = '0.9.0'
5
5
 
6
6
  def self.to_s
7
7
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fakefs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Wanstrath
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2016-03-07 00:00:00.000000000 Z
15
+ date: 2016-06-29 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bundler
@@ -137,7 +137,7 @@ files:
137
137
  - lib/fakefs/safe.rb
138
138
  - lib/fakefs/spec_helpers.rb
139
139
  - lib/fakefs/version.rb
140
- homepage: https://github.com/defunkt/fakefs
140
+ homepage: https://github.com/fakefs/fakefs
141
141
  licenses:
142
142
  - MIT
143
143
  metadata: {}