sys-filesystem 1.1.6 → 1.1.9
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 +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGES +18 -0
- data/README +1 -7
- data/certs/djberg96_pub.pem +15 -15
- data/lib/sys/filesystem.rb +1 -1
- data/lib/sys/unix/sys/filesystem.rb +4 -7
- data/lib/sys/unix/sys/filesystem/structs.rb +11 -2
- data/lib/sys/windows/sys/filesystem.rb +22 -18
- data/sys-filesystem.gemspec +1 -1
- data/test/test_sys_filesystem_unix.rb +13 -13
- data/test/test_sys_filesystem_windows.rb +17 -1
- metadata +31 -31
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 1f33933d030d3147fa24950695f5e5e2980d520bb600dfc70701087fc1935680
|
|
4
|
+
data.tar.gz: f5c1ee3037fbb6786b7147d4cd9ccd583baaa5284a4e4102dbd8ad868bf15f8b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d8f1f0bf6be3adb1f0cd8aaf1df21f0ef504af1c7818da93c1b66a98a54c02ada277de37c7310675db429b9e4b8f07c72b23e540d37a1b5f8994181aacc0e0ab
|
|
7
|
+
data.tar.gz: d564f2d9de62b360b6ebc7c3233fa90929d94c8e1e94ccab2f3b7ad1d85b40e8a2e13baaa600835c44e3171d7bff97053fd510a49e5256d16c2ada62ed7e9648
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data.tar.gz.sig
CHANGED
|
Binary file
|
data/CHANGES
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
== 1.1.9 - 26-Jan-2018
|
|
2
|
+
* The bytes_free and bytes_total methods were updated to use the fragment size
|
|
3
|
+
instead of the block size. This fixes Macs using APFS, as well as Solaris 10.
|
|
4
|
+
Thanks go to Mikhail Vasin for the spot.
|
|
5
|
+
* Removed the code specific to FreeBSD 10, which was ultimately an attempt
|
|
6
|
+
to address the issue now resolved by the above change.
|
|
7
|
+
* Updated the cert again.
|
|
8
|
+
|
|
9
|
+
== 1.1.8 - 2-Sep-2017
|
|
10
|
+
* The stat and mount_point methods now call to_s on the string argument
|
|
11
|
+
explicitly so that Pathname objects will now work with String#wincode.
|
|
12
|
+
* Updated some tests to avoid Fixnum warnings for Ruby 2.4.
|
|
13
|
+
* Updated the cert.
|
|
14
|
+
|
|
15
|
+
== 1.1.7 - 1-Aug-2016
|
|
16
|
+
* Fixed an issue in the stat method for MS Windows where the blocks_avail
|
|
17
|
+
value was not correct. Thanks go to Maxime Lapointe for the spot.
|
|
18
|
+
|
|
1
19
|
== 1.1.6 - 17-May-2016
|
|
2
20
|
* On versions that use setmntent or fopen, explicitly raise an error if
|
|
3
21
|
either of those calls return a null value.
|
data/README
CHANGED
|
@@ -61,14 +61,8 @@
|
|
|
61
61
|
= License
|
|
62
62
|
Artistic 2.0
|
|
63
63
|
|
|
64
|
-
== Contributions
|
|
65
|
-
Although this library is free, please consider having your company
|
|
66
|
-
setup a gittip if used by your company professionally.
|
|
67
|
-
|
|
68
|
-
http://www.gittip.com/djberg96/
|
|
69
|
-
|
|
70
64
|
= Copyright
|
|
71
|
-
(C) 2003-
|
|
65
|
+
(C) 2003-2018 Daniel J. Berger
|
|
72
66
|
All Rights Reserved
|
|
73
67
|
|
|
74
68
|
= Warranty
|
data/certs/djberg96_pub.pem
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
|
2
2
|
MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl
|
|
3
3
|
cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
|
|
4
|
-
|
|
4
|
+
MB4XDTE3MDkwMzE1MjMxM1oXDTE4MDkwMzE1MjMxM1owPzERMA8GA1UEAwwIZGpi
|
|
5
5
|
ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ8y4kEssxNpAdPhNNw2
|
|
7
|
+
p4zkERFndPAnmOKDdErczFYYUA9uYpA7/iTjkLlNyRwvsNHpnMXdSF7vy++YIU+F
|
|
8
|
+
Ux3AGTmspupbdSzqBNUhSEJ9TmpjMer1dMYMR9fRw3r3qQreiO2u/O/tV4VpzrDj
|
|
9
|
+
28JC0b1PcKtfobxbnk+hporZqTH6ClOxDsRx+trlkr7q7FLZwTZn0ywjAV8WMVTO
|
|
10
|
+
SMmkzXQ37s2Nnrq6r+dDZI0voBxyQkAUzmdBOQTrvOFAo3tuWcnJNR/RRdFhJ9nK
|
|
11
|
+
mYMPmEd1z0s+cU0SUEeTvhGv/9LCmbSyZqKezDLYNR4Gb0FOA9D50+4OOi2+3G1o
|
|
12
|
+
1U0CAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFJCx
|
|
13
|
+
ukSSioTiLtwQCdML0IyEZAJ/MB0GA1UdEQQWMBSBEmRqYmVyZzk2QGdtYWlsLmNv
|
|
14
14
|
bTAdBgNVHRIEFjAUgRJkamJlcmc5NkBnbWFpbC5jb20wDQYJKoZIhvcNAQEFBQAD
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
ggEBAJh/dmRaTpJAUeJ2x9CEyy9gSP6SZjMeAwWgPNdowPDyw0JzlpBIrYiTnCYK
|
|
16
|
+
2OqxvIi8L38+rHw3KYL0fEyNqP3RbMl6+SljRwiU0JwEqj9e1pqIx99RTLKeI9PM
|
|
17
|
+
F8LxxmDHreGOaY4R8JBOMxys1wBkF/Iilx4qoT4LBn+DzraAlmYjr6O6itIxGten
|
|
18
|
+
NFJFS/tFBTTeNW6SJLdDnGd2b7vBBEd/ZpIhuZNxriU6FKWC5FJeBdAiuw6lqHun
|
|
19
|
+
QLLepVJthIvwmfc8AU5TJGMawtVAUHIWiuQPoBBVVKOkeEhioO0cV8UabKsKMbE8
|
|
20
|
+
VpiARrgH+4lYiRFJ+gKpIbSEJvk=
|
|
21
21
|
-----END CERTIFICATE-----
|
data/lib/sys/filesystem.rb
CHANGED
|
@@ -42,6 +42,8 @@ module Sys
|
|
|
42
42
|
MOUNT_FILE = '/etc/mtab'
|
|
43
43
|
elsif File.exist?('/etc/mnttab')
|
|
44
44
|
MOUNT_FILE = '/etc/mnttab'
|
|
45
|
+
elsif File.exist?('/proc/mounts')
|
|
46
|
+
MOUNT_FILE = '/proc/mounts'
|
|
45
47
|
else
|
|
46
48
|
MOUNT_FILE = 'getmntinfo'
|
|
47
49
|
end
|
|
@@ -126,12 +128,12 @@ module Sys
|
|
|
126
128
|
|
|
127
129
|
# Returns the total space on the partition.
|
|
128
130
|
def bytes_total
|
|
129
|
-
blocks *
|
|
131
|
+
blocks * fragment_size
|
|
130
132
|
end
|
|
131
133
|
|
|
132
134
|
# Returns the total amount of free space on the partition.
|
|
133
135
|
def bytes_free
|
|
134
|
-
blocks_available *
|
|
136
|
+
blocks_available * fragment_size
|
|
135
137
|
end
|
|
136
138
|
|
|
137
139
|
# Returns the total amount of used space on the partition.
|
|
@@ -217,11 +219,6 @@ module Sys
|
|
|
217
219
|
obj.block_size /= 256
|
|
218
220
|
end
|
|
219
221
|
|
|
220
|
-
# FreeBSD 10 does things a little differently too
|
|
221
|
-
if RbConfig::CONFIG['host_os'] =~ /freebsd10/i
|
|
222
|
-
obj.block_size = obj.fragment_size
|
|
223
|
-
end
|
|
224
|
-
|
|
225
222
|
if fs.members.include?(:f_basetype)
|
|
226
223
|
obj.base_type = fs[:f_basetype].to_s
|
|
227
224
|
end
|
|
@@ -5,6 +5,15 @@ module Sys
|
|
|
5
5
|
class Filesystem
|
|
6
6
|
module Structs
|
|
7
7
|
class Statfs < FFI::Struct
|
|
8
|
+
|
|
9
|
+
# FreeBSD 12.0 MNAMELEN from 88 => 1024.
|
|
10
|
+
MNAMELEN =
|
|
11
|
+
if RbConfig::CONFIG['host_os'] =~ /freebsd(.*)/i
|
|
12
|
+
$1.to_f < 12.0 ? 88 : 1024
|
|
13
|
+
else
|
|
14
|
+
88
|
|
15
|
+
end
|
|
16
|
+
|
|
8
17
|
if RbConfig::CONFIG['host_os'] =~ /bsd/i
|
|
9
18
|
layout(
|
|
10
19
|
:f_version, :uint32,
|
|
@@ -27,8 +36,8 @@ module Sys
|
|
|
27
36
|
:f_fsid, [:int32, 2],
|
|
28
37
|
:f_charspare, [:char, 80],
|
|
29
38
|
:f_fstypename, [:char, 16],
|
|
30
|
-
:f_mntfromname, [:char,
|
|
31
|
-
:f_mntonname, [:char,
|
|
39
|
+
:f_mntfromname, [:char, MNAMELEN],
|
|
40
|
+
:f_mntonname, [:char, MNAMELEN]
|
|
32
41
|
)
|
|
33
42
|
else
|
|
34
43
|
layout(
|
|
@@ -65,8 +65,7 @@ module Sys
|
|
|
65
65
|
# The total number of unused blocks.
|
|
66
66
|
attr_reader :blocks_free
|
|
67
67
|
|
|
68
|
-
# The total number of unused blocks available to unprivileged
|
|
69
|
-
# processes. Identical to +blocks+ at the moment.
|
|
68
|
+
# The total number of unused blocks available to unprivileged processes.
|
|
70
69
|
attr_reader :blocks_available
|
|
71
70
|
|
|
72
71
|
# Total number of files/inodes that can be created on the file system.
|
|
@@ -242,7 +241,7 @@ module Sys
|
|
|
242
241
|
# File.mount_point("C:\\Documents and Settings") # => "C:\\'
|
|
243
242
|
#
|
|
244
243
|
def self.mount_point(file)
|
|
245
|
-
wfile = FFI::MemoryPointer.from_string(file.wincode)
|
|
244
|
+
wfile = FFI::MemoryPointer.from_string(file.to_s.wincode)
|
|
246
245
|
|
|
247
246
|
if PathStripToRootW(wfile)
|
|
248
247
|
wfile.read_string(wfile.size).split("\000\000").first.tr(0.chr, '')
|
|
@@ -266,7 +265,7 @@ module Sys
|
|
|
266
265
|
total_bytes = FFI::MemoryPointer.new(:ulong_long)
|
|
267
266
|
|
|
268
267
|
mpoint = mount_point(path)
|
|
269
|
-
wpath = path.wincode
|
|
268
|
+
wpath = path.to_s.wincode
|
|
270
269
|
|
|
271
270
|
# We need this call for the 64 bit support
|
|
272
271
|
unless GetDiskFreeSpaceExW(wpath, bytes_avail, total_bytes, bytes_free)
|
|
@@ -277,24 +276,26 @@ module Sys
|
|
|
277
276
|
bytes_free = bytes_free.read_ulong_long
|
|
278
277
|
total_bytes = total_bytes.read_ulong_long
|
|
279
278
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
279
|
+
sectors_ptr = FFI::MemoryPointer.new(:ulong_long)
|
|
280
|
+
bytes_ptr = FFI::MemoryPointer.new(:ulong_long)
|
|
281
|
+
free_ptr = FFI::MemoryPointer.new(:ulong_long)
|
|
282
|
+
total_ptr = FFI::MemoryPointer.new(:ulong_long)
|
|
284
283
|
|
|
285
284
|
# We need this call for the total/cluster info, which is not in the Ex call.
|
|
286
|
-
unless GetDiskFreeSpaceW(wpath,
|
|
285
|
+
unless GetDiskFreeSpaceW(wpath, sectors_ptr, bytes_ptr, free_ptr, total_ptr)
|
|
287
286
|
raise SystemCallError.new('GetDiskFreeSpace', FFI.errno)
|
|
288
287
|
end
|
|
289
288
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
free = free.read_ulong_long
|
|
293
|
-
total = total.read_ulong_long
|
|
289
|
+
sectors_per_cluster = sectors_ptr.read_ulong_long
|
|
290
|
+
bytes_per_sector = bytes_ptr.read_ulong_long
|
|
294
291
|
|
|
295
|
-
|
|
296
|
-
|
|
292
|
+
free_ptr.free
|
|
293
|
+
total_ptr.free
|
|
294
|
+
|
|
295
|
+
block_size = sectors_per_cluster * bytes_per_sector
|
|
296
|
+
blocks_avail = bytes_avail / block_size
|
|
297
297
|
blocks_free = bytes_free / block_size
|
|
298
|
+
total_blocks = total_bytes / block_size
|
|
298
299
|
|
|
299
300
|
vol_name_ptr = FFI::MemoryPointer.new(:char, MAXPATH)
|
|
300
301
|
base_type_ptr = FFI::MemoryPointer.new(:char, MAXPATH)
|
|
@@ -303,7 +304,7 @@ module Sys
|
|
|
303
304
|
flags_ptr = FFI::MemoryPointer.new(:ulong)
|
|
304
305
|
|
|
305
306
|
bool = GetVolumeInformationW(
|
|
306
|
-
mpoint.wincode,
|
|
307
|
+
mpoint.to_s.wincode,
|
|
307
308
|
vol_name_ptr,
|
|
308
309
|
vol_name_ptr.size,
|
|
309
310
|
vol_serial_ptr,
|
|
@@ -314,7 +315,7 @@ module Sys
|
|
|
314
315
|
)
|
|
315
316
|
|
|
316
317
|
unless bool
|
|
317
|
-
raise SystemCallError.new('
|
|
318
|
+
raise SystemCallError.new('GetVolumeInformation', FFI.errno)
|
|
318
319
|
end
|
|
319
320
|
|
|
320
321
|
vol_serial = vol_serial_ptr.read_ulong
|
|
@@ -322,16 +323,19 @@ module Sys
|
|
|
322
323
|
flags = flags_ptr.read_ulong
|
|
323
324
|
base_type = base_type_ptr.read_string(base_type_ptr.size).tr(0.chr, '')
|
|
324
325
|
|
|
326
|
+
# Lets explicitly free our pointers
|
|
325
327
|
vol_name_ptr.free
|
|
326
328
|
vol_serial_ptr.free
|
|
327
329
|
name_max_ptr.free
|
|
328
330
|
flags_ptr.free
|
|
329
331
|
base_type_ptr.free
|
|
332
|
+
sectors_ptr.free
|
|
333
|
+
bytes_ptr.free
|
|
330
334
|
|
|
331
335
|
stat_obj = Stat.new
|
|
332
336
|
stat_obj.instance_variable_set(:@path, path)
|
|
333
337
|
stat_obj.instance_variable_set(:@block_size, block_size)
|
|
334
|
-
stat_obj.instance_variable_set(:@blocks,
|
|
338
|
+
stat_obj.instance_variable_set(:@blocks, total_blocks)
|
|
335
339
|
stat_obj.instance_variable_set(:@blocks_available, blocks_avail)
|
|
336
340
|
stat_obj.instance_variable_set(:@blocks_free, blocks_free)
|
|
337
341
|
stat_obj.instance_variable_set(:@name_max, name_max)
|
data/sys-filesystem.gemspec
CHANGED
|
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |spec|
|
|
4
4
|
spec.name = 'sys-filesystem'
|
|
5
|
-
spec.version = '1.1.
|
|
5
|
+
spec.version = '1.1.9'
|
|
6
6
|
spec.author = 'Daniel J. Berger'
|
|
7
7
|
spec.email = 'djberg96@gmail.com'
|
|
8
8
|
spec.homepage = 'https://github.com/djberg96/sys-filesystem'
|
|
@@ -25,7 +25,7 @@ class TC_Sys_Filesystem_Unix < Test::Unit::TestCase
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def test_version
|
|
28
|
-
assert_equal('1.1.
|
|
28
|
+
assert_equal('1.1.9', Filesystem::VERSION)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def test_stat_path
|
|
@@ -35,7 +35,7 @@ class TC_Sys_Filesystem_Unix < Test::Unit::TestCase
|
|
|
35
35
|
|
|
36
36
|
def test_stat_block_size
|
|
37
37
|
assert_respond_to(@stat, :block_size)
|
|
38
|
-
assert_kind_of(
|
|
38
|
+
assert_kind_of(Numeric, @stat.block_size)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def test_block_size_is_a_plausible_value
|
|
@@ -45,27 +45,27 @@ class TC_Sys_Filesystem_Unix < Test::Unit::TestCase
|
|
|
45
45
|
|
|
46
46
|
def test_stat_fragment_size
|
|
47
47
|
assert_respond_to(@stat, :fragment_size)
|
|
48
|
-
assert_kind_of(
|
|
48
|
+
assert_kind_of(Numeric, @stat.fragment_size)
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def test_stat_blocks
|
|
52
52
|
assert_respond_to(@stat, :blocks)
|
|
53
|
-
assert_kind_of(
|
|
53
|
+
assert_kind_of(Numeric, @stat.blocks)
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def test_stat_blocks_free
|
|
57
57
|
assert_respond_to(@stat, :blocks_free)
|
|
58
|
-
assert_kind_of(
|
|
58
|
+
assert_kind_of(Numeric, @stat.blocks_free)
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def test_stat_blocks_available
|
|
62
62
|
assert_respond_to(@stat, :blocks_available)
|
|
63
|
-
assert_kind_of(
|
|
63
|
+
assert_kind_of(Numeric, @stat.blocks_available)
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
def test_stat_files
|
|
67
67
|
assert_respond_to(@stat, :files)
|
|
68
|
-
assert_kind_of(
|
|
68
|
+
assert_kind_of(Numeric, @stat.files)
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
def test_inodes_alias
|
|
@@ -75,7 +75,7 @@ class TC_Sys_Filesystem_Unix < Test::Unit::TestCase
|
|
|
75
75
|
|
|
76
76
|
def test_stat_files_free
|
|
77
77
|
assert_respond_to(@stat, :files_free)
|
|
78
|
-
assert_kind_of(
|
|
78
|
+
assert_kind_of(Numeric, @stat.files_free)
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
def test_stat_inodes_free_alias
|
|
@@ -85,7 +85,7 @@ class TC_Sys_Filesystem_Unix < Test::Unit::TestCase
|
|
|
85
85
|
|
|
86
86
|
def test_stat_files_available
|
|
87
87
|
assert_respond_to(@stat, :files_available)
|
|
88
|
-
assert_kind_of(
|
|
88
|
+
assert_kind_of(Numeric, @stat.files_available)
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
def test_stat_inodes_available_alias
|
|
@@ -100,12 +100,12 @@ class TC_Sys_Filesystem_Unix < Test::Unit::TestCase
|
|
|
100
100
|
|
|
101
101
|
def test_stat_flags
|
|
102
102
|
assert_respond_to(@stat, :flags)
|
|
103
|
-
assert_kind_of(
|
|
103
|
+
assert_kind_of(Numeric, @stat.flags)
|
|
104
104
|
end
|
|
105
105
|
|
|
106
106
|
def test_stat_name_max
|
|
107
107
|
assert_respond_to(@stat, :name_max)
|
|
108
|
-
assert_kind_of(
|
|
108
|
+
assert_kind_of(Numeric, @stat.name_max)
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
def test_stat_base_type
|
|
@@ -232,7 +232,7 @@ class TC_Sys_Filesystem_Unix < Test::Unit::TestCase
|
|
|
232
232
|
msg = 'dump_frequency test skipped on this platform'
|
|
233
233
|
omit_if(@@solaris || @@freebsd || @@darwin, msg)
|
|
234
234
|
assert_respond_to(@mnt, :dump_frequency)
|
|
235
|
-
assert_kind_of(
|
|
235
|
+
assert_kind_of(Numeric, @mnt.dump_frequency)
|
|
236
236
|
end
|
|
237
237
|
|
|
238
238
|
def test_freq_alias
|
|
@@ -244,7 +244,7 @@ class TC_Sys_Filesystem_Unix < Test::Unit::TestCase
|
|
|
244
244
|
msg = 'pass_number test skipped on this platform'
|
|
245
245
|
omit_if(@@solaris || @@freebsd || @@darwin, msg)
|
|
246
246
|
assert_respond_to(@mnt, :pass_number)
|
|
247
|
-
assert_kind_of(
|
|
247
|
+
assert_kind_of(Numeric, @mnt.pass_number)
|
|
248
248
|
end
|
|
249
249
|
|
|
250
250
|
def test_passno_alias
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
require 'test-unit'
|
|
8
8
|
require 'sys/filesystem'
|
|
9
9
|
require 'rbconfig'
|
|
10
|
+
require 'pathname'
|
|
10
11
|
include Sys
|
|
11
12
|
|
|
12
13
|
class TC_Sys_Filesystem_Windows < Test::Unit::TestCase
|
|
@@ -19,7 +20,7 @@ class TC_Sys_Filesystem_Windows < Test::Unit::TestCase
|
|
|
19
20
|
end
|
|
20
21
|
|
|
21
22
|
test "version number is set to the expected value" do
|
|
22
|
-
assert_equal('1.1.
|
|
23
|
+
assert_equal('1.1.9', Filesystem::VERSION)
|
|
23
24
|
end
|
|
24
25
|
|
|
25
26
|
test "stat path works as expected" do
|
|
@@ -52,6 +53,11 @@ class TC_Sys_Filesystem_Windows < Test::Unit::TestCase
|
|
|
52
53
|
assert_kind_of(Fixnum, @stat.blocks_available)
|
|
53
54
|
end
|
|
54
55
|
|
|
56
|
+
test "block stats return expected relative values" do
|
|
57
|
+
assert_true(@stat.blocks >= @stat.blocks_free)
|
|
58
|
+
assert_true(@stat.blocks_free >= @stat.blocks_available)
|
|
59
|
+
end
|
|
60
|
+
|
|
55
61
|
test "stat files works as expected" do
|
|
56
62
|
assert_respond_to(@stat, :files)
|
|
57
63
|
assert_nil(@stat.files)
|
|
@@ -130,6 +136,12 @@ class TC_Sys_Filesystem_Windows < Test::Unit::TestCase
|
|
|
130
136
|
assert_equal("\\\\foo\\bar", Filesystem.mount_point("//foo/bar/baz"))
|
|
131
137
|
end
|
|
132
138
|
|
|
139
|
+
test "mount_point works with Pathname object" do
|
|
140
|
+
assert_nothing_raised{ Filesystem.mount_point(Pathname.new("C:/Users/foo")) }
|
|
141
|
+
assert_equal("C:\\", Filesystem.mount_point("C:\\Users\\foo"))
|
|
142
|
+
assert_equal("\\\\foo\\bar", Filesystem.mount_point("//foo/bar/baz"))
|
|
143
|
+
end
|
|
144
|
+
|
|
133
145
|
test "filesystem constants are defined" do
|
|
134
146
|
assert_not_nil(Filesystem::CASE_SENSITIVE_SEARCH)
|
|
135
147
|
assert_not_nil(Filesystem::CASE_PRESERVED_NAMES)
|
|
@@ -151,6 +163,10 @@ class TC_Sys_Filesystem_Windows < Test::Unit::TestCase
|
|
|
151
163
|
assert_nothing_raised{ Filesystem.stat("C://Program Files") }
|
|
152
164
|
end
|
|
153
165
|
|
|
166
|
+
test "stat singleton method accepts a Pathname object" do
|
|
167
|
+
assert_nothing_raised{ Filesystem.stat(Pathname.new("C://Program Files")) }
|
|
168
|
+
end
|
|
169
|
+
|
|
154
170
|
test "stat singleton method requires a single argument" do
|
|
155
171
|
assert_raise(ArgumentError){ Filesystem.stat }
|
|
156
172
|
assert_raise(ArgumentError){ Filesystem.stat(Dir.pwd, Dir.pwd) }
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sys-filesystem
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel J. Berger
|
|
@@ -12,25 +12,25 @@ cert_chain:
|
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
|
13
13
|
MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl
|
|
14
14
|
cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
|
|
15
|
-
|
|
15
|
+
MB4XDTE3MDkwMzE1MjMxM1oXDTE4MDkwMzE1MjMxM1owPzERMA8GA1UEAwwIZGpi
|
|
16
16
|
ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ8y4kEssxNpAdPhNNw2
|
|
18
|
+
p4zkERFndPAnmOKDdErczFYYUA9uYpA7/iTjkLlNyRwvsNHpnMXdSF7vy++YIU+F
|
|
19
|
+
Ux3AGTmspupbdSzqBNUhSEJ9TmpjMer1dMYMR9fRw3r3qQreiO2u/O/tV4VpzrDj
|
|
20
|
+
28JC0b1PcKtfobxbnk+hporZqTH6ClOxDsRx+trlkr7q7FLZwTZn0ywjAV8WMVTO
|
|
21
|
+
SMmkzXQ37s2Nnrq6r+dDZI0voBxyQkAUzmdBOQTrvOFAo3tuWcnJNR/RRdFhJ9nK
|
|
22
|
+
mYMPmEd1z0s+cU0SUEeTvhGv/9LCmbSyZqKezDLYNR4Gb0FOA9D50+4OOi2+3G1o
|
|
23
|
+
1U0CAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFJCx
|
|
24
|
+
ukSSioTiLtwQCdML0IyEZAJ/MB0GA1UdEQQWMBSBEmRqYmVyZzk2QGdtYWlsLmNv
|
|
25
25
|
bTAdBgNVHRIEFjAUgRJkamJlcmc5NkBnbWFpbC5jb20wDQYJKoZIhvcNAQEFBQAD
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
ggEBAJh/dmRaTpJAUeJ2x9CEyy9gSP6SZjMeAwWgPNdowPDyw0JzlpBIrYiTnCYK
|
|
27
|
+
2OqxvIi8L38+rHw3KYL0fEyNqP3RbMl6+SljRwiU0JwEqj9e1pqIx99RTLKeI9PM
|
|
28
|
+
F8LxxmDHreGOaY4R8JBOMxys1wBkF/Iilx4qoT4LBn+DzraAlmYjr6O6itIxGten
|
|
29
|
+
NFJFS/tFBTTeNW6SJLdDnGd2b7vBBEd/ZpIhuZNxriU6FKWC5FJeBdAiuw6lqHun
|
|
30
|
+
QLLepVJthIvwmfc8AU5TJGMawtVAUHIWiuQPoBBVVKOkeEhioO0cV8UabKsKMbE8
|
|
31
|
+
VpiARrgH+4lYiRFJ+gKpIbSEJvk=
|
|
32
32
|
-----END CERTIFICATE-----
|
|
33
|
-
date:
|
|
33
|
+
date: 2018-01-26 00:00:00.000000000 Z
|
|
34
34
|
dependencies:
|
|
35
35
|
- !ruby/object:Gem::Dependency
|
|
36
36
|
name: ffi
|
|
@@ -85,37 +85,37 @@ extra_rdoc_files:
|
|
|
85
85
|
- README
|
|
86
86
|
- MANIFEST
|
|
87
87
|
files:
|
|
88
|
+
- test
|
|
89
|
+
- test/test_sys_filesystem_windows.rb
|
|
90
|
+
- test/test_sys_filesystem_unix.rb
|
|
91
|
+
- test/test_sys_filesystem.rb
|
|
92
|
+
- CHANGES
|
|
93
|
+
- MANIFEST
|
|
94
|
+
- README
|
|
95
|
+
- Rakefile
|
|
96
|
+
- sys-filesystem.gemspec
|
|
88
97
|
- certs
|
|
89
98
|
- certs/djberg96_pub.pem
|
|
90
|
-
- CHANGES
|
|
91
99
|
- examples
|
|
92
100
|
- examples/example_stat.rb
|
|
93
101
|
- lib
|
|
102
|
+
- lib/sys-filesystem.rb
|
|
94
103
|
- lib/sys
|
|
95
|
-
- lib/sys/filesystem.rb
|
|
96
104
|
- lib/sys/unix
|
|
97
105
|
- lib/sys/unix/sys
|
|
98
106
|
- lib/sys/unix/sys/filesystem
|
|
107
|
+
- lib/sys/unix/sys/filesystem/structs.rb
|
|
99
108
|
- lib/sys/unix/sys/filesystem/constants.rb
|
|
100
109
|
- lib/sys/unix/sys/filesystem/functions.rb
|
|
101
|
-
- lib/sys/unix/sys/filesystem/structs.rb
|
|
102
110
|
- lib/sys/unix/sys/filesystem.rb
|
|
111
|
+
- lib/sys/filesystem.rb
|
|
103
112
|
- lib/sys/windows
|
|
104
113
|
- lib/sys/windows/sys
|
|
105
114
|
- lib/sys/windows/sys/filesystem
|
|
115
|
+
- lib/sys/windows/sys/filesystem/helper.rb
|
|
106
116
|
- lib/sys/windows/sys/filesystem/constants.rb
|
|
107
117
|
- lib/sys/windows/sys/filesystem/functions.rb
|
|
108
|
-
- lib/sys/windows/sys/filesystem/helper.rb
|
|
109
118
|
- lib/sys/windows/sys/filesystem.rb
|
|
110
|
-
- lib/sys-filesystem.rb
|
|
111
|
-
- MANIFEST
|
|
112
|
-
- Rakefile
|
|
113
|
-
- README
|
|
114
|
-
- sys-filesystem.gemspec
|
|
115
|
-
- test
|
|
116
|
-
- test/test_sys_filesystem.rb
|
|
117
|
-
- test/test_sys_filesystem_unix.rb
|
|
118
|
-
- test/test_sys_filesystem_windows.rb
|
|
119
119
|
homepage: https://github.com/djberg96/sys-filesystem
|
|
120
120
|
licenses:
|
|
121
121
|
- Artistic 2.0
|
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
136
136
|
version: '0'
|
|
137
137
|
requirements: []
|
|
138
138
|
rubyforge_project:
|
|
139
|
-
rubygems_version: 2.
|
|
139
|
+
rubygems_version: 2.7.2
|
|
140
140
|
signing_key:
|
|
141
141
|
specification_version: 4
|
|
142
142
|
summary: A Ruby interface for getting file system information.
|
metadata.gz.sig
CHANGED
|
Binary file
|