fakefs 0.18.1 → 0.19.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b8f0d4485537e8357f305f9d095421de79719f65ada17d30c21443d8f331649
4
- data.tar.gz: f2cc6f45b43483d18552d92aa2fcc39e8112bb0a0ed5ce17ed05c8ae92410903
3
+ metadata.gz: cf89043900e25034c9e9c2072e3e22f24f66456821693fc391f4b09337db6e79
4
+ data.tar.gz: 5a522c214d0373e804a7b1e2cb38ea223283cfa1caa25f625df344746230d9fb
5
5
  SHA512:
6
- metadata.gz: 4fadd520bccc2df062eec7b09324c2d80e3df433d74a969b965dc362e2e7b853ee4f5975688b8eceb325ed4170b580583bebfa34a43e3a8a7d77ca7376f4cc52
7
- data.tar.gz: 7646dfab7046723fae643785d606ef9a2ab366231780aa63d4e6bce2a20c38688332688f4890573a51df5641dbeade4c6f5a73da38aac9571e9d9b2df92a500e
6
+ metadata.gz: 4faacf937d0a705649022219dc67c4e5e7b84488fbdb60bf162a680655b3f7e03d986bd6cfcc166eb6260f71be9d5ab5086d3aed5adff2b9aed390242282b465
7
+ data.tar.gz: 70eaf5ae57fc369423729af31d6eb160980a987a530a69bc8cf9b5dcb292631d1f084a02d2934451edc76b8c27041355a3869b7855360922295cb00eb13eef80
@@ -7,7 +7,7 @@ module FakeFS
7
7
  attr_reader :path
8
8
 
9
9
  def self._check_for_valid_file(path)
10
- raise Errno::ENOENT, path unless FileSystem.find(path)
10
+ raise Errno::ENOENT, path.to_s unless FileSystem.find(path)
11
11
  end
12
12
 
13
13
  def initialize(string)
@@ -80,7 +80,7 @@ module FakeFS
80
80
 
81
81
  def self.delete(string)
82
82
  _check_for_valid_file(string)
83
- raise Errno::ENOTEMPTY, string unless FileSystem.find(string).empty?
83
+ raise Errno::ENOTEMPTY, string.to_s unless FileSystem.find(string).empty?
84
84
 
85
85
  FileSystem.delete(string)
86
86
  end
@@ -186,7 +186,7 @@ module FakeFS
186
186
  file = new(path, options)
187
187
 
188
188
  raise Errno::ENOENT unless file.exists?
189
- raise Errno::EISDIR, path if directory?(path)
189
+ raise Errno::EISDIR, path.to_s if directory?(path)
190
190
 
191
191
  FileSystem.find(path).atime = Time.now
192
192
  file.seek(offset)
@@ -255,7 +255,7 @@ module FakeFS
255
255
 
256
256
  def self.delete(*file_names)
257
257
  file_names.each do |file_name|
258
- raise Errno::ENOENT, file_name unless exists?(file_name)
258
+ raise Errno::ENOENT, file_name.to_s unless exists?(file_name)
259
259
 
260
260
  FileUtils.rm(file_name)
261
261
  end
@@ -338,7 +338,7 @@ module FakeFS
338
338
  attr_reader :birthtime
339
339
 
340
340
  def initialize(file, lstat = false)
341
- raise(Errno::ENOENT, file) unless File.exist?(file)
341
+ raise(Errno::ENOENT, file.to_s) unless File.exist?(file)
342
342
 
343
343
  @file = file
344
344
  @fake_file = FileSystem.find(@file)
@@ -857,7 +857,7 @@ module FakeFS
857
857
  end
858
858
 
859
859
  def check_file_existence!
860
- raise Errno::ENOENT, @path unless @file
860
+ raise Errno::ENOENT, @path.to_s unless @file
861
861
  end
862
862
 
863
863
  def file_creation_mode?
@@ -879,7 +879,7 @@ module FakeFS
879
879
  # Create a missing file if the path is valid.
880
880
  #
881
881
  def create_missing_file
