sys-filesystem 1.1.9 → 1.2.0
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 +8 -0
- data/certs/djberg96_pub.pem +22 -17
- data/examples/example_stat.rb +2 -0
- data/lib/sys/filesystem.rb +72 -1
- data/lib/sys/unix/sys/filesystem.rb +5 -22
- data/lib/sys/windows/sys/filesystem.rb +9 -39
- data/sys-filesystem.gemspec +11 -2
- data/test/test_sys_filesystem_unix.rb +20 -1
- data/test/test_sys_filesystem_windows.rb +36 -10
- metadata +33 -22
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7c3f0edc5663aaad12f5efe558ade7e4b60d501a76da48d1620141f08196800
|
4
|
+
data.tar.gz: 6f5ba4a40c49bbbbf0a93607713a314f9f4c5cc88d8d9748f0b0d40c50ce97f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd8722d5a57207ec407585cc6c92087cd8dcdb844e8e5c5acec6be7688fa2170fccb4036c6395552081378b6d00bd70cb4dae6b9fae30728e3118d972d425ef8
|
7
|
+
data.tar.gz: caff95ccc96dd102f379a1c48d15b00111e75d3c5069330cf0d02bc0096d84f3601efc667bb58a8ac43c9651e4548b3fdd51f58814b1b8e8c6c0148c71d73e1d
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGES
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
== 1.2.0 - 1-Jan-2019
|
2
|
+
* Changed the license to Apache-2.0.
|
3
|
+
* Added the case_sensitive? and case_insensitive? instance methods to the
|
4
|
+
Filesystem::Stat class.
|
5
|
+
* Refactored the Numeric helper methods into a single location.
|
6
|
+
* Fixed the deprecation warnings when running the tests on Windows.
|
7
|
+
* Added metadata to the gemspec.
|
8
|
+
|
1
9
|
== 1.1.9 - 26-Jan-2018
|
2
10
|
* The bytes_free and bytes_total methods were updated to use the fragment size
|
3
11
|
instead of the block size. This fixes Macs using APFS, as well as Solaris 10.
|
data/certs/djberg96_pub.pem
CHANGED
@@ -1,21 +1,26 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
|
-
|
2
|
+
MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MREwDwYDVQQDDAhkamJl
|
3
3
|
cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
|
4
|
-
|
4
|
+
MB4XDTE4MDMxODE1MjIwN1oXDTI4MDMxNTE1MjIwN1owPzERMA8GA1UEAwwIZGpi
|
5
5
|
ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
6
|
+
bTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBALgfaroVM6CI06cxr0/h
|
7
|
+
A+j+pc8fgpRgBVmHFaFunq28GPC3IvW7Nvc3Y8SnAW7pP1EQIbhlwRIaQzJ93/yj
|
8
|
+
u95KpkP7tA9erypnV7dpzBkzNlX14ACaFD/6pHoXoe2ltBxk3CCyyzx70mTqJpph
|
9
|
+
75IB03ni9a8yqn8pmse+s83bFJOAqddSj009sGPcQO+QOWiNxqYv1n5EHcvj2ebO
|
10
|
+
6hN7YTmhx7aSia4qL/quc4DlIaGMWoAhvML7u1fmo53CYxkKskfN8MOecq2vfEmL
|
11
|
+
iLu+SsVVEAufMDDFMXMJlvDsviolUSGMSNRTujkyCcJoXKYYxZSNtIi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-15,6 +15,8 @@ puts "Block size: " + stat.block_size.to_s
|
|
15
15
|
puts "Fragment size: " + stat.fragment_size.to_s
|
16
16
|
puts "Blocks free: " + stat.blocks_free.to_s
|
17
17
|
puts "Blocks available: " + stat.blocks_available.to_s
|
18
|
+
puts "Bytes free: " + stat.bytes_free.to_s
|
19
|
+
puts "Bytes available: " + stat.bytes_available.to_s
|
18
20
|
puts "Files/Inodes: " + stat.files.to_s
|
19
21
|
puts "Files/Inodes free: " + stat.files_free.to_s
|
20
22
|
puts "Files/Inodes available: " + stat.files_available.to_s
|
data/lib/sys/filesystem.rb
CHANGED
@@ -1,12 +1,83 @@
|
|
1
1
|
module Sys
|
2
2
|
class Filesystem
|
3
3
|
# The version of the sys-filesystem library
|
4
|
-
VERSION = '1.
|
4
|
+
VERSION = '1.2.0'.freeze
|
5
5
|
end
|
6
6
|
end
|
7
7
|
|
8
|
+
require 'rbconfig'
|
9
|
+
|
8
10
|
if File::ALT_SEPARATOR
|
9
11
|
require_relative 'windows/sys/filesystem'
|
10
12
|
else
|
11
13
|
require_relative 'unix/sys/filesystem'
|
12
14
|
end
|
15
|
+
|
16
|
+
# Methods universal to all platforms
|
17
|
+
|
18
|
+
module Sys
|
19
|
+
class Filesystem
|
20
|
+
class Stat
|
21
|
+
# Returns true if the filesystem is case sensitive for the current path.
|
22
|
+
# Typically this will be any path on MS Windows or Macs using HFS.
|
23
|
+
#
|
24
|
+
# For a root path (really any path without actual a-z characters) we
|
25
|
+
# take a best guess based on the host operating system. However, as a
|
26
|
+
# general rule, I do not recommend using this method for a root path.
|
27
|
+
#
|
28
|
+
def case_insensitive?
|
29
|
+
if path !~ /\w+/
|
30
|
+
if RbConfig::CONFIG['host_os'] =~ /darwin|mac|windows|mswin|mingw/i
|
31
|
+
true # Assumes HFS
|
32
|
+
else
|
33
|
+
false
|
34
|
+
end
|
35
|
+
else
|
36
|
+
File.identical?(path, path.swapcase)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Opposite of case_insensitive?
|
41
|
+
#
|
42
|
+
def case_sensitive?
|
43
|
+
!case_insensitive?
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Some convenient methods for converting bytes to kb, mb, and gb.
|
50
|
+
#
|
51
|
+
class Numeric
|
52
|
+
# call-seq:
|
53
|
+
# <tt>num</tt>.to_kb
|
54
|
+
#
|
55
|
+
# Returns +num+ in terms of kilobytes.
|
56
|
+
def to_kb
|
57
|
+
self / 1024
|
58
|
+
end
|
59
|
+
|
60
|
+
# call-seq:
|
61
|
+
# <tt>num</tt>.to_mb
|
62
|
+
#
|
63
|
+
# Returns +num+ in terms of megabytes.
|
64
|
+
def to_mb
|
65
|
+
self / 1048576
|
66
|
+
end
|
67
|
+
|
68
|
+
# call-seq:
|
69
|
+
# <tt>num</tt>.to_gb
|
70
|
+
#
|
71
|
+
# Returns +num+ in terms of gigabytes.
|
72
|
+
def to_gb
|
73
|
+
self / 1073741824
|
74
|
+
end
|
75
|
+
|
76
|
+
# call-seq:
|
77
|
+
# <tt>num</tt>.to_gb
|
78
|
+
#
|
79
|
+
# Returns +num+ in terms of terabytes.
|
80
|
+
def to_tb
|
81
|
+
self / 1099511627776
|
82
|
+
end
|
83
|
+
end
|
@@ -133,6 +133,11 @@ module Sys
|
|
133
133
|
|
134
134
|
# Returns the total amount of free space on the partition.
|
135
135
|
def bytes_free
|
136
|
+
blocks_free * fragment_size
|
137
|
+
end
|
138
|
+
|
139
|
+
# Returns the amount of free space available to unprivileged processes.
|
140
|
+
def bytes_available
|
136
141
|
blocks_available * fragment_size
|
137
142
|
end
|
138
143
|
|
@@ -376,25 +381,3 @@ module Sys
|
|
376
381
|
end
|
377
382
|
end
|
378
383
|
end
|
379
|
-
|
380
|
-
class Numeric
|
381
|
-
# Converts a number to kilobytes.
|
382
|
-
def to_kb
|
383
|
-
self / 1024
|
384
|
-
end
|
385
|
-
|
386
|
-
# Converts a number to megabytes.
|
387
|
-
def to_mb
|
388
|
-
self / 1048576
|
389
|
-
end
|
390
|
-
|
391
|
-
# Converts a number to gigabytes.
|
392
|
-
def to_gb
|
393
|
-
self / 1073741824
|
394
|
-
end
|
395
|
-
|
396
|
-
# Converts a number to terabytes.
|
397
|
-
def to_tb
|
398
|
-
self / 1099511627776
|
399
|
-
end
|
400
|
-
end
|
@@ -93,9 +93,12 @@ module Sys
|
|
93
93
|
# The file system type, e.g. NTFS, FAT, etc.
|
94
94
|
attr_reader :base_type
|
95
95
|
|
96
|
-
#
|
96
|
+
# The total amount of free space on the partition.
|
97
97
|
attr_reader :bytes_free
|
98
98
|
|
99
|
+
# The amount of free space available to unprivileged processes.
|
100
|
+
attr_reader :bytes_available
|
101
|
+
|
99
102
|
alias inodes files
|
100
103
|
alias inodes_free files_free
|
101
104
|
alias inodes_available files_available
|
@@ -264,7 +267,9 @@ module Sys
|
|
264
267
|
bytes_free = FFI::MemoryPointer.new(:ulong_long)
|
265
268
|
total_bytes = FFI::MemoryPointer.new(:ulong_long)
|
266
269
|
|
267
|
-
mpoint = mount_point(path)
|
270
|
+
mpoint = mount_point(path).to_s
|
271
|
+
mpoint << '/' unless mpoint.end_with?('/')
|
272
|
+
|
268
273
|
wpath = path.to_s.wincode
|
269
274
|
|
270
275
|
# We need this call for the 64 bit support
|
@@ -304,7 +309,7 @@ module Sys
|
|
304
309
|
flags_ptr = FFI::MemoryPointer.new(:ulong)
|
305
310
|
|
306
311
|
bool = GetVolumeInformationW(
|
307
|
-
mpoint.
|
312
|
+
mpoint.wincode,
|
308
313
|
vol_name_ptr,
|
309
314
|
vol_name_ptr.size,
|
310
315
|
vol_serial_ptr,
|
@@ -343,6 +348,7 @@ module Sys
|
|
343
348
|
stat_obj.instance_variable_set(:@flags, flags)
|
344
349
|
stat_obj.instance_variable_set(:@filesystem_id, vol_serial)
|
345
350
|
stat_obj.instance_variable_set(:@bytes_free, bytes_free)
|
351
|
+
stat_obj.instance_variable_set(:@bytes_available, bytes_avail)
|
346
352
|
|
347
353
|
stat_obj.freeze # Read-only object
|
348
354
|
end
|
@@ -394,39 +400,3 @@ module Sys
|
|
394
400
|
end
|
395
401
|
end
|
396
402
|
end
|
397
|
-
|
398
|
-
# Some convenient methods for converting bytes to kb, mb, and gb.
|
399
|
-
#
|
400
|
-
class Numeric
|
401
|
-
# call-seq:
|
402
|
-
# <tt>num</tt>.to_kb
|
403
|
-
#
|
404
|
-
# Returns +num+ in terms of kilobytes.
|
405
|
-
def to_kb
|
406
|
-
self / 1024
|
407
|
-
end
|
408
|
-
|
409
|
-
# call-seq:
|
410
|
-
# <tt>num</tt>.to_mb
|
411
|
-
#
|
412
|
-
# Returns +num+ in terms of megabytes.
|
413
|
-
def to_mb
|
414
|
-
self / 1048576
|
415
|
-
end
|
416
|
-
|
417
|
-
# call-seq:
|
418
|
-
# <tt>num</tt>.to_gb
|
419
|
-
#
|
420
|
-
# Returns +num+ in terms of gigabytes.
|
421
|
-
def to_gb
|
422
|
-
self / 1073741824
|
423
|
-
end
|
424
|
-
|
425
|
-
# call-seq:
|
426
|
-
# <tt>num</tt>.to_gb
|
427
|
-
#
|
428
|
-
# Returns +num+ in terms of terabytes.
|
429
|
-
def to_tb
|
430
|
-
self / 1099511627776
|
431
|
-
end
|
432
|
-
end
|
data/sys-filesystem.gemspec
CHANGED
@@ -2,13 +2,13 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'sys-filesystem'
|
5
|
-
spec.version = '1.
|
5
|
+
spec.version = '1.2.0'
|
6
6
|
spec.author = 'Daniel J. Berger'
|
7
7
|
spec.email = 'djberg96@gmail.com'
|
8
8
|
spec.homepage = 'https://github.com/djberg96/sys-filesystem'
|
9
9
|
spec.summary = 'A Ruby interface for getting file system information.'
|
10
10
|
spec.test_file = 'test/test_sys_filesystem.rb'
|
11
|
-
spec.license = '
|
11
|
+
spec.license = 'Apache-2.0'
|
12
12
|
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
13
13
|
spec.cert_chain = Dir['certs/*']
|
14
14
|
|
@@ -18,6 +18,15 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.add_development_dependency('test-unit', '>= 2.5.0')
|
19
19
|
spec.add_development_dependency('rake')
|
20
20
|
|
21
|
+
spec.metadata = {
|
22
|
+
'homepage_uri' => 'https://github.com/djberg96/sys-filesystem',
|
23
|
+
'bug_tracker_uri' => 'https://github.com/djberg96/sys-filesystem/issues',
|
24
|
+
'changelog_uri' => 'https://github.com/djberg96/sys-filesystem/blob/master/CHANGES',
|
25
|
+
'documentation_uri' => 'https://github.com/djberg96/sys-filesystem/wiki',
|
26
|
+
'source_code_uri' => 'https://github.com/djberg96/sys-filesystem',
|
27
|
+
'wiki_uri' => 'https://github.com/djberg96/sys-filesystem/wiki'
|
28
|
+
}
|
29
|
+
|
21
30
|
spec.description = <<-EOF
|
22
31
|
The sys-filesystem library provides a cross-platform interface for
|
23
32
|
gathering filesystem information, such as disk space and mount point data.
|
@@ -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.
|
28
|
+
assert_equal('1.2.0', Filesystem::VERSION)
|
29
29
|
end
|
30
30
|
|
31
31
|
def test_stat_path
|
@@ -132,6 +132,13 @@ class TC_Sys_Filesystem_Unix < Test::Unit::TestCase
|
|
132
132
|
def test_stat_bytes_free
|
133
133
|
assert_respond_to(@stat, :bytes_free)
|
134
134
|
assert_kind_of(Numeric, @stat.bytes_free)
|
135
|
+
assert_equal(@stat.bytes_free, @stat.blocks_free * @stat.fragment_size)
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_stat_bytes_available
|
139
|
+
assert_respond_to(@stat, :bytes_available)
|
140
|
+
assert_kind_of(Numeric, @stat.bytes_available)
|
141
|
+
assert_equal(@stat.bytes_available, @stat.blocks_available * @stat.fragment_size)
|
135
142
|
end
|
136
143
|
|
137
144
|
def test_stat_bytes_used
|
@@ -148,6 +155,18 @@ class TC_Sys_Filesystem_Unix < Test::Unit::TestCase
|
|
148
155
|
assert_raises(ArgumentError){ Filesystem.stat }
|
149
156
|
end
|
150
157
|
|
158
|
+
def test_stat_case_insensitive
|
159
|
+
expected = @@darwin ? true : false
|
160
|
+
assert_equal(expected, @stat.case_insensitive?)
|
161
|
+
assert_equal(expected, Filesystem.stat(Dir.home).case_insensitive?)
|
162
|
+
end
|
163
|
+
|
164
|
+
def test_stat_case_sensitive
|
165
|
+
expected = @@darwin ? false : true
|
166
|
+
assert_equal(expected, @stat.case_sensitive?)
|
167
|
+
assert_equal(expected, Filesystem.stat(Dir.home).case_sensitive?)
|
168
|
+
end
|
169
|
+
|
151
170
|
def test_numeric_methods_basic
|
152
171
|
assert_respond_to(@size, :to_kb)
|
153
172
|
assert_respond_to(@size, :to_mb)
|
@@ -20,7 +20,7 @@ class TC_Sys_Filesystem_Windows < Test::Unit::TestCase
|
|
20
20
|
end
|
21
21
|
|
22
22
|
test "version number is set to the expected value" do
|
23
|
-
assert_equal('1.
|
23
|
+
assert_equal('1.2.0', Filesystem::VERSION)
|
24
24
|
end
|
25
25
|
|
26
26
|
test "stat path works as expected" do
|
@@ -30,7 +30,21 @@ class TC_Sys_Filesystem_Windows < Test::Unit::TestCase
|
|
30
30
|
|
31
31
|
test "stat block_size works as expected" do
|
32
32
|
assert_respond_to(@stat, :block_size)
|
33
|
-
assert_kind_of(
|
33
|
+
assert_kind_of(Numeric, @stat.block_size)
|
34
|
+
end
|
35
|
+
|
36
|
+
test "stat works with or without trailing slash on standard paths" do
|
37
|
+
assert_equal("C:/", Filesystem.stat("C:/").path)
|
38
|
+
assert_equal("C:/Users", Filesystem.stat("C:/Users").path)
|
39
|
+
assert_equal("C:/Users/", Filesystem.stat("C:/Users/").path)
|
40
|
+
assert_equal("C:/Users/", Filesystem.stat("C:/Users/").path)
|
41
|
+
end
|
42
|
+
|
43
|
+
test "stat works with or without trailing slash on UNC paths" do
|
44
|
+
assert_equal("//127.0.0.1/C$", Filesystem.stat("//127.0.0.1/C$").path)
|
45
|
+
assert_equal("//127.0.0.1/C$/", Filesystem.stat("//127.0.0.1/C$/").path)
|
46
|
+
assert_equal("\\\\127.0.0.1\\C$", Filesystem.stat("\\\\127.0.0.1\\C$").path)
|
47
|
+
assert_equal("\\\\127.0.0.1\\C$\\", Filesystem.stat("\\\\127.0.0.1\\C$\\").path)
|
34
48
|
end
|
35
49
|
|
36
50
|
test "stat fragment_size works as expected" do
|
@@ -40,17 +54,17 @@ class TC_Sys_Filesystem_Windows < Test::Unit::TestCase
|
|
40
54
|
|
41
55
|
test "stat blocks works as expected" do
|
42
56
|
assert_respond_to(@stat, :blocks)
|
43
|
-
assert_kind_of(
|
57
|
+
assert_kind_of(Numeric, @stat.blocks)
|
44
58
|
end
|
45
59
|
|
46
60
|
test "stat blocks_free works as expected" do
|
47
61
|
assert_respond_to(@stat, :blocks_free)
|
48
|
-
assert_kind_of(
|
62
|
+
assert_kind_of(Numeric, @stat.blocks_free)
|
49
63
|
end
|
50
64
|
|
51
65
|
test "stat blocks_available works as expected" do
|
52
66
|
assert_respond_to(@stat, :blocks_available)
|
53
|
-
assert_kind_of(
|
67
|
+
assert_kind_of(Numeric, @stat.blocks_available)
|
54
68
|
end
|
55
69
|
|
56
70
|
test "block stats return expected relative values" do
|
@@ -92,12 +106,12 @@ class TC_Sys_Filesystem_Windows < Test::Unit::TestCase
|
|
92
106
|
|
93
107
|
test "stat flags works as expected" do
|
94
108
|
assert_respond_to(@stat, :flags)
|
95
|
-
assert_kind_of(
|
109
|
+
assert_kind_of(Numeric, @stat.flags)
|
96
110
|
end
|
97
111
|
|
98
112
|
test "stat name_max works as expected" do
|
99
113
|
assert_respond_to(@stat, :name_max)
|
100
|
-
assert_kind_of(
|
114
|
+
assert_kind_of(Numeric, @stat.name_max)
|
101
115
|
end
|
102
116
|
|
103
117
|
test "stat base_type works as expected" do
|
@@ -113,6 +127,13 @@ class TC_Sys_Filesystem_Windows < Test::Unit::TestCase
|
|
113
127
|
test "stat bytes_free basic functionality" do
|
114
128
|
assert_respond_to(@stat, :bytes_free)
|
115
129
|
assert_kind_of(Numeric, @stat.bytes_free)
|
130
|
+
assert_equal(@stat.bytes_free, @stat.blocks_free * @stat.block_size)
|
131
|
+
end
|
132
|
+
|
133
|
+
test "stat bytes_available basic functionality" do
|
134
|
+
assert_respond_to(@stat, :bytes_available)
|
135
|
+
assert_kind_of(Numeric, @stat.bytes_available)
|
136
|
+
assert_equal(@stat.bytes_available, @stat.blocks_available * @stat.block_size)
|
116
137
|
end
|
117
138
|
|
118
139
|
test "stat bytes_used basic functionality" do
|
@@ -125,6 +146,11 @@ class TC_Sys_Filesystem_Windows < Test::Unit::TestCase
|
|
125
146
|
assert_kind_of(Float, @stat.percent_used)
|
126
147
|
end
|
127
148
|
|
149
|
+
test "case_insensitive returns expected result" do
|
150
|
+
assert_respond_to(@stat, :case_insensitive?)
|
151
|
+
assert_true(@stat.case_insensitive?)
|
152
|
+
end
|
153
|
+
|
128
154
|
test "mount_point singleton method basic functionality" do
|
129
155
|
assert_respond_to(Filesystem, :mount_point)
|
130
156
|
assert_nothing_raised{ Filesystem.mount_point(Dir.pwd) }
|
@@ -234,17 +260,17 @@ class TC_Sys_Filesystem_Windows < Test::Unit::TestCase
|
|
234
260
|
assert_raise(ArgumentError){ Filesystem.mounts("C:\\") }
|
235
261
|
end
|
236
262
|
|
237
|
-
test "custom
|
263
|
+
test "custom Numeric#to_kb method works as expected" do
|
238
264
|
assert_respond_to(@size, :to_kb)
|
239
265
|
assert_equal(57344, @size.to_kb)
|
240
266
|
end
|
241
267
|
|
242
|
-
test "custom
|
268
|
+
test "custom Numeric#to_mb method works as expected" do
|
243
269
|
assert_respond_to(@size, :to_mb)
|
244
270
|
assert_equal(56, @size.to_mb)
|
245
271
|
end
|
246
272
|
|
247
|
-
test "custom
|
273
|
+
test "custom Numeric#to_gb method works as expected" do
|
248
274
|
assert_respond_to(@size, :to_gb)
|
249
275
|
assert_equal(0, @size.to_gb)
|
250
276
|
end
|
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.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -10,27 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
13
|
+
MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MREwDwYDVQQDDAhkamJl
|
14
14
|
cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
|
15
|
-
|
15
|
+
MB4XDTE4MDMxODE1MjIwN1oXDTI4MDMxNTE1MjIwN1owPzERMA8GA1UEAwwIZGpi
|
16
16
|
ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
17
|
+
bTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBALgfaroVM6CI06cxr0/h
|
18
|
+
A+j+pc8fgpRgBVmHFaFunq28GPC3IvW7Nvc3Y8SnAW7pP1EQIbhlwRIaQzJ93/yj
|
19
|
+
u95KpkP7tA9erypnV7dpzBkzNlX14ACaFD/6pHoXoe2ltBxk3CCyyzx70mTqJpph
|
20
|
+
75IB03ni9a8yqn8pmse+s83bFJOAqddSj009sGPcQO+QOWiNxqYv1n5EHcvj2ebO
|
21
|
+
6hN7YTmhx7aSia4qL/quc4DlIaGMWoAhvML7u1fmo53CY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0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
|
32
37
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
38
|
+
date: 2019-01-01 00:00:00.000000000 Z
|
34
39
|
dependencies:
|
35
40
|
- !ruby/object:Gem::Dependency
|
36
41
|
name: ffi
|
@@ -118,8 +123,14 @@ files:
|
|
118
123
|
- lib/sys/windows/sys/filesystem.rb
|
119
124
|
homepage: https://github.com/djberg96/sys-filesystem
|
120
125
|
licenses:
|
121
|
-
-
|
122
|
-
metadata:
|
126
|
+
- Apache-2.0
|
127
|
+
metadata:
|
128
|
+
homepage_uri: https://github.com/djberg96/sys-filesystem
|
129
|
+
bug_tracker_uri: https://github.com/djberg96/sys-filesystem/issues
|
130
|
+
changelog_uri: https://github.com/djberg96/sys-filesystem/blob/master/CHANGES
|
131
|
+
documentation_uri: https://github.com/djberg96/sys-filesystem/wiki
|
132
|
+
source_code_uri: https://github.com/djberg96/sys-filesystem
|
133
|
+
wiki_uri: https://github.com/djberg96/sys-filesystem/wiki
|
123
134
|
post_install_message:
|
124
135
|
rdoc_options: []
|
125
136
|
require_paths:
|
@@ -136,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
147
|
version: '0'
|
137
148
|
requirements: []
|
138
149
|
rubyforge_project:
|
139
|
-
rubygems_version: 2.7.
|
150
|
+
rubygems_version: 2.7.6
|
140
151
|
signing_key:
|
141
152
|
specification_version: 4
|
142
153
|
summary: A Ruby interface for getting file system information.
|
metadata.gz.sig
CHANGED
Binary file
|