sys-filesystem 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef992a58a28ea604cbcce569c09abaee7212b04dbe7f7d0fd6b69d7ce4d62835
4
- data.tar.gz: f51965f0faec2fb982893f002c01d4499424d4838d7550cf44ff99c1ca859ea4
3
+ metadata.gz: 3b00e624e22bd699630d63b34f90be7758f82630a069f7db2a61e2139cb55888
4
+ data.tar.gz: 59add440f0203bade0430b2acd410e785b4ab0de416f272755a72db9276aa767
5
5
  SHA512:
6
- metadata.gz: 41001e2db9ba3048671910f0f4ebb264b781ef509d682353a02116434308386ad6c363a6409c311696729a28ea7fafa5edaf042f7f118485f0e31b0f5633c9e2
7
- data.tar.gz: 53e972089622fae12ad436e6634988d60fab6f271c391fc122d670c53cbc8d91312a4ba659d0e5f3e709bbaaf1969e4a9cb61ca2dd9b7e9152be478d0ae5347c
6
+ metadata.gz: eb24f3c965a15d090fd7fff5800cc4c1829a7ddc7f2cbc4e943bb7e57ae92749a6abfccfecd94e8522287e9700916fc22f57af164afa413459321fa9460ba9a3
7
+ data.tar.gz: d5d30e84e01f370ac62b77251f2c80c07964a99bebfa0cc30252237bc33830198d3a065c28a546c230327b1b951d45d95bc309f75276d17d7e1e8968ade216f2
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGES.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 1.4.3 - 20-Oct-2021
2
+ * Another fix for 32-bit vs 64-bit Linux since it was realized we cannot always
3
+ rely on the host architecture information. Handling for JRuby was improved
4
+ as well. Thanks go to Scott Bradnick for the spot.
5
+ * The constructor is now explicitly private. This class was never meant to
6
+ actually be instantiated.
7
+ * Updated the MANIFEST.md file.
8
+
1
9
  ## 1.4.2 - 22-Jul-2021
2
10
  * Fixed support for 32-bit Linux. Thanks go to ciprianbadescu for the spot.
3
11
 
data/Gemfile CHANGED
@@ -1,3 +1,2 @@
1
- source 'https://rubygems.org' do
2
- gemspec
3
- end
1
+ source 'https://rubygems.org'
2
+ gemspec
data/MANIFEST.md CHANGED
@@ -1,11 +1,12 @@
1
- * CHANGES.rdoc
1
+ * CHANGES.md
2
2
  * Gemfile
3
3
  * LICENSE
4
- * MANIFEST.rdoc
4
+ * MANIFEST.md
5
5
  * Rakefile
6
- * README.rdoc
6
+ * README.md
7
7
  * sys-fileystem.gemspec
8
8
  * certs/djberg96_pub.pem
9
+ * examples/example_mount.rb
9
10
  * examples/example_stat.rb
10
11
  * lib/sys-filesystem.rb
11
12
  * lib/sys/filesystem.rb
@@ -17,6 +18,6 @@
17
18
  * lib/sys/windows/sys/filesystem/constants.rb
18
19
  * lib/sys/windows/sys/filesystem/functions.rb
19
20
  * lib/sys/windows/sys/filesystem/helper.rb
20
- * test/test_sys_filesystem.rb
21
- * test/test_sys_filesystem_unix
22
- * test/test_sys_filesystem_windows
21
+ * spec/spec_helper.rb
22
+ * spec/sys_filesystem_unix_spec.rb
23
+ * spec/sys_filesystem_windows_spec.rb
data/README.md CHANGED
@@ -8,6 +8,9 @@ A cross platform Ruby interface for getting file system information.
8
8
 
9
9
  `gem install sys-filesystem`
10
10
 
11
+ ## Adding the trusted cert
12
+ `gem cert --add <(curl -Ls https://raw.githubusercontent.com/djberg96/sys-filesystem/main/certs/djberg96_pub.pem)`
13
+
11
14
  ## Synopsis
12
15
 
