sys-filesystem 1.3.0 → 1.4.0

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: f47e78baa2a2d0586d9dccbe36fc98a2683f0f0cc9828d70317ba7d2dc2aaa40
4
- data.tar.gz: 8a887956f1a3c621057e93960e67871c646ae00f7cfe157d21ee0fd0f7d21bc7
3
+ metadata.gz: cf54720eed58f18d562942c0b1da0026bf0f814687de0fe5bab4cf49c90c39a3
4
+ data.tar.gz: 76baf71b511e2e36949d54b870f8f6d60d28fe0e735f4366cf69817e7359f09b
5
5
  SHA512:
6
- metadata.gz: 66a048e0249d7147868c2a3a21468f5f292be47e82d19316d00d7dc5deab8a4c961bd363c55c55ac7e83d8992a0ecc71a3579ec4ca6e7a874308bd7f5e727aa7
7
- data.tar.gz: 76ba77a00a187654367b01cacf2c282959fdbcaa3b2646075687a4f842ade1926bab0b38c51e60ac7b582f0633ce9ff27e32c349720788988a0e48cc5915c27a
6
+ metadata.gz: 3052ebcc1437f04d4e798856553f5567d016789e6936ac494ac3bf7b327bc0386a212e73e1664c58c48c6ee79aba76986a4130678e00f572d359bd75020e3e94
7
+ data.tar.gz: ad1b00477d3a8afef57768689120203356ec636a5bab122879a2fa764a5eec3ade92d10b105eea00a6807c7c41445a2f8dc25711564970a250a491bcf06d606e
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,8 +1,34 @@
1
- == 1.3.0 - 3-Oct-2019
1
+ ## 1.4.0 - 6-Sep-2020
2
+ * The Sys::Filesystem.stat method now accepts a Pathname and Dir object as
3
+ an argument. On most platforms it will also accept a File object. Thanks
4
+ go to hirura for the patch.
5
+ * Fixed the statvfs struct layout on i686 platforms. Thanks go to
6
+ Filipovici-Andrei for the patch.
7
+ * Switched from test-unit to rspec, and updated the tests.
8
+
9
+ ## 1.3.4 - 17-Mar-2020
10
+ * Properly include a LICENSE file as per the Apache-2.0 license.
11
+
12
+ ## 1.3.3 - 18-Feb-2020
13
+ * Linux now uses statvfs64 under the hood. This fixes a potential issue with
14
+ 32 bit systems. Thanks go to Tom Smyth for the spot.
15
+
16
+ ## 1.3.2 - 8-Dec-2019
17
+ * Renamed various text files to include .rdoc extension so that github renders
18
+ them nicely.
19
+
20
+ ## 1.3.1 - 15-Oct-2019
21
+ * Fixed a bug where the Statvfs and Statfs structs were not allocated properly
22
+ on Linux, which could cause issues. Thanks go to Daniele Orlandi for the spot.
23
+ * Added specs to ensure that the FFI struct size matches the C struct size.
24
+ This required adding mkmf-lite as a development dependency.
25
+ * Added a slightly more pessimistic version requirement for test-unit.
26
+
27
+ ## 1.3.0 - 3-Oct-2019
2
28
  * Added the mount and umount singleton methods.
3
29
  * Changed an internal class variable to a frozen constant.
4
30
 
5
- == 1.2.0 - 1-Jan-2019
31
+ ## 1.2.0 - 1-Jan-2019
6
32
  * Changed the license to Apache-2.0.
7
33
  * Added the case_sensitive? and case_insensitive? instance methods to the
8
34
  Filesystem::Stat class.
@@ -10,7 +36,7 @@
10
36
  * Fixed the deprecation warnings when running the tests on Windows.
11
37
  * Added metadata to the gemspec.
12
38
 
13
- == 1.1.9 - 26-Jan-2018
39
+ ## 1.1.9 - 26-Jan-2018
14
40
  * The bytes_free and bytes_total methods were updated to use the fragment size
15
41
  instead of the block size. This fixes Macs using APFS, as well as Solaris 10.
16
42
  Thanks go to Mikhail Vasin for the spot.
@@ -18,39 +44,39 @@
18
44
  to address the issue now resolved by the above change.
19
45
  * Updated the cert again.
20
46
 
21
- == 1.1.8 - 2-Sep-2017
47
+ ## 1.1.8 - 2-Sep-2017
22
48
  * The stat and mount_point methods now call to_s on the string argument
23
49
  explicitly so that Pathname objects will now work with String#wincode.
24
50
  * Updated some tests to avoid Fixnum warnings for Ruby 2.4.
25
51
  * Updated the cert.
26
52
 
