sys-filesystem 1.1.1 → 1.5.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 +6 -14
- checksums.yaml.gz.sig +0 -0
- data/CHANGES.md +184 -0
- data/Gemfile +2 -0
- data/LICENSE +177 -0
- data/MANIFEST.md +23 -0
- data/README.md +92 -0
- data/Rakefile +32 -27
- data/certs/djberg96_pub.pem +26 -0
- data/examples/example_mount.rb +73 -0
- data/examples/example_stat.rb +2 -0
- data/lib/sys/filesystem.rb +81 -2
- data/lib/sys/unix/sys/filesystem/constants.rb +74 -0
- data/lib/sys/unix/sys/filesystem/functions.rb +65 -0
- data/lib/sys/unix/sys/filesystem/structs.rb +272 -0
- data/lib/sys/unix/sys/filesystem.rb +462 -0
- data/lib/sys/windows/sys/filesystem/functions.rb +40 -0
- data/lib/sys/windows/sys/filesystem/helper.rb +10 -0
- data/lib/{windows → sys/windows}/sys/filesystem.rb +164 -109
- data/lib/sys-filesystem.rb +3 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/sys_filesystem_shared.rb +14 -0
- data/spec/sys_filesystem_unix_spec.rb +527 -0
- data/spec/sys_filesystem_windows_spec.rb +460 -0
- data/sys-filesystem.gemspec +32 -16
- data.tar.gz.sig +0 -0
- metadata +126 -43
- metadata.gz.sig +0 -0
- data/CHANGES +0 -58
- data/MANIFEST +0 -12
- data/README +0 -81
- data/lib/unix/sys/filesystem.rb +0 -566
- data/lib/windows/sys/filesystem/functions.rb +0 -36
- data/lib/windows/sys/filesystem/helper.rb +0 -7
- data/lib/windows/sys/filesystem/structs.rb +0 -0
- data/test/test_sys_filesystem.rb +0 -7
- data/test/test_sys_filesystem_unix.rb +0 -257
- data/test/test_sys_filesystem_windows.rb +0 -222
- /data/lib/{windows → sys/windows}/sys/filesystem/constants.rb +0 -0
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
####################################################################
|
|
4
|
+
# sys_filesystem_windows_spec.rb
|
|
5
|
+
#
|
|
6
|
+
# Specs for the Sys::Filesystem.stat method and related stuff.
|
|
7
|
+
# This should be run via the 'rake spec' task.
|
|
8
|
+
####################################################################
|
|
9
|
+
require 'spec_helper'
|
|
10
|
+
require 'sys/filesystem'
|
|
11
|
+
require 'pathname'
|
|
12
|
+
|
|
13
|
+
RSpec.describe Sys::Filesystem, :windows do
|
|
14
|
+
let(:root) { 'C:/' }
|
|
15
|
+
|
|
16
|
+
before do
|
|
17
|
+
@stat = described_class.stat(root)
|
|
18
|
+
@size = 58720256
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
example 'stat path works as expected' do
|
|
22
|
+
expect(@stat).to respond_to(:path)
|
|
23
|
+
expect(@stat.path).to eq(root)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
example 'stat block_size works as expected' do
|
|
27
|
+
expect(@stat).to respond_to(:block_size)
|
|
28
|
+
expect(@stat.block_size).to be_a(Numeric)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
example 'stat works with or without trailing slash on standard paths' do
|
|
32
|
+
expect(described_class.stat('C:/').path).to eq('C:/')
|
|
33
|
+
expect(described_class.stat('C:/Users').path).to eq('C:/Users')
|
|
34
|
+
expect(described_class.stat('C:/Users/').path).to eq('C:/Users/')
|
|
35
|
+
expect(described_class.stat('C:/Users/').path).to eq('C:/Users/')
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
example 'stat works with or without trailing slash on UNC paths' do
|
|
39
|
+
expect(described_class.stat('//127.0.0.1/C$').path).to eq('//127.0.0.1/C$')
|
|
40
|
+
expect(described_class.stat('//127.0.0.1/C$/').path).to eq('//127.0.0.1/C$/')
|
|
41
|
+
expect(described_class.stat('\\\\127.0.0.1\\C$').path).to eq('\\\\127.0.0.1\\C$')
|
|
42
|
+
expect(described_class.stat('\\\\127.0.0.1\\C$\\').path).to eq('\\\\127.0.0.1\\C$\\')
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
example 'stat fragment_size works as expected' do
|
|
46
|
+
expect(@stat).to respond_to(:fragment_size)
|
|
47
|
+
expect(@stat.fragment_size).to be_nil
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
example 'stat blocks works as expected' do
|
|
51
|
+
expect(@stat).to respond_to(:blocks)
|
|
52
|
+
expect(@stat.blocks).to be_a(Numeric)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
example 'stat blocks_free works as expected' do
|
|
56
|
+
expect(@stat).to respond_to(:blocks_free)
|
|
57
|
+
expect(@stat.blocks_free).to be_a(Numeric)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
example 'stat blocks_available works as expected' do
|
|
61
|
+
expect(@stat).to respond_to(:blocks_available)
|
|
62
|
+
expect(@stat.blocks_available).to be_a(Numeric)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
example 'block stats return expected relative values' do
|
|
66
|
+
expect(@stat.blocks >= @stat.blocks_free).to be true
|
|
67
|
+
expect(@stat.blocks_free >= @stat.blocks_available).to be true
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
example 'stat files works as expected' do
|
|
71
|
+
expect(@stat).to respond_to(:files)
|
|
72
|
+
expect(@stat.files).to be_nil
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
example 'stat inodes is an alias for files' do
|
|
76
|
+
expect(@stat.method(:inodes)).to eq(@stat.method(:files))
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
example 'stat files_free works as expected' do
|
|
80
|
+
expect(@stat).to respond_to(:files_free)
|
|
81
|
+
expect(@stat.files_free).to be_nil
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
example 'stat inodes_free is an alias for files_free' do
|
|
85
|
+
expect(@stat).to respond_to(:inodes_free)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
example 'stat files available works as expected' do
|
|
89
|
+
expect(@stat).to respond_to(:files_available)
|
|
90
|
+
expect(@stat.files_available).to be_nil
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
example 'stat inodes_available is an alias for files_available' do
|
|
94
|
+
expect(@stat.method(:inodes_available)).to eq(@stat.method(:files_available))
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
example 'stat filesystem_id works as expected' do
|
|
98
|
+
expect(@stat).to respond_to(:filesystem_id)
|
|
99
|
+
expect(@stat.filesystem_id).to be_a(Integer)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
example 'stat flags works as expected' do
|
|
103
|
+
expect(@stat).to respond_to(:flags)
|
|
104
|
+
expect(@stat.flags).to be_a(Numeric)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
example 'stat name_max works as expected' do
|
|
108
|
+
expect(@stat).to respond_to(:name_max)
|
|
109
|
+
expect(@stat.name_max).to be_a(Numeric)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
example 'stat base_type works as expected' do
|
|
113
|
+
expect(@stat).to respond_to(:base_type)
|
|
114
|
+
expect(@stat.base_type).to be_a(String)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
example 'stat bytes_total basic functionality' do
|
|
118
|
+
expect(@stat).to respond_to(:bytes_total)
|
|
119
|
+
expect(@stat.bytes_total).to be_a(Numeric)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
example 'stat bytes_free basic functionality' do
|
|
123
|
+
expect(@stat).to respond_to(:bytes_free)
|
|
124
|
+
expect(@stat.bytes_free).to be_a(Numeric)
|
|
125
|
+
expect(@stat.blocks_free * @stat.block_size).to eq(@stat.bytes_free)
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
example 'stat bytes_available basic functionality' do
|
|
129
|
+
expect(@stat).to respond_to(:bytes_available)
|
|
130
|
+
expect(@stat.bytes_available).to be_a(Numeric)
|
|
131
|
+
expect(@stat.blocks_available * @stat.block_size).to eq(@stat.bytes_available)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
example 'stat bytes_used basic functionality' do
|
|
135
|
+
expect(@stat).to respond_to(:bytes_used)
|
|
136
|
+
expect(@stat.bytes_used).to be_a(Numeric)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
example 'stat percent_used basic functionality' do
|
|
140
|
+
expect(@stat).to respond_to(:percent_used)
|
|
141
|
+
expect(@stat.percent_used).to be_a(Float)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
example 'case_insensitive returns expected result' do
|
|
145
|
+
expect(@stat).to respond_to(:case_insensitive?)
|
|
146
|
+
expect(@stat.case_insensitive?).to be(true)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
context 'Filesystem.stat(Pathname)' do
|
|
150
|
+
before do
|
|
151
|
+
@stat_pathname = described_class.stat(Pathname.new(root))
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
example 'class returns expected value with pathname argument' do
|
|
155
|
+
expect(@stat_pathname.class).to eq(@stat.class)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
example 'path returns expected value with pathname argument' do
|
|
159
|
+
expect(@stat_pathname.path).to eq(@stat.path)
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
example 'block_size returns expected value with pathname argument' do
|
|
163
|
+
expect(@stat_pathname.block_size).to eq(@stat.block_size)
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
example 'fragment_size returns expected value with pathname argument' do
|
|
167
|
+
expect(@stat_pathname.fragment_size).to eq(@stat.fragment_size)
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
example 'blocks returns expected value with pathname argument' do
|
|
171
|
+
expect(@stat_pathname.blocks).to eq(@stat.blocks)
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
example 'blocks_free returns expected value with pathname argument' do
|
|
175
|
+
expect(@stat_pathname.blocks_free).to eq(@stat.blocks_free)
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
example 'blocks_available returns expected value with pathname argument' do
|
|
179
|
+
expect(@stat_pathname.blocks_available).to eq(@stat.blocks_available)
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
example 'files returns expected value with pathname argument' do
|
|
183
|
+
expect(@stat_pathname.files).to eq(@stat.files)
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
example 'files_free returns expected value with pathname argument' do
|
|
187
|
+
expect(@stat_pathname.files_free).to eq(@stat.files_free)
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
example 'files_available returns expected value with pathname argument' do
|
|
191
|
+
expect(@stat_pathname.files_available).to eq(@stat.files_available)
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
example 'filesystem_id returns expected value with pathname argument' do
|
|
195
|
+
expect(@stat_pathname.filesystem_id).to eq(@stat.filesystem_id)
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
example 'flags returns expected value with pathname argument' do
|
|
199
|
+
expect(@stat_pathname.flags).to eq(@stat.flags)
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
example 'name_max returns expected value with pathname argument' do
|
|
203
|
+
expect(@stat_pathname.name_max).to eq(@stat.name_max)
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
example 'base_type returns expected value with pathname argument' do
|
|
207
|
+
expect(@stat_pathname.base_type).to eq(@stat.base_type)
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
context 'Filesystem.stat(Dir)' do
|
|
212
|
+
before do
|
|
213
|
+
@stat_dir = Dir.open(root){ |dir| described_class.stat(dir) }
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
example 'stat class with Dir argument works as expected' do
|
|
217
|
+
expect(@stat_dir.class).to eq(@stat.class)
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
example 'stat path with Dir argument works as expected' do
|
|
221
|
+
expect(@stat_dir.path).to eq(@stat.path)
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
example 'stat block_size with Dir argument works as expected' do
|
|
225
|
+
expect(@stat_dir.block_size).to eq(@stat.block_size)
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
example 'stat fragment_size with Dir argument works as expected' do
|
|
229
|
+
expect(@stat_dir.fragment_size).to eq(@stat.fragment_size)
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
example 'stat blocks with Dir argument works as expected' do
|
|
233
|
+
expect(@stat_dir.blocks).to eq(@stat.blocks)
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
example 'stat blocks_free with Dir argument works as expected' do
|
|
237
|
+
expect(@stat_dir.blocks_free).to eq(@stat.blocks_free)
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
example 'stat blocks_available with Dir argument works as expected' do
|
|
241
|
+
expect(@stat_dir.blocks_available).to eq(@stat.blocks_available)
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
example 'stat files with Dir argument works as expected' do
|
|
245
|
+
expect(@stat_dir.files).to eq(@stat.files)
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
example 'stat files_free with Dir argument works as expected' do
|
|
249
|
+
expect(@stat_dir.files_free).to eq(@stat.files_free)
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
example 'stat files_available with Dir argument works as expected' do
|
|
253
|
+
expect(@stat_dir.files_available).to eq(@stat.files_available)
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
example 'stat filesystem_id with Dir argument works as expected' do
|
|
257
|
+
expect(@stat_dir.filesystem_id).to eq(@stat.filesystem_id)
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
example 'stat flags with Dir argument works as expected' do
|
|
261
|
+
expect(@stat_dir.flags).to eq(@stat.flags)
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
example 'stat name_max with Dir argument works as expected' do
|
|
265
|
+
expect(@stat_dir.name_max).to eq(@stat.name_max)
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
example 'stat base_type with Dir argument works as expected' do
|
|
269
|
+
expect(@stat_dir.base_type).to eq(@stat.base_type)
|
|
270
|
+
end
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
context 'mount_point' do
|
|
274
|
+
example 'mount_point singleton method basic functionality' do
|
|
275
|
+
expect(described_class).to respond_to(:mount_point)
|
|
276
|
+
expect{ described_class.mount_point(Dir.pwd) }.not_to raise_error
|
|
277
|
+
expect(described_class.mount_point(Dir.pwd)).to be_a(String)
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
example 'mount_point singleton method returns expected value' do
|
|
281
|
+
expect(described_class.mount_point('C:\\Users\\foo')).to eq('C:\\')
|
|
282
|
+
expect(described_class.mount_point('//foo/bar/baz')).to eq('\\\\foo\\bar')
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
example 'mount_point works with Pathname object' do
|
|
286
|
+
expect{ described_class.mount_point(Pathname.new('C:/Users/foo')) }.not_to raise_error
|
|
287
|
+
expect(described_class.mount_point('C:\\Users\\foo')).to eq('C:\\')
|
|
288
|
+
expect(described_class.mount_point('//foo/bar/baz')).to eq('\\\\foo\\bar')
|
|
289
|
+
end
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
context 'filesystem constants are defined' do
|
|
293
|
+
example 'CASE_SENSITIVE_SEARCH' do
|
|
294
|
+
expect(Sys::Filesystem::CASE_SENSITIVE_SEARCH).not_to be_nil
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
example 'CASE_PRESERVED_NAMES' do
|
|
298
|
+
expect(Sys::Filesystem::CASE_PRESERVED_NAMES).not_to be_nil
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
example 'UNICODE_ON_DISK' do
|
|
302
|
+
expect(Sys::Filesystem::UNICODE_ON_DISK).not_to be_nil
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
example 'PERSISTENT_ACLS' do
|
|
306
|
+
expect(Sys::Filesystem::PERSISTENT_ACLS).not_to be_nil
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
example 'FILE_COMPRESSION' do
|
|
310
|
+
expect(Sys::Filesystem::FILE_COMPRESSION).not_to be_nil
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
example 'VOLUME_QUOTAS' do
|
|
314
|
+
expect(Sys::Filesystem::VOLUME_QUOTAS).not_to be_nil
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
example 'SUPPORTS_SPARSE_FILES' do
|
|
318
|
+
expect(Sys::Filesystem::SUPPORTS_SPARSE_FILES).not_to be_nil
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
example 'SUPPORTS_REPARSE_POINTS' do
|
|
322
|
+
expect(Sys::Filesystem::SUPPORTS_REPARSE_POINTS).not_to be_nil
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
example 'SUPPORTS_REMOTE_STORAGE' do
|
|
326
|
+
expect(Sys::Filesystem::SUPPORTS_REMOTE_STORAGE).not_to be_nil
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
example 'VOLUME_IS_COMPRESSED' do
|
|
330
|
+
expect(Sys::Filesystem::VOLUME_IS_COMPRESSED).not_to be_nil
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
example 'SUPPORTS_OBJECT_IDS' do
|
|
334
|
+
expect(Sys::Filesystem::SUPPORTS_OBJECT_IDS).not_to be_nil
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
example 'SUPPORTS_ENCRYPTION' do
|
|
338
|
+
expect(Sys::Filesystem::SUPPORTS_ENCRYPTION).not_to be_nil
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
example 'NAMED_STREAMS' do
|
|
342
|
+
expect(Sys::Filesystem::NAMED_STREAMS).not_to be_nil
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
example 'READ_ONLY_VOLUME' do
|
|
346
|
+
expect(Sys::Filesystem::READ_ONLY_VOLUME).not_to be_nil
|
|
347
|
+
end
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
example 'stat singleton method defaults to root path if proviced' do
|
|
351
|
+
expect{ described_class.stat('C://Program Files') }.not_to raise_error
|
|
352
|
+
end
|
|
353
|
+
|
|
354
|
+
example 'stat singleton method accepts a Pathname object' do
|
|
355
|
+
expect{ described_class.stat(Pathname.new('C://Program Files')) }.not_to raise_error
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
example 'stat singleton method requires a single argument' do
|
|
359
|
+
expect{ described_class.stat }.to raise_error(ArgumentError)
|
|
360
|
+
expect{ described_class.stat(Dir.pwd, Dir.pwd) }.to raise_error(ArgumentError)
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
example 'stat singleton method raises an error if path is not found' do
|
|
364
|
+
expect{ described_class.stat('C://Bogus//Dir') }.to raise_error(Errno::ESRCH)
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
context 'Filesystem::Mount' do
|
|
368
|
+
let(:mount){ described_class.mounts[0] }
|
|
369
|
+
|
|
370
|
+
before do
|
|
371
|
+
@array = []
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
example 'mount singleton method exists' do
|
|
375
|
+
expect(described_class).to respond_to(:mount)
|
|
376
|
+
end
|
|
377
|
+
|
|
378
|
+
example 'umount singleton method exists' do
|
|
379
|
+
expect(described_class).to respond_to(:umount)
|
|
380
|
+
end
|
|
381
|
+
|
|
382
|
+
example 'mounts singleton method basic functionality' do
|
|
383
|
+
expect(described_class).to respond_to(:mounts)
|
|
384
|
+
expect{ described_class.mounts }.not_to raise_error
|
|
385
|
+
expect{ described_class.mounts{} }.not_to raise_error
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
example 'mounts singleton method returns the expected value' do
|
|
389
|
+
expect(described_class.mounts).to be_a(Array)
|
|
390
|
+
expect(described_class.mounts[0]).to be_a(Sys::Filesystem::Mount)
|
|
391
|
+
end
|
|
392
|
+
|
|
393
|
+
example 'mounts singleton method works as expected when a block is provided' do
|
|
394
|
+
expect(described_class.mounts{}).to be_nil
|
|
395
|
+
expect{ described_class.mounts{ |mt| @array << mt } }.not_to raise_error
|
|
396
|
+
expect(@array[0]).to be_a(Sys::Filesystem::Mount)
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
example 'mount name works as expected' do
|
|
400
|
+
expect(mount).to respond_to(:name)
|
|
401
|
+
expect(mount.name).to be_a(String)
|
|
402
|
+
end
|
|
403
|
+
|
|
404
|
+
example 'mount_time works as expected' do
|
|
405
|
+
expect(mount).to respond_to(:mount_time)
|
|
406
|
+
expect(mount.mount_time).to be_a(Time)
|
|
407
|
+
end
|
|
408
|
+
|
|
409
|
+
example 'mount type works as expected' do
|
|
410
|
+
expect(mount).to respond_to(:mount_type)
|
|
411
|
+
expect(mount.mount_type).to be_a(String)
|
|
412
|
+
end
|
|
413
|
+
|
|
414
|
+
example 'mount point works as expected' do
|
|
415
|
+
expect(mount).to respond_to(:mount_point)
|
|
416
|
+
expect(mount.mount_point).to be_a(String)
|
|
417
|
+
end
|
|
418
|
+
|
|
419
|
+
example 'mount options works as expected' do
|
|
420
|
+
expect(mount).to respond_to(:options)
|
|
421
|
+
expect(mount.options).to be_a(String)
|
|
422
|
+
end
|
|
423
|
+
|
|
424
|
+
example 'mount pass_number works as expected' do
|
|
425
|
+
expect(mount).to respond_to(:pass_number)
|
|
426
|
+
expect(mount.pass_number).to be_nil
|
|
427
|
+
end
|
|
428
|
+
|
|
429
|
+
example 'mount frequency works as expected' do
|
|
430
|
+
expect(mount).to respond_to(:frequency)
|
|
431
|
+
expect(mount.frequency).to be_nil
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
example 'mounts singleton method does not accept any arguments' do
|
|
435
|
+
expect{ described_class.mounts('C:\\') }.to raise_error(ArgumentError)
|
|
436
|
+
end
|
|
437
|
+
end
|
|
438
|
+
|
|
439
|
+
example 'custom Numeric#to_kb method works as expected' do
|
|
440
|
+
expect(@size).to respond_to(:to_kb)
|
|
441
|
+
expect(@size.to_kb).to eq(57344)
|
|
442
|
+
end
|
|
443
|
+
|
|
444
|
+
example 'custom Numeric#to_mb method works as expected' do
|
|
445
|
+
expect(@size).to respond_to(:to_mb)
|
|
446
|
+
expect(@size.to_mb).to eq(56)
|
|
447
|
+
end
|
|
448
|
+
|
|
449
|
+
example 'custom Numeric#to_gb method works as expected' do
|
|
450
|
+
expect(@size).to respond_to(:to_gb)
|
|
451
|
+
expect(@size.to_gb).to eq(0)
|
|
452
|
+
end
|
|
453
|
+
|
|
454
|
+
context 'FFI' do
|
|
455
|
+
example 'internal ffi functions are not public' do
|
|
456
|
+
expect(described_class.methods.include?(:GetVolumeInformationA)).to be(false)
|
|
457
|
+
expect(described_class.instance_methods.include?(:GetVolumeInformationA)).to be(false)
|
|
458
|
+
end
|
|
459
|
+
end
|
|
460
|
+
end
|
data/sys-filesystem.gemspec
CHANGED
|
@@ -1,25 +1,41 @@
|
|
|
1
1
|
require 'rubygems'
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |spec|
|
|
4
|
-
spec.name
|
|
5
|
-
spec.version
|
|
6
|
-
spec.author
|
|
7
|
-
spec.email
|
|
8
|
-
spec.homepage
|
|
9
|
-
spec.summary
|
|
10
|
-
spec.
|
|
11
|
-
spec.
|
|
12
|
-
spec.
|
|
4
|
+
spec.name = 'sys-filesystem'
|
|
5
|
+
spec.version = '1.5.1'
|
|
6
|
+
spec.author = 'Daniel J. Berger'
|
|
7
|
+
spec.email = 'djberg96@gmail.com'
|
|
8
|
+
spec.homepage = 'https://github.com/djberg96/sys-filesystem'
|
|
9
|
+
spec.summary = 'A Ruby interface for getting file system information.'
|
|
10
|
+
spec.license = 'Apache-2.0'
|
|
11
|
+
spec.test_files = Dir['spec/*_spec.rb']
|
|
12
|
+
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
|
13
|
+
spec.cert_chain = Dir['certs/*']
|
|
13
14
|
|
|
14
|
-
spec.
|
|
15
|
-
spec.
|
|
16
|
-
|
|
17
|
-
spec.add_dependency('ffi')
|
|
18
|
-
spec.add_development_dependency('test-unit', '>= 2.5.0')
|
|
15
|
+
spec.add_dependency('ffi', '~> 1.1')
|
|
16
|
+
spec.add_development_dependency('mkmf-lite', '~> 0.7') unless Gem.win_platform?
|
|
19
17
|
spec.add_development_dependency('rake')
|
|
18
|
+
spec.add_development_dependency('rspec', '~> 3.9')
|
|
19
|
+
spec.add_development_dependency('rubocop')
|
|
20
|
+
spec.add_development_dependency('rubocop-rspec')
|
|
21
|
+
|
|
22
|
+
if RUBY_PLATFORM == 'java' && Gem.win_platform?
|
|
23
|
+
spec.add_dependency('jruby-win32ole')
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
spec.metadata = {
|
|
27
|
+
'homepage_uri' => 'https://github.com/djberg96/sys-filesystem',
|
|
28
|
+
'bug_tracker_uri' => 'https://github.com/djberg96/sys-filesystem/issues',
|
|
29
|
+
'changelog_uri' => 'https://github.com/djberg96/sys-filesystem/blob/main/CHANGES.md',
|
|
30
|
+
'documentation_uri' => 'https://github.com/djberg96/sys-filesystem/wiki',
|
|
31
|
+
'source_code_uri' => 'https://github.com/djberg96/sys-filesystem',
|
|
32
|
+
'wiki_uri' => 'https://github.com/djberg96/sys-filesystem/wiki',
|
|
33
|
+
'rubygems_mfa_required' => 'true',
|
|
34
|
+
'github_repo' => 'https://github.com/djberg96/sys-filesystem'
|
|
35
|
+
}
|
|
20
36
|
|
|
21
37
|
spec.description = <<-EOF
|
|
22
|
-
The sys-filesystem library provides
|
|
23
|
-
information, such as disk space and mount point data.
|
|
38
|
+
The sys-filesystem library provides a cross-platform interface for
|
|
39
|
+
gathering filesystem information, such as disk space and mount point data.
|
|
24
40
|
EOF
|
|
25
41
|
end
|
data.tar.gz.sig
ADDED
|
Binary file
|