13
16
  ```ruby
@@ -1,7 +1,7 @@
1
1
  module Sys
2
2
  class Filesystem
3
3
  # The version of the sys-filesystem library
4
- VERSION = '1.4.2'.freeze
4
+ VERSION = '1.4.3'.freeze
5
5
  end
6
6
  end
7
7
 
@@ -7,9 +7,20 @@ module Sys
7
7
 
8
8
  ffi_lib FFI::Library::LIBC
9
9
 
10
+ def self.linux64?
11
+ if RUBY_PLATFORM == 'java'
12
+ ENV_JAVA['sun.arch.data.model'].to_i == 64
13
+ else
14
+ RbConfig::CONFIG['host_os'] =~ /linux/i &&
15
+ (RbConfig::CONFIG['arch'] =~ /64/ || RbConfig::CONFIG['DEFS'] =~ /64/)
16
+ end
17
+ end
18
+
19
+ private_class_method :linux64?
20
+
10
21
  if RbConfig::CONFIG['host_os'] =~ /sunos|solaris/i
11
22
  attach_function(:statvfs, :statvfs64, %i[string pointer], :int)
12
- elsif RbConfig::CONFIG['host_os'] =~ /linux/i && RbConfig::CONFIG['arch'] =~ /64/
23
+ elsif linux64?
13
24
  attach_function(:statvfs, :statvfs64, %i[string pointer], :int)
14
25
  else
15
26
  attach_function(:statvfs, %i[string pointer], :int)
@@ -6,6 +6,17 @@ module Sys
6
6
  module Structs
7
7
  class Statfs < FFI::Struct
8
8
 
9
+ def self.linux64?
10
+ if RUBY_PLATFORM == 'java'
11
+ ENV_JAVA['sun.arch.data.model'].to_i == 64
12
+ else
13
+ RbConfig::CONFIG['host_os'] =~ /linux/i &&
14
+ (RbConfig::CONFIG['arch'] =~ /64/ || RbConfig::CONFIG['DEFS'] =~ /64/)
15
+ end
16
+ end
17
+
18
+ private_class_method :linux64?
19
+
9
20
  # FreeBSD 12.0 MNAMELEN from 88 => 1024.
10
21
  MNAMELEN =
11
22
  if RbConfig::CONFIG['host_os'] =~ /freebsd(.*)/i
@@ -40,7 +51,7 @@ module Sys
40
51
  :f_mntonname, [:char, MNAMELEN]
41
52
  )
42
53
  elsif RbConfig::CONFIG['host_os'] =~ /linux/i
43
- if RbConfig::CONFIG['arch'] =~ /64/
54
+ if linux64?
44
55
  layout(
45
56
  :f_type, :ulong,
46
57
  :f_bsize, :ulong,
@@ -11,6 +11,8 @@ module Sys
11
11
  include Sys::Filesystem::Structs
12
12
  extend Sys::Filesystem::Functions
13
13
 
14
+ private_class_method :new
15
+
14
16
  # Readable versions of constant names
15
17
  OPT_NAMES = {
16
18
  MNT_RDONLY => 'read-only',
@@ -18,6 +18,8 @@ module Sys
18
18
  # Error typically raised if any of the Sys::Filesystem methods fail.
19
19
  class Error < StandardError; end
20
20
 
21
+ private_class_method :new
22
+
21
23
  class Mount
22
24
  # The name of the volume. This is the device mapping.
23
25
  attr_reader :name
@@ -21,10 +21,14 @@ RSpec.describe Sys::Filesystem, :unix => true do
21
21
  end
22
22
 
23
23
  example "version number is set to the expected value" do
24
- expect(Sys::Filesystem::VERSION).to eq('1.4.2')
24
+ expect(Sys::Filesystem::VERSION).to eq('1.4.3')
25
25
  expect(Sys::Filesystem::VERSION).to be_frozen
26
26
  end
27
27
 
28
+ example "you cannot instantiate an instance" do
29
+ expect{ described_class.new }.to raise_error(NoMethodError)
30
+ end
31
+
28
32
  example "stat path works as expected" do
29
33
  expect(@stat).to respond_to(:path)
30
34
  expect(@stat.path).to eq(root)
@@ -17,10 +17,14 @@ RSpec.describe Sys::Filesystem, :windows => true do
17
17
  end
18
18
 
19
19
  example "version number is set to the expected value" do
20
- expect(Sys::Filesystem::VERSION).to eq('1.4.2')
20
+ expect(Sys::Filesystem::VERSION).to eq('1.4.3')
21
21
  expect(Sys::Filesystem::VERSION).to be_frozen
22
22
  end
23
23
 
24
+ example "you cannot instantiate an instance" do
25
+ expect{ described_class.new }.to raise_error(NoMethodError)
26
+ end
27
+
24
28
  example "stat path works as expected" do
25
29
  expect(@stat).to respond_to(:path)
26
30
  expect(@stat.path).to eq(root)
@@ -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.4.2'
5
+ spec.version = '1.4.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'
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sys-filesystem
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
@@ -35,7 +35,7 @@ cert_chain:
35
35
  ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
36
36
  WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
37
37
  -----END CERTIFICATE-----
38
- date: 2021-07-22 00:00:00.000000000 Z
38
+ date: 2021-10-20 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: ffi
@@ -134,7 +134,7 @@ metadata:
134
134
  documentation_uri: https://github.com/djberg96/sys-filesystem/wiki
135
135
  source_code_uri: https://github.com/djberg96/sys-filesystem
136
136
  wiki_uri: https://github.com/djberg96/sys-filesystem/wiki
137
- post_install_message:
137
+ post_install_message:
138
138
  rdoc_options: []
139
139
  require_paths:
140
140
  - lib
@@ -149,8 +149,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  requirements: []
152
- rubygems_version: 3.0.3.1
153
- signing_key:
152
+ rubygems_version: 3.2.29
153
+ signing_key:
154
154
  specification_version: 4
155
155
  summary: A Ruby interface for getting file system information.
156
156
  test_files:
metadata.gz.sig CHANGED
@@ -1,3 +1 @@
1
- �~)g`؆�'��iI��uԂS)�
2
- L��"5�ފ�rȥ�5�/����E9������,;}̡����� �h�'Sp|q�IlB2Z�p�L��k�XzyV�� ��\�Ҩnx������b��*r������))`�!��rr_����{hkB=8���
3
- ���]�L��a��yc�pkS�L�oGO�b��qR�?1;O�J&��� ��&�� �M�@BU�{>��[���� p��i"S}
4
- �����٤�� a�,Q'3"�%� |,YU���j��B�J���RȎ�-��E>�A=i��e�%���b9d\�C~� !%���;�:F��, �u�\��=΁2.�4ݿ]�@� O�Ϭs,Yi���i��wUt��T=�������
1
+ �)Q�ge������@������F`FT"��1�O&���j$�<�O/>�D�n�3�`s��8�,���,�$"p%���sG��?�F�~i�K0�Ю#�b��^�>�0�",Y�v "L��P�lW��l�2�]О+Kɦ��M"�o���ݞ�>��D�M��*��*ݷu����4�:Z��tv&GiɊD�?Ệε\���QI�8��]Do89��l/���7��Q���q�$��l@�ᗆ��x��[H[�y�HWя���-�;������)1}��+�PpxMwM���Y2�#�����'y;��μ���>��`�k�� ���c[��Zo�}+�\V_�X�=�R���~�O���K������gN�c�Z�� O