sys-filesystem 1.1.7 → 1.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGES +6 -0
- data/certs/djberg96_pub.pem +15 -15
- data/lib/sys/filesystem.rb +1 -1
- data/lib/sys/unix/sys/filesystem.rb +2 -0
- data/lib/sys/unix/sys/filesystem/structs.rb +11 -2
- data/lib/sys/windows/sys/filesystem.rb +4 -4
- data/sys-filesystem.gemspec +1 -1
- data/test/test_sys_filesystem_unix.rb +13 -13
- data/test/test_sys_filesystem_windows.rb +12 -1
- metadata +18 -18
- metadata.gz.sig +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ab3e7d37b096548a4fab240e6416776c8068c43
|
4
|
+
data.tar.gz: 1f515589a8a40d73754f2b50b29d12f9a4015b51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9471253e1d27b50b98902cb384c8261e4907ca8315fe0cb8a1c297c7b759d9b5606b4249c78eec27423eab2e78de7579e2fa55f3a7505c80777ccdc2e98d1d97
|
7
|
+
data.tar.gz: 749d521d6a4780e32e093191ac12b8d7379d26f86072d28479b1dd5409df2372d0c4c8fc6f96d3a134630116d33af1cc6e7f79e9458265bc661a15ce6002a840
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGES
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 1.1.8 - 2-Sep-2017
|
2
|
+
* The stat and mount_point methods now call to_s on the string argument
|
3
|
+
explicitly so that Pathname objects will now work with String#wincode.
|
4
|
+
* Updated some tests to avoid Fixnum warnings for Ruby 2.4.
|
5
|
+
* Updated the cert.
|
6
|
+
|
1
7
|
== 1.1.7 - 1-Aug-2016
|
2
8
|
* Fixed an issue in the stat method for MS Windows where the blocks_avail
|
3
9
|
value was not correct. Thanks go to Maxime Lapointe for the spot.
|
data/certs/djberg96_pub.pem
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
2
|
MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl
|
3
3
|
cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
|
4
|
-
|
4
|
+
MB4XDTE2MDkxOTAzNDY0NVoXDTE3MDkxOTAzNDY0NVowPzERMA8GA1UEAwwIZGpi
|
5
5
|
ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM0eOHOQRpLOeqkyeK7O
|
7
|
+
DGHYLkO0Wq7gStVVVyHXahgyCopLN6JVBwGy5aCpKFcy5sFz2DdnISj+hQ7FctDa
|
8
|
+
yz6Lq9TvAF8Jkis8dDFLQKeHilB/AM4ssQAsGQyoQnoE4v5tCOSW4e3YHFDp/dMZ
|
9
|
+
s7Hkoim6PeEdkh4hB5LCa90OrHSPe8nlMFsVhRIGj86xNTRazEiWPZCOKmN9rZgW
|
10
|
+
ziheP/6hC2c7vNRevv5iE/K+NqaL/WOdMquOSZoF2mdBcoMIPDDBNzh/oHinPQ3N
|
11
|
+
1oOvoET0+Tj+O5tXX/L1TAsUrwZXlyrYGaZ5aYyoo/7r9pmvmbfgBqaU6JywT0EE
|
12
|
+
5x0CAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFO+k
|
13
|
+
C/3R+t2aIyIpwU5wPrAfYVL6MB0GA1UdEQQWMBSBEmRqYmVyZzk2QGdtYWlsLmNv
|
14
14
|
bTAdBgNVHRIEFjAUgRJkamJlcmc5NkBnbWFpbC5jb20wDQYJKoZIhvcNAQEFBQAD
|
15
|
-
|
16
|
-
|
17
|
-
/
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
ggEBAIJWpqQOUMoYhpm0wJ4kfiYv9rZVbpZ3L2cFYt4O6+wgbpdWP8DBBgZfCSQW
|
16
|
+
1J9miChMKdxZ8eOoeId79IMXN3IAcnalTFvD0Rp9ltaFZTXBfXMFqxQN3fHsIVwz
|
17
|
+
as/JSbwXo/PE8rULhjU+Utwcmji38cKEDWLAW4vsCBmwvBTwmAmcuHHKjnNvd8aR
|
18
|
+
YMrq9v505w8IjSysIO3KKysxCFuzoIPIYMdYswquvmtuTA+lpB9btWHr8n2FFsDp
|
19
|
+
A943I/wqE6xbYQpHxkndWo5uLDUbZh+XxG+fhZKpeqLIqHaFuU6wdO5odt32kB/B
|
20
|
+
nCjVswaVYlu1U2iLPCqE+MrjmTA=
|
21
21
|
-----END CERTIFICATE-----
|
data/lib/sys/filesystem.rb
CHANGED
@@ -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(
|
@@ -241,7 +241,7 @@ module Sys
|
|
241
241
|
# File.mount_point("C:\\Documents and Settings") # => "C:\\'
|
242
242
|
#
|
243
243
|
def self.mount_point(file)
|
244
|
-
wfile = FFI::MemoryPointer.from_string(file.wincode)
|
244
|
+
wfile = FFI::MemoryPointer.from_string(file.to_s.wincode)
|
245
245
|
|
246
246
|
if PathStripToRootW(wfile)
|
247
247
|
wfile.read_string(wfile.size).split("\000\000").first.tr(0.chr, '')
|
@@ -265,7 +265,7 @@ module Sys
|
|
265
265
|
total_bytes = FFI::MemoryPointer.new(:ulong_long)
|
266
266
|
|
267
267
|
mpoint = mount_point(path)
|
268
|
-
wpath = path.wincode
|
268
|
+
wpath = path.to_s.wincode
|
269
269
|
|
270
270
|
# We need this call for the 64 bit support
|
271
271
|
unless GetDiskFreeSpaceExW(wpath, bytes_avail, total_bytes, bytes_free)
|
@@ -304,7 +304,7 @@ module Sys
|
|
304
304
|
flags_ptr = FFI::MemoryPointer.new(:ulong)
|
305
305
|
|
306
306
|
bool = GetVolumeInformationW(
|
307
|
-
mpoint.wincode,
|
307
|
+
mpoint.to_s.wincode,
|
308
308
|
vol_name_ptr,
|
309
309
|
vol_name_ptr.size,
|
310
310
|
vol_serial_ptr,
|
@@ -315,7 +315,7 @@ module Sys
|
|
315
315
|
)
|
316
316
|
|
317
317
|
unless bool
|
318
|
-
raise SystemCallError.new('
|
318
|
+
raise SystemCallError.new('GetVolumeInformation', FFI.errno)
|
319
319
|
end
|
320
320
|
|
321
321
|
vol_serial = vol_serial_ptr.read_ulong
|
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.8'
|
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.8', 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.8', Filesystem::VERSION)
|
23
24
|
end
|
24
25
|
|
25
26
|
test "stat path works as expected" do
|
@@ -135,6 +136,12 @@ class TC_Sys_Filesystem_Windows < Test::Unit::TestCase
|
|
135
136
|
assert_equal("\\\\foo\\bar", Filesystem.mount_point("//foo/bar/baz"))
|
136
137
|
end
|
137
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
|
+
|
138
145
|
test "filesystem constants are defined" do
|
139
146
|
assert_not_nil(Filesystem::CASE_SENSITIVE_SEARCH)
|
140
147
|
assert_not_nil(Filesystem::CASE_PRESERVED_NAMES)
|
@@ -156,6 +163,10 @@ class TC_Sys_Filesystem_Windows < Test::Unit::TestCase
|
|
156
163
|
assert_nothing_raised{ Filesystem.stat("C://Program Files") }
|
157
164
|
end
|
158
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
|
+
|
159
170
|
test "stat singleton method requires a single argument" do
|
160
171
|
assert_raise(ArgumentError){ Filesystem.stat }
|
161
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.8
|
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
|
+
MB4XDTE2MDkxOTAzNDY0NVoXDTE3MDkxOTAzNDY0NVowPzERMA8GA1UEAwwIZGpi
|
16
16
|
ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM0eOHOQRpLOeqkyeK7O
|
18
|
+
DGHYLkO0Wq7gStVVVyHXahgyCopLN6JVBwGy5aCpKFcy5sFz2DdnISj+hQ7FctDa
|
19
|
+
yz6Lq9TvAF8Jkis8dDFLQKeHilB/AM4ssQAsGQyoQnoE4v5tCOSW4e3YHFDp/dMZ
|
20
|
+
s7Hkoim6PeEdkh4hB5LCa90OrHSPe8nlMFsVhRIGj86xNTRazEiWPZCOKmN9rZgW
|
21
|
+
ziheP/6hC2c7vNRevv5iE/K+NqaL/WOdMquOSZoF2mdBcoMIPDDBNzh/oHinPQ3N
|
22
|
+
1oOvoET0+Tj+O5tXX/L1TAsUrwZXlyrYGaZ5aYyoo/7r9pmvmbfgBqaU6JywT0EE
|
23
|
+
5x0CAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFO+k
|
24
|
+
C/3R+t2aIyIpwU5wPrAfYVL6MB0GA1UdEQQWMBSBEmRqYmVyZzk2QGdtYWlsLmNv
|
25
25
|
bTAdBgNVHRIEFjAUgRJkamJlcmc5NkBnbWFpbC5jb20wDQYJKoZIhvcNAQEFBQAD
|
26
|
-
|
27
|
-
|
28
|
-
/
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
ggEBAIJWpqQOUMoYhpm0wJ4kfiYv9rZVbpZ3L2cFYt4O6+wgbpdWP8DBBgZfCSQW
|
27
|
+
1J9miChMKdxZ8eOoeId79IMXN3IAcnalTFvD0Rp9ltaFZTXBfXMFqxQN3fHsIVwz
|
28
|
+
as/JSbwXo/PE8rULhjU+Utwcmji38cKEDWLAW4vsCBmwvBTwmAmcuHHKjnNvd8aR
|
29
|
+
YMrq9v505w8IjSysIO3KKysxCFuzoIPIYMdYswquvmtuTA+lpB9btWHr8n2FFsDp
|
30
|
+
A943I/wqE6xbYQpHxkndWo5uLDUbZh+XxG+fhZKpeqLIqHaFuU6wdO5odt32kB/B
|
31
|
+
nCjVswaVYlu1U2iLPCqE+MrjmTA=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
33
|
+
date: 2017-09-02 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: ffi
|
@@ -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.6.
|
139
|
+
rubygems_version: 2.6.11
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: A Ruby interface for getting file system information.
|
metadata.gz.sig
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
|
2
|
-
�
|
3
|
-
P2�}�����Jcv����{�*��%7�f��*�P��P���6?�yZPfR��Ơ�HL'0Z]��'y���~�����Ja"ז���E�6Y[lE,�˱0�������,
|
1
|
+
�C!�^@Й�m�2�l
|
2
|
+
�Z�p���&�[��a���$���,����˛� �A:�9[�}qd�w���`�Aΰo�TB�@0Z���UT��+���/1���!lVw�O���"*�b�dN����hٗڳ}�������]
|