27
- == 1.1.7 - 1-Aug-2016
53
+ ## 1.1.7 - 1-Aug-2016
28
54
  * Fixed an issue in the stat method for MS Windows where the blocks_avail
29
55
  value was not correct. Thanks go to Maxime Lapointe for the spot.
30
56
 
31
- == 1.1.6 - 17-May-2016
57
+ ## 1.1.6 - 17-May-2016
32
58
  * On versions that use setmntent or fopen, explicitly raise an error if
33
59
  either of those calls return a null value.
34
60
 
35
- == 1.1.5 - 5-Dec-2015
61
+ ## 1.1.5 - 5-Dec-2015
36
62
  * This gem is now signed.
37
63
  * The gem related tasks in the Rakefile now assume Rubygems 2.x.
38
64
  * Updates to the gemspec, added cert_chain, removed rubyforge_project.
39
65
  * Internal reorganization, and use of relative_require as appropriate.
40
66
  * Added a sys-filesystem.rb file for convenience.
41
67
 
42
- == 1.1.4 - 15-Mar-2015
68
+ ## 1.1.4 - 15-Mar-2015
43
69
  * The File.mounts method no longer raises an error if a mount point
44
70
  is not accessible. Thanks go to Michael Pope for the patch.
45
71
  * Some internal code reorganization.
46
72
 
47
- == 1.1.3 - 1-Oct-2014
73
+ ## 1.1.3 - 1-Oct-2014
48
74
  * Now ignores EPERM errors when trying to find the mount point for a path.
49
75
  Thanks go to petersen for the patch.
50
76
  * The Filesystem.stat method now defaults to using the root path on Windows
51
77
  for volume information.
52
78
 
53
- == 1.1.2 - 9-May-2014
79
+ ## 1.1.2 - 9-May-2014
54
80
  * Added the percent_used, bytes_total, bytes_free and bytes_used methods
55
81
  to the Filesystem::Stat class. Thanks go to xanview for the suggestion.
56
82
  * Changed File.exists? to File.exist? to avoid warnings in Ruby 2.1.x.
@@ -59,30 +85,30 @@
59
85
  * Added the to_tb method for terabytes.
60
86
  * Minor updates to the gem:create and gem:install Rake tasks.
61
87
 
62
- == 1.1.1 - 3-Oct-2013
88
+ ## 1.1.1 - 3-Oct-2013
63
89
  * Solaris now always uses statvfs64 on Solaris for better 64-bit support.
64
90
  Thanks go to Jeff Shantz for the spot.
65
91
 
66
- == 1.1.0 - 19-Jan-2013
92
+ ## 1.1.0 - 19-Jan-2013
67
93
  * Converted the Windows source code to use FFI. Consequently, there is now
68
94
  a single gem rather than separate gems for Windows and Unix.
69
95
  * Revamped the Windows tests.
70
96
 
71
- == 1.0.0 - 11-Jan-2012
97
+ ## 1.0.0 - 11-Jan-2012
72
98
  * Converted everything from C to FFI for the Unix flavors. The Windows
73
99
  source code remains untouched.
74
100
 
75
- == 0.3.4 - 19-Nov-2010
101
+ ## 0.3.4 - 19-Nov-2010
76
102
  * Fixed a bug where negative block counts were happening on very large
77
103
  hard drives. Thanks go to Jonas Pfenniger for the spot.
78
104
  * Refactored the clean task in the Rakefile.
79
105
  * Some cosmetic source code changes.
80
106
 
81
- == 0.3.3 - 21-May-2010
107
+ ## 0.3.3 - 21-May-2010
82
108
  * Added a workaround for the Sys::Filesystem#block_size member to deal with
83
109
  a bug in OS X. Thanks go to Josh Pasqualetto for the spot.
84
110
 
85
- == 0.3.2 - 29-Dec-2009
111
+ ## 0.3.2 - 29-Dec-2009
86
112
  * Source has been moved to github.
87
113
  * Added the 'gem' task and removed build logic from the gemspec.
88
114
  * Updated the install task.
@@ -90,23 +116,23 @@
90
116
  * Removed some junk build files that were inadvertently included in
91
117
  the last gem.
92
118
 
93
- == 0.3.1 - 5-Aug-2009
119
+ ## 0.3.1 - 5-Aug-2009
94
120
  * Now compatible with Ruby 1.9.x.
95
121
  * Changed license to Artistic 2.0
96
122
  * Updated the gemspec, including the explicit addition of a license and
97
123
  test-unit as a development dependency, as well as an updated description.
98
124
 
99
- == 0.3.0 - 26-Feb-2009
125
+ ## 0.3.0 - 26-Feb-2009
100
126
  * Added support for OS X and FreeBSD thanks to an awesome patch by Nobuyoshi