882
- raise Errno::EISDIR, path if File.directory?(@path)
882
+ raise Errno::EISDIR, path.to_s if File.directory?(@path)
883
883
 
884
884
  return if File.exist?(@path) # Unnecessary check, probably.
885
885
  dirname = RealFile.dirname @path
@@ -887,7 +887,7 @@ module FakeFS
887
887
  unless dirname == '.'
888
888
  dir = FileSystem.find dirname
889
889
 
890
- raise Errno::ENOENT, path unless dir.is_a? FakeDir
890
+ raise Errno::ENOENT, path.to_s unless dir.is_a? FakeDir
891
891
  end
892
892
 
893
893
  @file = FileSystem.add(path, FakeFile.new)
@@ -85,12 +85,12 @@ module FakeFS
85
85
 
86
86
  def chdir(dir, &blk)
87
87
  new_dir = find(dir)
88
- dir_levels.push dir if blk
88
+ dir_levels.push dir.to_s if blk
89
89
 
90
- raise Errno::ENOENT, dir unless new_dir
91
- raise Errno::ENOTDIR, dir unless File.directory? new_dir
90
+ raise Errno::ENOENT, dir.to_s unless new_dir
91
+ raise Errno::ENOTDIR, dir.to_s unless File.directory? new_dir
92
92
 
93
- dir_levels.push dir unless blk
93
+ dir_levels.push dir.to_s unless blk
94
94
  yield(dir) if blk
95
95
  ensure
96
96
  dir_levels.pop if blk
@@ -34,12 +34,12 @@ module FakeFS
34
34
  def mkdir(list, _ignored_options = {})
35
35
  list = [list] unless list.is_a?(Array)
36
36
  list.each do |path|
37
- parent = path.split('/')
37
+ parent = path.to_s.split('/')
38
38
  parent.pop
39
39
  unless parent.join == '' || parent.join == '.' || FileSystem.find(parent.join('/'))
40
- raise Errno::ENOENT, path
40
+ raise Errno::ENOENT, path.to_s
41
41
  end
42
- raise Errno::EEXIST, path if FileSystem.find(path)
42
+ raise Errno::EEXIST, path.to_s if FileSystem.find(path)
43
43
  FileSystem.add(path, FakeDir.new)
44
44
  end
45
45
  end
@@ -47,11 +47,11 @@ module FakeFS
47
47
  def rmdir(list, _options = {})
48
48
  list = [list] unless list.is_a?(Array)
49
49
  list.each do |l|
50
- parent = l.split('/')
50
+ parent = l.to_s.split('/')
51
51
  parent.pop
52
- raise Errno::ENOENT, l unless parent.join == '' || FileSystem.find(parent.join('/'))
53
- raise Errno::ENOENT, l unless FileSystem.find(l)
54
- raise Errno::ENOTEMPTY, l unless FileSystem.find(l).empty?
52
+ raise Errno::ENOENT, l.to_s unless parent.join == '' || FileSystem.find(parent.join('/'))
53
+ raise Errno::ENOENT, l.to_s unless FileSystem.find(l)
54
+ raise Errno::ENOTEMPTY, l.to_s unless FileSystem.find(l).empty?
55
55
  rm(l)
56
56
  end
57
57
  end
@@ -59,7 +59,7 @@ module FakeFS
59
59
  def rm(list, options = {})
60
60
  Array(list).each do |path|
61
61
  FileSystem.delete(path) ||
62
- (!options[:force] && raise(Errno::ENOENT, path))
62
+ (!options[:force] && raise(Errno::ENOENT, path.to_s))
63
63
  end
64
64
  end
65
65
  alias rm_r rm
@@ -81,11 +81,11 @@ module FakeFS
81
81
 
82
82
  def ln_s(target, path, options = {})
83
83
  options = { force: false }.merge(options)
84
- raise(Errno::EEXIST, path) if FileSystem.find(path) && !options[:force]
84
+ raise(Errno::EEXIST, path.to_s) if FileSystem.find(path) && !options[:force]
85
85
  FileSystem.delete(path)
86
86
 
87
87
  if !options[:force] && !Dir.exist?(File.dirname(path))
