sys-filesystem 1.3.2 → 1.3.3
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGES.rdoc +4 -0
- data/examples/example_mount.rb +72 -0
- data/lib/sys/filesystem.rb +1 -1
- data/lib/sys/unix/sys/filesystem/functions.rb +1 -1
- data/sys-filesystem.gemspec +1 -1
- data/test/test_sys_filesystem_unix.rb +1 -1
- metadata +7 -6
- 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: cb5e1c3d785d6a557963b4d880fd7f769818ad7d11613744ff458edae1f0c55b
|
4
|
+
data.tar.gz: d6277cbfd44841a48a4d20c7b343401fdaaea8ddaf5ce8832b8ce86b4d953eef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3204a9f665966f705224d564cfca033f8f8265ed21522695f856ac2d86c25c2b995d0d7de1cc37375f0ef235e2a84aeae54eb751c9aa30f97bcb0d53c99cdcf6
|
7
|
+
data.tar.gz: c67c70c0c39a29515e54e47f3313d41471d5862561751040deb471a49ad81afd8f956b062eca7496f56fc366d16e6f547d47fa313155262dc9bfdf8fcdc43d3f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGES.rdoc
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
== 1.3.3 - 18-Feb-2020
|
2
|
+
* Linux now uses statvfs64 under the hood. This fixes a potential issue with
|
3
|
+
32 bit systems. Thanks go to Tom Smyth for the spot.
|
4
|
+
|
1
5
|
== 1.3.2 - 8-Dec-2019
|
2
6
|
* Renamed various text files to include .rdoc extension so that github renders
|
3
7
|
them nicely.
|
@@ -0,0 +1,72 @@
|
|
1
|
+
######################################################################
|
2
|
+
# example_mount.rb
|
3
|
+
#
|
4
|
+
# Example program that demonstrates the Filesystem.mount method.
|
5
|
+
# Simulates the `mount` command in ruby
|
6
|
+
######################################################################
|
7
|
+
require 'optparse'
|
8
|
+
|
9
|
+
options = {:mount_options => []}
|
10
|
+
OptionParser.new do |opts|
|
11
|
+
opts.banner = "Usage: #$0 [-o options] [-t external_type] special node"
|
12
|
+
|
13
|
+
opts.on("-o=OPTIONS", "Set one or many mount options (comma delimited)") do |opts|
|
14
|
+
options[:mount_options] += opts.split(',')
|
15
|
+
end
|
16
|
+
|
17
|
+
opts.on("-r", "Set readonly flag") do
|
18
|
+
options[:read_only] = true
|
19
|
+
end
|
20
|
+
|
21
|
+
opts.on("-t=EXTERNAL_TYPE", "Set the filesystem type") do |type|
|
22
|
+
options[:type] = type
|
23
|
+
end
|
24
|
+
|
25
|
+
opts.on("-v", "--version", "Display version") do
|
26
|
+
options[:version] = true
|
27
|
+
end
|
28
|
+
|
29
|
+
opts.separator ""
|
30
|
+
opts.separator "Examples:"
|
31
|
+
opts.separator ""
|
32
|
+
opts.separator " NFS: ruby #$0 -t nfs 192.168.0.10:/var/nfs /mnt/nfs"
|
33
|
+
opts.separator ""
|
34
|
+
opts.separator " SMB: ruby #$0 -t cifs //192.168.0.10/share /mnt/smb/ -o username=user,password=pass,domain=example.com"
|
35
|
+
opts.separator ""
|
36
|
+
end.parse!
|
37
|
+
|
38
|
+
require 'sys/filesystem'
|
39
|
+
include Sys
|
40
|
+
|
41
|
+
if options[:version]
|
42
|
+
puts "Sys::Filesystem::VERSION: #{Filesystem::VERSION}"
|
43
|
+
exit
|
44
|
+
end
|
45
|
+
|
46
|
+
def die msg
|
47
|
+
warn msg
|
48
|
+
exit 1
|
49
|
+
end
|
50
|
+
|
51
|
+
mount_flags = options[:read_only] ? Filesystem::MNT_RDONLY : 0
|
52
|
+
mnt_path, mnt_point = ARGV[0,2]
|
53
|
+
|
54
|
+
case options[:type]
|
55
|
+
when "cifs"
|
56
|
+
# keep mnt_path as is
|
57
|
+
when "nfs"
|
58
|
+
host, path, err = mnt_path.split(":")
|
59
|
+
|
60
|
+
die "ERROR: mount_pount '#{mnt_path}' should only contain 1 ':'" if err
|
61
|
+
|
62
|
+
mnt_path = ":#{path}"
|
63
|
+
options[:mount_options] << "addr=#{host}"
|
64
|
+
else
|
65
|
+
die "ERROR: unknown mount type!"
|
66
|
+
end
|
67
|
+
|
68
|
+
Filesystem.mount mnt_path,
|
69
|
+
mnt_point,
|
70
|
+
options[:type],
|
71
|
+
mount_flags,
|
72
|
+
options[:mount_options].join(',')
|
data/lib/sys/filesystem.rb
CHANGED
@@ -7,7 +7,7 @@ module Sys
|
|
7
7
|
|
8
8
|
ffi_lib FFI::Library::LIBC
|
9
9
|
|
10
|
-
if RbConfig::CONFIG['host_os'] =~ /sunos|solaris/i
|
10
|
+
if RbConfig::CONFIG['host_os'] =~ /sunos|solaris|linux/i
|
11
11
|
attach_function(:statvfs, :statvfs64, [:string, :pointer], :int)
|
12
12
|
else
|
13
13
|
attach_function(:statvfs, [:string, :pointer], :int)
|
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.3.
|
5
|
+
spec.version = '1.3.3'
|
6
6
|
spec.author = 'Daniel J. Berger'
|
7
7
|
spec.email = 'djberg96@gmail.com'
|
8
8
|
spec.homepage = 'https://github.com/djberg96/sys-filesystem'
|
@@ -27,7 +27,7 @@ class TC_Sys_Filesystem_Unix < Test::Unit::TestCase
|
|
27
27
|
end
|
28
28
|
|
29
29
|
test "version number is set to the expected value" do
|
30
|
-
assert_equal('1.3.
|
30
|
+
assert_equal('1.3.3', Filesystem::VERSION)
|
31
31
|
assert_true(Filesystem::VERSION.frozen?)
|
32
32
|
end
|
33
33
|
|
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.3.
|
4
|
+
version: 1.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -100,16 +100,17 @@ email: djberg96@gmail.com
|
|
100
100
|
executables: []
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files:
|
103
|
-
- CHANGES.rdoc
|
104
103
|
- MANIFEST.rdoc
|
105
104
|
- README.rdoc
|
105
|
+
- CHANGES.rdoc
|
106
106
|
files:
|
107
107
|
- test
|
108
108
|
- test/test_sys_filesystem.rb
|
109
|
-
- test/test_sys_filesystem_unix.rb
|
110
109
|
- test/test_sys_filesystem_windows.rb
|
110
|
+
- test/test_sys_filesystem_unix.rb
|
111
111
|
- examples
|
112
112
|
- examples/example_stat.rb
|
113
|
+
- examples/example_mount.rb
|
113
114
|
- lib
|
114
115
|
- lib/sys
|
115
116
|
- lib/sys/unix
|
@@ -117,8 +118,8 @@ files:
|
|
117
118
|
- lib/sys/unix/sys/filesystem.rb
|
118
119
|
- lib/sys/unix/sys/filesystem
|
119
120
|
- lib/sys/unix/sys/filesystem/constants.rb
|
120
|
-
- lib/sys/unix/sys/filesystem/functions.rb
|
121
121
|
- lib/sys/unix/sys/filesystem/structs.rb
|
122
|
+
- lib/sys/unix/sys/filesystem/functions.rb
|
122
123
|
- lib/sys/windows
|
123
124
|
- lib/sys/windows/sys
|
124
125
|
- lib/sys/windows/sys/filesystem.rb
|
@@ -131,10 +132,10 @@ files:
|
|
131
132
|
- Rakefile
|
132
133
|
- certs
|
133
134
|
- certs/djberg96_pub.pem
|
134
|
-
- CHANGES.rdoc
|
135
135
|
- MANIFEST.rdoc
|
136
136
|
- README.rdoc
|
137
137
|
- sys-filesystem.gemspec
|
138
|
+
- CHANGES.rdoc
|
138
139
|
homepage: https://github.com/djberg96/sys-filesystem
|
139
140
|
licenses:
|
140
141
|
- Apache-2.0
|
@@ -166,5 +167,5 @@ specification_version: 4
|
|
166
167
|
summary: A Ruby interface for getting file system information.
|
167
168
|
test_files:
|
168
169
|
- test/test_sys_filesystem.rb
|
169
|
-
- test/test_sys_filesystem_unix.rb
|
170
170
|
- test/test_sys_filesystem_windows.rb
|
171
|
+
- test/test_sys_filesystem_unix.rb
|
metadata.gz.sig
CHANGED
Binary file
|