101
127
  Miyokawa.
102
128
  * Added the Filesystem.mount_point method that takes a file and returns
103
129
  the mount point it's sitting on.
104
130
 
105
- == 0.2.0 - 30-Dec-2008
131
+ ## 0.2.0 - 30-Dec-2008
106
132
  * Added the Filesystem.mounts method for iterating over mount or volume
107
133
  information.
108
134
 
109
- == 0.1.1 - 28-Mar-2007
135
+ ## 0.1.1 - 28-Mar-2007
110
136
  * Bug fix for BSD flavors. Thanks go to Jeremy Kemper and Ole Christian
111
137
  Rynning for the spot.
112
138
  * Bug fix for OS X (along the same lines as the BSD fix). Thanks go to
@@ -115,5 +141,5 @@
115
141
  * Tweaks to the gemspec.
116
142
  * Added synopsis to the README.
117
143
 
118
- == 0.1.0 - 17-Nov-2006
144
+ ## 0.1.0 - 17-Nov-2006
119
145
  * Initial release. Alpha. Code is stable, but API is not.
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org' do
2
+ gem 'ffi', '~> 1.1'
3
+ group 'test' do
4
+ gem 'mkmf-lite', '~> 0.4'
5
+ gem 'rake'
6
+ gem 'rspec', '~> 3.9'
7
+ gem 'fakefs', '~> 1.2'
8
+ end
9
+ end
data/LICENSE ADDED
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
@@ -1,7 +1,9 @@
1
- * MANIFEST
2
- * CHANGES
1
+ * CHANGES.rdoc
2
+ * Gemfile
3
+ * LICENSE
4
+ * MANIFEST.rdoc
3
5
  * Rakefile
4
- * README
6
+ * README.rdoc
5
7
  * sys-fileystem.gemspec
6
8
  * certs/djberg96_pub.pem
7
9
  * examples/example_stat.rb
@@ -0,0 +1,87 @@
1
+ ## Description
2
+
3
+ A cross platform Ruby interface for getting file system information.
4
+
5
+ ## Installation
6
+
7
+ `gem install sys-filesystem`
8
+
9
+ ## Synopsis
10
+
11
+ ```
12
+ require 'sys/filesystem'
13
+ include Sys
14
+
15
+ # Display information about a particular filesystem.
16
+ p Filesystem.stat('/')
17
+
18
+ # Sample output
19
+
20
+ #<Sys::Filesystem::Stat:0x517440
21
+ @base_type = "ufs",
22
+ @flags = 4,
23
+ @files_available = 3817457,
24
+ @block_size = 8192,
25
+ @blocks_available = 19957633,
26
+ @blocks = 34349612,
27
+ @name_max = 255,
28
+ @path = "/",
29
+ @filesystem_id = 35651592,
30
+ @files = 4135040,
31
+ @fragment_size = 1024,
32
+ @files_free = 3817457,
33
+ @blocks_free = 20301129
34
+ >
35
+
36
+ # Describe all mount points on the system
37
+ Filesystem.mounts{ |mount| p mount }
38
+
39
+ # Find the mount point of any particular file
40
+ puts Filesystem.mount_point('/home/djberge/some_file.txt') => '/home'
41
+ ```
42
+
43
+ ## Notes
44
+
45
+ This is a pure Ruby implementation that uses FFI. This means it should work
46
+ with JRuby, too.
47
+
48
+ ## Sample code
49
+
50
+ Run 'rake example' if you want to see a basic sample run. The actual code
51
+ is 'example_stat.rb' in the 'examples' directory. Modify it as you see fit.
52
+
53
+ ## Known Bugs
54
+
55
+ None that I'm aware of. Please report bugs on the project page at:
56
+
57
+ https://github.com/djberg96/sys-filesystem
58
+
59
+ ## Future Plans
60
+
61
+ * Add better 64-bit support for Linux and BSD.
62
+ * Other suggestions welcome.
63
+
64
+ ## Acknowledgements
65
+
66
+ * Mike Hall, for ideas and code that I borrowed from his 'filesystem' library.
67
+ * Park Heesob, for implementation and API ideas for the MS Windows version.
68
+ * Nobuyoshi Miyokawa, for adding the original FreeBSD and OS X support.
69
+
70
+ ## License
71
+
72
+ Apache-2.0
73
+
74
+ ## Copyright
75
+
76
+ (C) 2003-2020 Daniel J. Berger
77
+ All Rights Reserved
78
+
79
+ ## Warranty
80
+
81
+ This library is provided "as is" and without any express or
82
+ implied warranties, including, without limitation, the implied
83
+ warranties of merchantability and fitness for a particular purpose.
84
+
85
+ ## Author
86
+
87
+ Daniel J. Berger