88
- raise Errno::ENOENT, path
88
+ raise Errno::ENOENT, path.to_s
89
89
  end
90
90
 
91
91
  FileSystem.add(path, FakeSymlink.new(target))
@@ -98,7 +98,7 @@ module FakeFS
98
98
  alias symlink ln_s
99
99
 
100
100
  def cp(src, dest, options = {})
101
- raise Errno::ENOTDIR, dest if src.is_a?(Array) && !File.directory?(dest)
101
+ raise Errno::ENOTDIR, dest.to_s if src.is_a?(Array) && !File.directory?(dest)
102
102
 
103
103
  # handle `verbose' flag
104
104
  RealFileUtils.cp src, dest, options.merge(noop: true)
@@ -110,7 +110,7 @@ module FakeFS
110
110
  dst_file = FileSystem.find(dest)
111
111
  src_file = FileSystem.find(source)
112
112
 
113
- raise Errno::ENOENT, source unless src_file
113
+ raise Errno::ENOENT, source.to_s unless src_file
114
114
 
115
115
  if dst_file && File.directory?(dst_file)
116
116
  FileSystem.add(
@@ -150,16 +150,16 @@ module FakeFS
150
150
 
151
151
  Array(src).each do |source|
152
152
  dir = FileSystem.find(source)
153
- raise Errno::ENOENT, source unless dir
153
+ raise Errno::ENOENT, source.to_s unless dir
154
154
 
155
155
  new_dir = FileSystem.find(dest)
156
- raise Errno::EEXIST, dest if new_dir && !File.directory?(dest)
157
- raise Errno::ENOENT, dest if !new_dir && !FileSystem.find(dest + '/../')
156
+ raise Errno::EEXIST, dest.to_s if new_dir && !File.directory?(dest)
157
+ raise Errno::ENOENT, dest.to_s if !new_dir && !FileSystem.find(dest.to_s + '/../')
158
158
 
159
159
  # This last bit is a total abuse and should be thought hard
160
160
  # about and cleaned up.
161
161
  if new_dir
162
- if src[-2..-1] == '/.'
162
+ if src.to_s[-2..-1] == '/.'
163
163
  dir.entries.each { |f| new_dir[f.name] = f.clone(new_dir) }
164
164
  else
165
165
  new_dir[dir.name] = dir.entry.clone(new_dir)
@@ -188,16 +188,16 @@ module FakeFS
188
188
  dest
189
189
  end
190
190
  if File.directory?(dest_path)
191
- raise Errno::EEXIST, dest_path unless options[:force]
191
+ raise Errno::EEXIST, dest_path.to_s unless options[:force]
192
192
  elsif File.directory?(File.dirname(dest_path))
193
193
  FileSystem.delete(dest_path)
194
194
  FileSystem.delete(path)
195
195
  FileSystem.add(dest_path, target.entry.clone)
196
196
  else
197
- raise Errno::ENOENT, dest_path unless options[:force]
197
+ raise Errno::ENOENT, dest_path.to_s unless options[:force]
198
198
  end
199
199
  else
200
- raise Errno::ENOENT, path
200
+ raise Errno::ENOENT, path.to_s
201
201
  end
202
202
  end
203
203
 
@@ -220,7 +220,7 @@ module FakeFS
220
220
  end
221
221
  File.chown(uid, gid, f)
222
222
  else
223
- raise Errno::ENOENT, f
223
+ raise Errno::ENOENT, f.to_s
224
224
  end
225
225
  end
226
226
  list
@@ -243,7 +243,7 @@ module FakeFS
243
243
  if File.exist?(f)
244
244
  File.chmod(mode, f)
245
245
  else
246
- raise Errno::ENOENT, f
246
+ raise Errno::ENOENT, f.to_s
247
247
  end
248
248
  end
249
249
  list
@@ -1,7 +1,7 @@
1
1
  module FakeFS
2
2
  # Version module
3
3
  module Version
4
- VERSION = '0.18.1'.freeze
4
+ VERSION = '0.19.0'.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.18.1
4
+ version: 0.19.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: 2019-01-16 00:00:00.000000000 Z
15
+ date: 2019-02-09 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bump