fakefs 3.0.0 → 3.0.1

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: 5e3224ff5a1d920e4564617bcb22fa5a7ece1e956cd8d4ea5602f3486780ac2f
4
- data.tar.gz: 66ee5d6658990778978ed1531c115ae28ad08414cf9aa1bc90f6fd7e6400b22f
3
+ metadata.gz: 1e08faef6f68079adb9d714e2f5b28ab19f6502f636b7cced858fc2dd8f9feca
4
+ data.tar.gz: 975d872ac50fc21b632b14c34f9b9a5bb20e2efe3ba5f5f05b98e166cd183569
5
5
  SHA512:
6
- metadata.gz: 42daab712ce7b73ca3ffef7b383834eac7e624bdbf43e4098000fdca7d16cc92d505a5631e256248734962d8db7cb148842d4efc1853686f9cbe5d8b288c6c89
7
- data.tar.gz: 5514fc676ba615bd6387ad44cc3fa447fc566e265178729d8bb30a4098834e11a9f562f6cc8f25cc88b2c9d386827cc67506b46226008241510c67edbbeb6f81
6
+ metadata.gz: b44203007feb73426b81d63f96824c0712fadc5bc08f5622d159450cdaecd6afd7b7a31c5c69ba561f221160190ae00de4c67c39b93470a27be58e522aee8001
7
+ data.tar.gz: 30c2f8c8c74e68640ba042271c40b1e4da750c71ff44432417f208378645ef5620193e44aa75225260f6fbbf7fe010d1083e578ee857baba07eb610a43a7a867
data/lib/fakefs/dir.rb CHANGED
@@ -40,7 +40,7 @@ module FakeFS
40
40
  end
41
41
 
42
42
  def children
43
- each.to_a
43
+ each.to_a - ['.', '..']
44
44
  end
45
45
 
46
46
  def pos
data/lib/fakefs/file.rb CHANGED
@@ -48,6 +48,9 @@ module FakeFS
48
48
  (RealFile.const_defined?(:SYNC) ? RealFile::SYNC : 0)
49
49
  )
50
50
 
51
+ DEFAULT_DIR_SIZE = 64
52
+ DIR_ENTRY_SIZE = 32
53
+
51
54
  def self.extname(path)
52
55
  RealFile.extname(path)
53
56
  end
@@ -90,37 +93,24 @@ module FakeFS
90
93
  File.lstat(path).writable?
91
94
  end
92
95
 
93
- def self.mtime(path)
94
- if exist?(path)
95
- FileSystem.find(path).mtime
96
- else
97
- raise Errno::ENOENT
98
- end
99
- end
100
-
101
- def self.ctime(path)
102
- if exist?(path)
103
- FileSystem.find(path).ctime
104
- else
105
- raise Errno::ENOENT
106
- end
107
- end
108
-
109
- def self.atime(path)
110
- if exist?(path)
111
- FileSystem.find(path).atime
112
- else
113
- raise Errno::ENOENT
96
+ [:mtime, :ctime, :atime].each do |time_method|
97
+ define_singleton_method(time_method) do |path|
98
+ if (file_node = FileSystem.find(path))
99
+ file_node.send(time_method)
100
+ else
101
+ raise Errno::ENOENT, "No such file or directory - #{path}"
102
+ end
114
103
  end
115
104
  end
116
105
 
117
106
  def self.utime(atime, mtime, *paths)
118
107
  paths.each do |path|
119
- if exist?(path)
120
- FileSystem.find(path).atime = atime
121
- FileSystem.find(path).mtime = mtime
108
+ file_node = FileSystem.find(path)
109
+ if file_node
110
+ file_node.atime = atime
111
+ file_node.mtime = mtime
122
112
  else
123
- raise Errno::ENOENT
113
+ raise Errno::ENOENT, "No such file or directory - #{path}"
124
114
  end
125
115
  end
126
116
 
@@ -129,7 +119,7 @@ module FakeFS
129
119
 
130
120
  def self.size(path)
131
121
  if directory?(path)
132
- 64 + (32 * FileSystem.find(path).entries.size)
122
+ DEFAULT_DIR_SIZE + (DIR_ENTRY_SIZE * FileSystem.find(path).entries.size)
133
123
  else
134
124
  read(path).bytesize
135
125
  end
@@ -3,7 +3,7 @@
3
3
  module FakeFS
4
4
  # Version module
5
5
  module Version
6
- VERSION = '3.0.0'
6
+ VERSION = '3.0.1'
7
7
 
8
8
  def self.to_s
9
9
  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: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Wanstrath
@@ -9,9 +9,10 @@ authors:
9
9
  - Jeff Hodges
10
10
  - Pat Nakajima
11
11
  - Brian Donovan
12
+ autorequire:
12
13
  bindir: bin
13
14
  cert_chain: []
14
- date: 2025-01-20 00:00:00.000000000 Z
15
+ date: 2025-08-03 00:00:00.000000000 Z
15
16
  dependencies:
16
17
  - !ruby/object:Gem::Dependency
17
18
  name: bump
@@ -159,6 +160,7 @@ homepage: https://github.com/fakefs/fakefs
159
160
  licenses:
160
161
  - MIT
161
162
  metadata: {}
163
+ post_install_message:
162
164
  rdoc_options: []
163
165
  require_paths:
164
166
  - lib
@@ -173,7 +175,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
175
  - !ruby/object:Gem::Version
174
176
  version: '0'
175
177
  requirements: []
176
- rubygems_version: 3.6.2
178
+ rubygems_version: 3.4.10
179
+ signing_key:
177
180
  specification_version: 4
178
181
  summary: A fake filesystem. Use it in your tests.
179
182
  test_files: []