sys-filesystem 0.3.3-x86-mingw32 → 0.3.4-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +6 -0
- data/README +51 -50
- data/Rakefile +34 -46
- data/lib/sys/filesystem.rb +2 -2
- data/sys-filesystem.gemspec +16 -16
- data/test/test_sys_filesystem.rb +2 -2
- data/test/test_sys_filesystem_unix.rb +1 -1
- data/test/test_sys_filesystem_windows.rb +1 -1
- metadata +18 -11
data/CHANGES
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 0.3.4 - 19-Nov-2010
|
2
|
+
* Fixed a bug where negative block counts were happening on very large
|
3
|
+
hard drives. Thanks go to Jonas Pfenniger for the spot.
|
4
|
+
* Refactored the clean task in the Rakefile.
|
5
|
+
* Some cosmetic source code changes.
|
6
|
+
|
1
7
|
== 0.3.3 - 21-May-2010
|
2
8
|
* Added a workaround for the Sys::Filesystem#block_size member to deal with
|
3
9
|
a bug in OS X. Thanks go to Josh Pasqualetto for the spot.
|
data/README
CHANGED
@@ -1,82 +1,83 @@
|
|
1
1
|
= Description
|
2
|
-
|
3
|
-
|
4
|
-
= Prerequisites
|
5
|
-
=== MS Windows
|
6
|
-
* windows-pr, 0.9.8 or later.
|
2
|
+
A Ruby interface for getting file system information.
|
7
3
|
|
8
4
|
= Installation
|
9
|
-
|
10
|
-
|
5
|
+
gem install sys-filesystem
|
6
|
+
|
7
|
+
== Windows
|
8
|
+
If the installation command above doesn't work try this:
|
9
|
+
|
10
|
+
gem install sys-filesystem --platform x86-mingw32
|
11
11
|
|
12
12
|
= Synopsis
|
13
|
-
|
14
|
-
|
13
|
+
require 'sys/filesystem'
|
14
|
+
include Sys
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
# Display information about a particular filesystem.
|
17
|
+
p Filesystem.stat('/')
|
18
18
|
|
19
|
-
|
19
|
+
# Sample output
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
21
|
+
#<Sys::Filesystem::Stat:0x517440
|
22
|
+
@base_type = "ufs",
|
23
|
+
@flags = 4,
|
24
|
+
@files_available = 3817457,
|
25
|
+
@block_size = 8192,
|
26
|
+
@blocks_available = 19957633,
|
27
|
+
@blocks = 34349612,
|
28
|
+
@name_max = 255,
|
29
|
+
@path = "/",
|
30
|
+
@filesystem_id = 35651592,
|
31
|
+
@files = 4135040,
|
32
|
+
@fragment_size = 1024,
|
33
|
+
@files_free = 3817457,
|
34
|
+
@blocks_free = 20301129
|
35
|
+
>
|
36
36
|
|
37
|
-
|
38
|
-
|
37
|
+
# Describe all mount points on the system
|
38
|
+
Filesystem.mounts{ |mount| p mount }
|
39
39
|
|
40
|
-
|
41
|
-
|
40
|
+
# Find the mount point of any particular file
|
41
|
+
puts Filesystem.mount_point('/home/djberge/some_file.txt') => '/home'
|
42
42
|
|
43
43
|
= Notes
|
44
44
|
=== MS Windows
|
45
|
-
|
46
|
-
|
45
|
+
This is a pure Ruby implementation using the windows-pr library, which in
|
46
|
+
turn wraps native Windows functions.
|
47
|
+
|
47
48
|
=== UNIX
|
48
|
-
|
49
|
+
This is a C extension that wraps statvfs, etc.
|
49
50
|
|
50
51
|
= Sample code
|
51
|
-
|
52
|
-
|
52
|
+
Run 'rake example' if you want to see a basic sample run. The actual code
|
53
|
+
is 'example_stat.rb' in the 'examples' directory. Modify it as you see fit.
|
53
54
|
|
54
55
|
= Known Bugs
|
55
|
-
|
56
|
-
|
56
|
+
None that I'm aware of. Please report bugs on the project page at
|
57
|
+
http://www.rubyforge.org/projects/sysutils.
|
57
58
|
|
58
59
|
= Future Plans
|
59
|
-
|
60
|
+
Suggestions welcome.
|
60
61
|
|
61
62
|
= Acknowledgements
|
62
|
-
|
63
|
-
|
63
|
+
Mike Hall, for ideas and code that I borrowed from his 'filesystem'
|
64
|
+
library.
|
64
65
|
|
65
|
-
|
66
|
+
Park Heesob, for implementation and API ideas for the MS Windows version.
|
66
67
|
|
67
|
-
|
68
|
+
Nobuyoshi Miyokawa, for adding FreeBSD and OS X support.
|
68
69
|
|
69
70
|
= License
|
70
|
-
|
71
|
+
Artistic 2.0
|
71
72
|
|
72
73
|
= Copyright
|
73
|
-
|
74
|
-
|
74
|
+
(C) 2003-2010 Daniel J. Berger
|
75
|
+
All Rights Reserved
|
75
76
|
|
76
77
|
= Warranty
|
77
|
-
|
78
|
-
|
79
|
-
|
78
|
+
This library is provided "as is" and without any express or
|
79
|
+
implied warranties, including, without limitation, the implied
|
80
|
+
warranties of merchantability and fitness for a particular purpose.
|
80
81
|
|
81
82
|
= Author
|
82
|
-
|
83
|
+
Daniel J. Berger
|
data/Rakefile
CHANGED
@@ -3,25 +3,19 @@ require 'rake/clean'
|
|
3
3
|
require 'rake/testtask'
|
4
4
|
include Config
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
sh 'make distclean' rescue nil
|
16
|
-
rm file if File.exists?(file)
|
17
|
-
rm_rf 'conftest.dSYM' if File.exists?('conftest.dSYM') # OS X weirdness
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
6
|
+
CLEAN.include(
|
7
|
+
'**/*.gem', # Gem files
|
8
|
+
'**/*.rbc', # Rubinius
|
9
|
+
'**/*.o', # C object file
|
10
|
+
'**/*.log', # Ruby extension build log
|
11
|
+
'**/Makefile', # C Makefile
|
12
|
+
'**/conftest.dSYM', # OS X build directory
|
13
|
+
"**/*.#{CONFIG['DLEXT']}" # C shared object
|
14
|
+
)
|
21
15
|
|
22
16
|
desc "Build the sys-filesystem library on UNIX systems (but don't install it)"
|
23
17
|
task :build => [:clean] do
|
24
|
-
unless
|
18
|
+
unless CONFIG['host_os'] =~ /mswin32|mingw|cygwin|windows|dos/i
|
25
19
|
file = 'filesystem.' + CONFIG['DLEXT']
|
26
20
|
Dir.chdir('ext') do
|
27
21
|
ruby 'extconf.rb'
|
@@ -31,23 +25,9 @@ task :build => [:clean] do
|
|
31
25
|
end
|
32
26
|
end
|
33
27
|
|
34
|
-
desc "Install the sys-filesystem library"
|
35
|
-
task :install do
|
36
|
-
unless Config::CONFIG['host_os'] =~ /mswin32|mingw|cygwin|windows|dos/i
|
37
|
-
install_dir = File.join(CONFIG['sitelibdir'], 'sys')
|
38
|
-
Dir.mkdir(install_dir) unless File.exists?(install_dir)
|
39
|
-
FileUtils.cp('lib/sys/filesystem.rb', install_dir, :verbose => true)
|
40
|
-
else
|
41
|
-
task :install => :build
|
42
|
-
Dir.chdir('ext') do
|
43
|
-
sh 'make install'
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
28
|
desc "Run the test suite"
|
49
29
|
Rake::TestTask.new("test") do |t|
|
50
|
-
unless
|
30
|
+
unless CONFIG['host_os'] =~ /mswin32|mingw|cygwin|windows|dos/i
|
51
31
|
task :test => :build
|
52
32
|
t.libs << 'ext'
|
53
33
|
t.libs.delete('lib')
|
@@ -68,28 +48,36 @@ task :example => [:build] do |t|
|
|
68
48
|
Dir.mkdir('sys') unless File.exists?('sys')
|
69
49
|
end
|
70
50
|
|
71
|
-
FileUtils.cp('ext/sys/filesystem.' +
|
51
|
+
FileUtils.cp('ext/sys/filesystem.' + CONFIG['DLEXT'], 'examples/sys')
|
72
52
|
|
73
53
|
Dir.chdir('examples') do
|
74
54
|
ruby 'example_stat.rb'
|
75
55
|
end
|
76
56
|
end
|
77
57
|
|
78
|
-
|
79
|
-
|
80
|
-
|
58
|
+
namespace :gem do
|
59
|
+
desc "Build the sys-filesystem gem"
|
60
|
+
task :create => [:clean] do |t|
|
61
|
+
spec = eval(IO.read('sys-filesystem.gemspec'))
|
81
62
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
63
|
+
if Config::CONFIG['host_os'] =~ /mswin32|mingw|cygwin|windows|dos/i
|
64
|
+
spec.files -= Dir['ext/**/*']
|
65
|
+
spec.platform = Gem::Platform::CURRENT
|
66
|
+
spec.add_dependency('windows-pr', '>= 1.0.5')
|
67
|
+
else
|
68
|
+
spec.extensions = ['ext/extconf.rb']
|
69
|
+
spec.files -= Dir['lib/**/*']
|
70
|
+
spec.extra_rdoc_files << 'ext/sys/filesystem.c'
|
71
|
+
end
|
72
|
+
|
73
|
+
Gem::Builder.new(spec).build
|
92
74
|
end
|
93
75
|
|
94
|
-
|
76
|
+
desc "Install the sys-filesystem gem"
|
77
|
+
task :install => [:create] do
|
78
|
+
file = Dir['*.gem'].first
|
79
|
+
sh "gem install #{file}"
|
80
|
+
end
|
95
81
|
end
|
82
|
+
|
83
|
+
task :default => :test
|
data/lib/sys/filesystem.rb
CHANGED
@@ -42,7 +42,7 @@ module Sys
|
|
42
42
|
READ_ONLY_VOLUME = 0x00080000
|
43
43
|
|
44
44
|
# The version of the sys-filesystem library.
|
45
|
-
VERSION = '0.3.
|
45
|
+
VERSION = '0.3.4'
|
46
46
|
|
47
47
|
class Mount
|
48
48
|
# The name of the volume. This is the device mapping.
|
@@ -171,7 +171,7 @@ module Sys
|
|
171
171
|
|
172
172
|
mounts = block_given? ? nil : []
|
173
173
|
|
174
|
-
# Try again if it fails
|
174
|
+
# Try again if it fails because the buffer is too small
|
175
175
|
if length > buffer.size
|
176
176
|
buffer = 0.chr * length
|
177
177
|
if GetLogicalDriveStrings(buffer.size, buffer) == 0
|
data/sys-filesystem.gemspec
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = 'sys-filesystem'
|
5
|
+
spec.version = '0.3.4'
|
6
|
+
spec.author = 'Daniel J. Berger'
|
7
|
+
spec.email = 'djberg96@gmail.com'
|
8
|
+
spec.homepage = 'http://www.rubyforge.org/projects/sysutils'
|
9
|
+
spec.platform = Gem::Platform::RUBY
|
10
|
+
spec.summary = 'A Ruby interface for getting file system information.'
|
11
|
+
spec.test_file = 'test/test_sys_filesystem.rb'
|
12
|
+
spec.has_rdoc = true
|
13
|
+
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
14
|
+
spec.license = 'Artistic 2.0'
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
spec.extra_rdoc_files = ['CHANGES', 'README', 'MANIFEST']
|
17
|
+
spec.rubyforge_project = 'sysutils'
|
18
18
|
|
19
|
-
|
19
|
+
spec.add_development_dependency('test-unit', '>= 2.1.1')
|
20
20
|
|
21
|
-
|
21
|
+
spec.description = <<-EOF
|
22
22
|
The sys-filesystem library provides an interface for gathering filesystem
|
23
23
|
information, such as disk space and mount point data.
|
24
24
|
EOF
|
data/test/test_sys_filesystem.rb
CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__))
|
|
3
3
|
require 'rbconfig'
|
4
4
|
|
5
5
|
if Config::CONFIG['host_os'] =~ /mswin32|mingw|cygwin|windows|dos/i
|
6
|
-
|
6
|
+
require 'test_sys_filesystem_windows'
|
7
7
|
else
|
8
|
-
|
8
|
+
require 'test_sys_filesystem_unix'
|
9
9
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sys-filesystem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
9
|
+
- 4
|
10
|
+
version: 0.3.4
|
10
11
|
platform: x86-mingw32
|
11
12
|
authors:
|
12
13
|
- Daniel J. Berger
|
@@ -14,30 +15,34 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-11-18 00:00:00 -07:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: test-unit
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 9
|
27
30
|
segments:
|
28
31
|
- 2
|
29
|
-
-
|
30
|
-
-
|
31
|
-
version: 2.
|
32
|
+
- 1
|
33
|
+
- 1
|
34
|
+
version: 2.1.1
|
32
35
|
type: :development
|
33
36
|
version_requirements: *id001
|
34
37
|
- !ruby/object:Gem::Dependency
|
35
38
|
name: windows-pr
|
36
39
|
prerelease: false
|
37
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
38
42
|
requirements:
|
39
43
|
- - ">="
|
40
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 29
|
41
46
|
segments:
|
42
47
|
- 1
|
43
48
|
- 0
|
@@ -76,25 +81,27 @@ rdoc_options: []
|
|
76
81
|
require_paths:
|
77
82
|
- lib
|
78
83
|
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
79
85
|
requirements:
|
80
86
|
- - ">="
|
81
87
|
- !ruby/object:Gem::Version
|
88
|
+
hash: 3
|
82
89
|
segments:
|
83
|
-
-
|
84
|
-
|
85
|
-
- 2
|
86
|
-
version: 1.8.2
|
90
|
+
- 0
|
91
|
+
version: "0"
|
87
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
88
94
|
requirements:
|
89
95
|
- - ">="
|
90
96
|
- !ruby/object:Gem::Version
|
97
|
+
hash: 3
|
91
98
|
segments:
|
92
99
|
- 0
|
93
100
|
version: "0"
|
94
101
|
requirements: []
|
95
102
|
|
96
103
|
rubyforge_project: sysutils
|
97
|
-
rubygems_version: 1.3.
|
104
|
+
rubygems_version: 1.3.7
|
98
105
|
signing_key:
|
99
106
|
specification_version: 3
|
100
107
|
summary: A Ruby interface for getting file system information.
|