fakefs 0.10.0 → 0.10.1

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: bdc55366cd1a531eceb0949ebd37d8bc88672e70
4
- data.tar.gz: 653187bd94890e9f97e34a04549f9e66dd860cfc
3
+ metadata.gz: 0c03fdf5b7df7f95245c25016ce671ca0d128edc
4
+ data.tar.gz: 2eca67ca2151d1c6763a1a560b6a10f7b3942fde
5
5
  SHA512:
6
- metadata.gz: 7ac2c9c60bde681b7dbcbf135ec769fa7f5af8145dbf7aa2f231a4a8dd77180a9ae6cbc95b4b9eef5fe797fd020a9d9a8ff4122896320bc55484a5549838393c
7
- data.tar.gz: fc995906267e125839d239d84b780a003e5fae7963bb87695686a29a6ae9983ea4c7437e1117aa10827b4203ee7d0cb099ede0f1a25e10d7ad74a09718b1fead
6
+ metadata.gz: eca7bba56ed5cee735c0bb3ad0c8a1b662ac7f48bd7f1a35e97fac032709568e7502973d95b9397de7b161dc883bbbbcda77a4cded668c75c30fb222db2a8bf2
7
+ data.tar.gz: fd6a82e87eb2d2dc9d4e66e5d7c23ae15c9047c74ba2882fca47547933795e3b706bee7101a0ec0cacada7b6615d1b3151956cfb364cb96c8f66ae4a304c74cf
data/lib/fakefs/dir.rb CHANGED
@@ -104,13 +104,14 @@ module FakeFS
104
104
  end.sort
105
105
  end
106
106
 
107
- if pattern.is_a? Array
108
- files = pattern.map do |matcher|
109
- matches_for_pattern.call matcher
110
- end.flatten
111
- else
112
- files = matches_for_pattern.call pattern
113
- end
107
+ files =
108
+ if pattern.is_a?(Array)
109
+ pattern.map do |matcher|
110
+ matches_for_pattern.call matcher
111
+ end.flatten
112
+ else
113
+ matches_for_pattern.call pattern
114
+ end
114
115
 
115
116
  block_given? ? files.each { |file| block.call(file) } : files
116
117
  end
data/lib/fakefs/file.rb CHANGED
@@ -4,15 +4,15 @@ module FakeFS
4
4
  # FakeFS File class inherit StringIO
5
5
  class File < StringIO
6
6
  MODES = [
7
- READ_ONLY = 'r',
8
- READ_WRITE = 'r+',
9
- WRITE_ONLY = 'w',
10
- READ_WRITE_TRUNCATE = 'w+',
11
- APPEND_WRITE_ONLY = 'a',
12
- APPEND_READ_WRITE = 'a+'
13
- ]
7
+ READ_ONLY = 'r'.freeze,
8
+ READ_WRITE = 'r+'.freeze,
9
+ WRITE_ONLY = 'w'.freeze,
10
+ READ_WRITE_TRUNCATE = 'w+'.freeze,
11
+ APPEND_WRITE_ONLY = 'a'.freeze,
12
+ APPEND_READ_WRITE = 'a+'.freeze
13
+ ].freeze
14
14
 
15
- FILE_CREATION_MODES = MODES - [READ_ONLY, READ_WRITE]
15
+ FILE_CREATION_MODES = (MODES - [READ_ONLY, READ_WRITE]).freeze
16
16
 
17
17
  MODE_BITMASK = RealFile::RDONLY |
18
18
  RealFile::WRONLY |
@@ -209,7 +209,12 @@ module FakeFS
209
209
  end
210
210
 
211
211
  if (target = FileSystem.find(source))
212
- FileSystem.add(dest, target.entry.clone)
212
+ if target.is_a?(FakeFS::FakeSymlink)
213
+ File.symlink(target.target, dest)
214
+ else
215
+ FileSystem.add(dest, target.entry.clone)
216
+ end
217
+
213
218
  FileSystem.delete(source)
214
219
  else
215
220
  fail Errno::ENOENT, "#{source} or #{dest}"
@@ -17,11 +17,12 @@ module FakeFS
17
17
  # usable with File.open, etc.
18
18
  TO_PATH = :to_path
19
19
 
20
- SAME_PATHS = if File::FNM_SYSCASE.nonzero?
21
- proc { |a, b| a.casecmp(b).zero? }
22
- else
23
- proc { |a, b| a == b }
24
- end
20
+ SAME_PATHS =
21
+ if File::FNM_SYSCASE.nonzero?
22
+ proc { |a, b| a.casecmp(b).zero? }
23
+ else
24
+ proc { |a, b| a == b }
25
+ end
25
26
 
26
27
  # :startdoc:
27
28
 
@@ -117,10 +118,10 @@ module FakeFS
117
118
 
118
119
  if File::ALT_SEPARATOR
119
120
  SEPARATOR_LIST = "#{Regexp.quote File::ALT_SEPARATOR}" \
120
- "#{Regexp.quote File::SEPARATOR}"
121
+ "#{Regexp.quote File::SEPARATOR}".freeze
121
122
  SEPARATOR_PAT = /[#{SEPARATOR_LIST}]/
122
123
  else
123
- SEPARATOR_LIST = "#{Regexp.quote File::SEPARATOR}"
124
+ SEPARATOR_LIST = "#{Regexp.quote File::SEPARATOR}".freeze
124
125
  SEPARATOR_PAT = /#{Regexp.quote File::SEPARATOR}/
125
126
  end
126
127
 
@@ -529,11 +530,12 @@ module FakeFS
529
530
  result = []
530
531
  Dir.foreach(@path) do |e|
531
532
  next if e == '.' || e == '..'
532
- if with_directory
533
- result << self.class.new(File.join(@path, e))
534
- else
535
- result << self.class.new(e)
536
- end
533
+ result <<
534
+ if with_directory
535
+ self.class.new(File.join(@path, e))
536
+ else
537
+ self.class.new(e)
538
+ end
537
539
  end
538
540
  result
539
541
  end
@@ -1,7 +1,7 @@
1
1
  module FakeFS
2
2
  # Version module
3
3
  module Version
4
- VERSION = '0.10.0'
4
+ VERSION = '0.10.1'.freeze
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.10.0
4
+ version: 0.10.1
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-11-10 00:00:00.000000000 Z
15
+ date: 2016-12-07 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bundler
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  version: '0'
158
158
  requirements: []
159
159
  rubyforge_project:
160
- rubygems_version: 2.4.5.1
160
+ rubygems_version: 2.5.1
161
161
  signing_key:
162
162
  specification_version: 4
163
163
  summary: A fake filesystem. Use it in your tests.