sys-filesystem 0.3.3 → 0.3.4

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.
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
- A Ruby interface for getting file system information.
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
- rake test (optional)
10
- rake install (non-gem) OR rake install_gem (gem)
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
- require 'sys/filesystem'
14
- include Sys
13
+ require 'sys/filesystem'
14
+ include Sys
15
15
 
16
- # Display information about a particular filesystem.
17
- p Filesystem.stat('/')
16
+ # Display information about a particular filesystem.
17
+ p Filesystem.stat('/')
18
18
 
19
- # Sample output
19
+ # Sample output
20
20
 
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
- >
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
- # Describe all mount points on the system
38
- Filesystem.mounts{ |mount| p mount }
37
+ # Describe all mount points on the system
38
+ Filesystem.mounts{ |mount| p mount }
39
39
 
40
- # Find the mount point of any particular file
41
- puts Filesystem.mount_point('/home/djberge/some_file.txt') => '/home'
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
- This is a pure Ruby implementation using the windows-pr library, which in
46
- turn wraps native Windows functions.
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
- This is a C extension that wraps statvfs, etc.
49
+ This is a C extension that wraps statvfs, etc.
49
50
 
50
51
  = Sample code
51
- Run 'rake example' if you want to see a basic sample run. The actual code
52
- is 'example_stat.rb' in the 'examples' directory. Modify it as you see fit.
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
- None that I'm aware of. Please report bugs on the project page at
56
- http://www.rubyforge.org/projects/sysutils.
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
- Suggestions welcome.
60
+ Suggestions welcome.
60
61
 
61
62
  = Acknowledgements
62
- Mike Hall, for ideas and code that I borrowed from his 'filesystem'
63
- library.
63
+ Mike Hall, for ideas and code that I borrowed from his 'filesystem'
64
+ library.
64
65
 
65
- Park Heesob, for implementation and API ideas for the MS Windows version.
66
+ Park Heesob, for implementation and API ideas for the MS Windows version.
66
67
 
67
- Nobuyoshi Miyokawa, for adding FreeBSD and OS X support.
68
+ Nobuyoshi Miyokawa, for adding FreeBSD and OS X support.
68
69
 
69
70
  = License
70
- Artistic 2.0
71
+ Artistic 2.0
71
72
 
72
73
  = Copyright
73
- (C) 2003-2009 Daniel J. Berger
74
- All Rights Reserved
74
+ (C) 2003-2010 Daniel J. Berger
75
+ All Rights Reserved
75
76
 
76
77
  = Warranty
77
- This library is provided "as is" and without any express or
78
- implied warranties, including, without limitation, the implied
79
- warranties of merchantability and fitness for a particular purpose.
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
- Daniel J. Berger
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
- desc "Clean the build files for the sys-filesystem source for UNIX systems"
7
- task :clean do |task|
8
- Dir.chdir('examples') do
9
- FileUtils.rm_rf('sys') if File.exists?('sys')
10
- end
11
-
12
- unless Config::CONFIG['host_os'] =~ /mswin32|mingw|cygwin|windows|dos/i
13
- file = 'sys/filesystem.' + CONFIG['DLEXT']
14
- Dir.chdir('ext') do
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 Config::CONFIG['host_os'] =~ /mswin32|mingw|cygwin|windows|dos/i
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 Config::CONFIG['host_os'] =~ /mswin32|mingw|cygwin|windows|dos/i
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.' + Config::CONFIG['DLEXT'], 'examples/sys')
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
- desc "Build a gem"
79
- task :gem => [:clean] do |t|
80
- spec = eval(IO.read('sys-filesystem.gemspec'))
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
- if Config::CONFIG['host_os'] =~ /mswin32|mingw|cygwin|windows|dos/i
83
- spec.required_ruby_version = '>= 1.8.2'
84
- spec.files -= Dir['ext/**/*']
85
- spec.platform = Gem::Platform::CURRENT
86
- spec.add_dependency('windows-pr', '>= 1.0.5')
87
- else
88
- spec.required_ruby_version = '>= 1.8.0'
89
- spec.extensions = ['ext/extconf.rb']
90
- spec.files -= Dir['lib/**/*']
91
- spec.extra_rdoc_files << 'ext/sys/filesystem.c'
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
- Gem::Builder.new(spec).build
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/ext/sys/filesystem.c CHANGED
@@ -8,15 +8,15 @@
8
8
 
9
9
  #include <sys/types.h>
10
10
 
11
- #ifdef HAVE_SYS_STATVFS_H /* Most flavors of UNIX */
11
+ #ifdef HAVE_SYS_STATVFS_H // Most flavors of UNIX
12
12
  #include <sys/statvfs.h>
13
- #else /* FreeBSD 4.x */
13
+ #else // FreeBSD 4.x
14
14
  #include <sys/param.h>
15
15
  #include <sys/mount.h>
16
16
  #include <sys/vnode.h>
17
17
  #endif
18
18
 
19
- #ifdef HAVE_SYS_MNTTAB_H /* Solaris */
19
+ #ifdef HAVE_SYS_MNTTAB_H // Solaris
20
20
 
21
21
  #include <sys/mnttab.h>
22
22
  #define MNTENT mnttab
@@ -25,7 +25,7 @@
25
25
  #define END_MNT(F) fclose(F)
26
26
  #define MOUNTFILE "/etc/mnttab"
27
27
 
28
- /* Ruby 1.9.x compatibility */
28
+ // Ruby 1.9.x compatibility
29
29
  #ifndef RSTRING_PTR
30
30
  #define RSTRING_PTR(v) (RSTRING(v)->ptr)
31
31
  #define RSTRING_LEN(v) (RSTRING(v)->len)
@@ -54,7 +54,7 @@ struct _ment {
54
54
  #define END_MNT(F) end_mnt(F)
55
55
  #define MOUNTFILE "getmntinfo"
56
56
 
57
- #else /* Most flavors of UNIX */
57
+ #else // Most flavors of UNIX
58
58
 
59
59
  #ifdef HAVE_MNTENT_H
60
60
  #include <mntent.h>
@@ -69,7 +69,7 @@ struct _ment {
69
69
 
70
70
  #ifdef HAVE_GETMNTINFO
71
71
 
72
- /* below table comes from FreeBSD mount.c@1.105 */
72
+ // This table comes from FreeBSD mount.c@1.105
73
73
  static struct opt {
74
74
  int o_opt;
75
75
  const char *o_name;
@@ -102,7 +102,7 @@ static struct opt {
102
102
 
103
103
  static FILE* start_mnt(const char *filename, const char *type)
104
104
  {
105
- return (FILE*)!0; /* do nothing */
105
+ return (FILE*)!0; // Do nothing
106
106
  }
107
107
 
108
108
  static struct _ment* get_mnt(struct _ment* m)
@@ -111,7 +111,7 @@ static struct _ment* get_mnt(struct _ment* m)
111
111
 
112
112
  if (m->max == 0) {
113
113
  if ((m->max = getmntinfo(&(m->mntbufp), MNT_NOWAIT)) == 0) {
114
- return NULL; /* XXX */
114
+ return NULL;
115
115
  }
116
116
  m->current = 0;
117
117
  }
@@ -126,7 +126,7 @@ static struct _ment* get_mnt(struct _ment* m)
126
126
 
127
127
  static void end_mnt(FILE* fp)
128
128
  {
129
- /* do nothing */
129
+ // Do nothing
130
130
  }
131
131
 
132
132
  #endif
@@ -143,50 +143,50 @@ static VALUE create_mount_object(struct MNTENT*);
143
143
  * file system.
144
144
  */
145
145
  static VALUE fs_stat(VALUE klass, VALUE v_path){
146
- VALUE v_stat;
147
- char* path = StringValuePtr(v_path);
146
+ VALUE v_stat;
147
+ char* path = StringValuePtr(v_path);
148
148
 
149
149
  #ifdef HAVE_STATVFS
150
- struct statvfs fs;
150
+ struct statvfs fs;
151
151
 
152
- if(statvfs(path, &fs) < 0)
153
- rb_sys_fail("statvfs");
152
+ if(statvfs(path, &fs) < 0)
153
+ rb_sys_fail("statvfs");
154
154
  #else
155
- struct mount mp;
156
- struct statfs fs;
157
- struct proc p;
155
+ struct mount mp;
156
+ struct statfs fs;
157
+ struct proc p;
158
158
 
159
- if(VFS_STATFS(&mp, &fs, &p) < 0)
160
- rb_sys_fail("VFS_STATFS");
159
+ if(VFS_STATFS(&mp, &fs, &p) < 0)
160
+ rb_sys_fail("VFS_STATFS");
161
161
  #endif
162
162
 
163
- v_stat = rb_funcall(cStat, rb_intern("new"), 0, 0);
163
+ v_stat = rb_funcall(cStat, rb_intern("new"), 0, 0);
164
164
 
165
- rb_iv_set(v_stat, "@path", v_path);
165
+ rb_iv_set(v_stat, "@path", v_path);
166
166
 
167
167
  // You gotta love OS X, right?
168
168
  #ifdef __MACH__
169
- rb_iv_set(v_stat, "@block_size", ULONG2NUM(fs.f_bsize/256));
169
+ rb_iv_set(v_stat, "@block_size", ULONG2NUM(fs.f_bsize/256));
170
170
  #else
171
- rb_iv_set(v_stat, "@block_size", ULONG2NUM(fs.f_bsize));
171
+ rb_iv_set(v_stat, "@block_size", ULONG2NUM(fs.f_bsize));
172
172
  #endif
173
173
 
174
- rb_iv_set(v_stat, "@fragment_size", ULONG2NUM(fs.f_frsize));
175
- rb_iv_set(v_stat, "@blocks", LONG2NUM(fs.f_blocks));
176
- rb_iv_set(v_stat, "@blocks_free", LONG2NUM(fs.f_bfree));
177
- rb_iv_set(v_stat, "@blocks_available", LONG2NUM(fs.f_bavail));
178
- rb_iv_set(v_stat, "@files", LONG2NUM(fs.f_files));
179
- rb_iv_set(v_stat, "@files_free", LONG2NUM(fs.f_ffree));
180
- rb_iv_set(v_stat, "@files_available", LONG2NUM(fs.f_favail));
181
- rb_iv_set(v_stat, "@filesystem_id", ULONG2NUM(fs.f_fsid));
182
- rb_iv_set(v_stat, "@flags", ULONG2NUM(fs.f_flag));
183
- rb_iv_set(v_stat, "@name_max", ULONG2NUM(fs.f_namemax));
174
+ rb_iv_set(v_stat, "@fragment_size", ULONG2NUM(fs.f_frsize));
175
+ rb_iv_set(v_stat, "@blocks", ULONG2NUM(fs.f_blocks));
176
+ rb_iv_set(v_stat, "@blocks_free", ULONG2NUM(fs.f_bfree));
177
+ rb_iv_set(v_stat, "@blocks_available", ULONG2NUM(fs.f_bavail));
178
+ rb_iv_set(v_stat, "@files", ULONG2NUM(fs.f_files));
179
+ rb_iv_set(v_stat, "@files_free", ULONG2NUM(fs.f_ffree));
180
+ rb_iv_set(v_stat, "@files_available", ULONG2NUM(fs.f_favail));
181
+ rb_iv_set(v_stat, "@filesystem_id", ULONG2NUM(fs.f_fsid));
182
+ rb_iv_set(v_stat, "@flags", ULONG2NUM(fs.f_flag));
183
+ rb_iv_set(v_stat, "@name_max", ULONG2NUM(fs.f_namemax));
184
184
 
185
185
  #ifdef HAVE_ST_F_BASETYPE
186
- rb_iv_set(v_stat, "@base_type", rb_str_new2(fs.f_basetype));
186
+ rb_iv_set(v_stat, "@base_type", rb_str_new2(fs.f_basetype));
187
187
  #endif
188
188
 
189
- return rb_obj_freeze(v_stat);
189
+ return rb_obj_freeze(v_stat);
190
190
  }
191
191
 
192
192
  /* Convenient methods for converting bytes to kilobytes, megabytes or
@@ -200,7 +200,7 @@ static VALUE fs_stat(VALUE klass, VALUE v_path){
200
200
  * Returns +fix+ in terms of kilobytes.
201
201
  */
202
202
  static VALUE fixnum_to_kb(VALUE self){
203
- return ULL2NUM(NUM2ULONG(self) / 1024);
203
+ return ULL2NUM(NUM2ULONG(self) / 1024);
204
204
  }
205
205
 
206
206
  /*
@@ -210,7 +210,7 @@ static VALUE fixnum_to_kb(VALUE self){
210
210
  * Returns +fix+ in terms of megabytes.
211
211
  */
212
212
  static VALUE fixnum_to_mb(VALUE self){
213
- return ULL2NUM(NUM2ULONG(self) / 1048576);
213
+ return ULL2NUM(NUM2ULONG(self) / 1048576);
214
214
  }
215
215
 
216
216
  /*
@@ -220,7 +220,7 @@ static VALUE fixnum_to_mb(VALUE self){
220
220
  * Returns +fix+ in terms of gigabytes.
221
221
  */
222
222
  static VALUE fixnum_to_gb(VALUE self){
223
- return ULL2NUM(NUM2ULONG(self) / 1073741824);
223
+ return ULL2NUM(NUM2ULONG(self) / 1073741824);
224
224
  }
225
225
 
226
226
  /*
@@ -371,120 +371,122 @@ static VALUE fs_mount_point(VALUE klass, VALUE v_file){
371
371
  }
372
372
 
373
373
  void Init_filesystem(){
374
- /* The toplevel namespace */
375
- mSys = rb_define_module("Sys");
374
+ /* The toplevel namespace */
375
+ mSys = rb_define_module("Sys");
376
376
 
377
- /* The Filesystem class serves an abstract base class. It's methods return
378
- * objects of other types. Do not instantiate.
379
- */
380
- cFilesys = rb_define_class_under(mSys, "Filesystem", rb_cObject);
377
+ /* The Filesystem class serves an abstract base class. It's methods return
378
+ * objects of other types. Do not instantiate.
379
+ */
380
+ cFilesys = rb_define_class_under(mSys, "Filesystem", rb_cObject);
381
381
 
382
- /* Instances of this class are returned by the Filesystem.mount method */
383
- cMount = rb_define_class_under(cFilesys, "Mount", rb_cObject);
382
+ /* Instances of this class are returned by the Filesystem.mount method */
383
+ cMount = rb_define_class_under(cFilesys, "Mount", rb_cObject);
384
384
 
385
- /* Instances of this class are returned by the Filesystem.stat method */
386
- cStat = rb_define_class_under(cFilesys, "Stat", rb_cObject);
385
+ /* Instances of this class are returned by the Filesystem.stat method */
386
+ cStat = rb_define_class_under(cFilesys, "Stat", rb_cObject);
387
387
 
388
- /* Singleton methods */
389
- rb_define_singleton_method(cFilesys, "mount_point", fs_mount_point, 1);
390
- rb_define_singleton_method(cFilesys, "mounts", fs_mounts, 0);
391
- rb_define_singleton_method(cFilesys, "stat", fs_stat, 1);
388
+ /* Singleton methods */
389
+ rb_define_singleton_method(cFilesys, "mount_point", fs_mount_point, 1);
390
+ rb_define_singleton_method(cFilesys, "mounts", fs_mounts, 0);
391
+ rb_define_singleton_method(cFilesys, "stat", fs_stat, 1);
392
392
 
393
- /* Filesystem::Mount accessors */
393
+ /* Filesystem::Mount accessors */
394
394
 
395
- /* The name of the mounted resource */
396
- rb_define_attr(cMount, "name", 1, 0);
395
+ /* The name of the mounted resource */
396
+ rb_define_attr(cMount, "name", 1, 0);
397
397
 
398
- /* The mount point/directory */
399
- rb_define_attr(cMount, "mount_point", 1, 0);
398
+ /* The mount point/directory */
399
+ rb_define_attr(cMount, "mount_point", 1, 0);
400
400
 
401
- /* The type of the file system mount, e.g. 'ufs', 'nfs', etc */
402
- rb_define_attr(cMount, "mount_type", 1, 0);
401
+ /* The type of the file system mount, e.g. 'ufs', 'nfs', etc */
402
+ rb_define_attr(cMount, "mount_type", 1, 0);
403
403
 
404
- /* A list of comma separated options for the mount, e.g. 'rw', etc */
405
- rb_define_attr(cMount, "options", 1, 0);
404
+ /* A list of comma separated options for the mount, e.g. 'rw', etc */
405
+ rb_define_attr(cMount, "options", 1, 0);
406
406
 
407
- /* The time the file system was mounted or nil if not supported */
408
- rb_define_attr(cMount, "mount_time", 1, 0);
407
+ /* The time the file system was mounted or nil if not supported */
408
+ rb_define_attr(cMount, "mount_time", 1, 0);
409
409
 
410
- /* The dump frequency in days (or nil if not supported) */
411
- rb_define_attr(cMount, "dump_frequency", 1, 0);
410
+ /* The dump frequency in days (or nil if not supported) */
411
+ rb_define_attr(cMount, "dump_frequency", 1, 0);
412
412
 
413
- /* The pass number of the file system check or nil if not supported */
414
- rb_define_attr(cMount, "pass_number", 1, 0);
413
+ /* The pass number of the file system check or nil if not supported */
414
+ rb_define_attr(cMount, "pass_number", 1, 0);
415
415
 
416
- /* Filesystem::Mount Aliases */
416
+ /* Filesystem::Mount Aliases */
417
417
 
418
- rb_define_alias(cMount, "fsname", "name");
419
- rb_define_alias(cMount, "dir", "mount_point");
420
- rb_define_alias(cMount, "opts", "options");
421
- rb_define_alias(cMount, "passno", "pass_number");
422
- rb_define_alias(cMount, "freq", "dump_frequency");
418
+ rb_define_alias(cMount, "fsname", "name");
419
+ rb_define_alias(cMount, "dir", "mount_point");
420
+ rb_define_alias(cMount, "opts", "options");
421
+ rb_define_alias(cMount, "passno", "pass_number");
422
+ rb_define_alias(cMount, "freq", "dump_frequency");
423
423
 
424
- /* Filesystem::Stat accessors */
424
+ /* Filesystem::Stat accessors */
425
425
 
426
- /* The path of the file system */
427
- rb_define_attr(cStat, "path", 1, 0);
426
+ /* The path of the file system */
427
+ rb_define_attr(cStat, "path", 1, 0);
428
428
 
429
- /* The preferred system block size */
430
- rb_define_attr(cStat, "block_size", 1, 0);
429
+ /* The preferred system block size */
430
+ rb_define_attr(cStat, "block_size", 1, 0);
431
431
 
432
- /* The fragment size, i.e. fundamental file system block size */
433
- rb_define_attr(cStat, "fragment_size", 1, 0);
432
+ /* The fragment size, i.e. fundamental file system block size */
433
+ rb_define_attr(cStat, "fragment_size", 1, 0);
434
434
 
435
- /* The total number of +fragment_size+ blocks in the file system */
436
- rb_define_attr(cStat, "blocks", 1, 0);
435
+ /* The total number of +fragment_size+ blocks in the file system */
436
+ rb_define_attr(cStat, "blocks", 1, 0);
437
437
 
438
- /* The total number of free blocks in the file system */
439
- rb_define_attr(cStat, "blocks_free", 1, 0);
438
+ /* The total number of free blocks in the file system */
439
+ rb_define_attr(cStat, "blocks_free", 1, 0);
440
440
 
441
- /* The number of free blocks available to unprivileged processes */
442
- rb_define_attr(cStat, "blocks_available", 1, 0);
441
+ /* The number of free blocks available to unprivileged processes */
442
+ rb_define_attr(cStat, "blocks_available", 1, 0);
443
443
 
444
- /* The total number of files/inodes that can be created */
445
- rb_define_attr(cStat, "files", 1, 0);
444
+ /* The total number of files/inodes that can be created */
445
+ rb_define_attr(cStat, "files", 1, 0);
446
446
 
447
- /* The total number of free files/inodes on the file system */
448
- rb_define_attr(cStat, "files_free", 1, 0);
447
+ /* The total number of free files/inodes on the file system */
448
+ rb_define_attr(cStat, "files_free", 1, 0);
449
449
 
450
- /* The number of free files/inodes available to unprivileged processes */
451
- rb_define_attr(cStat, "files_available", 1, 0);
450
+ /* The number of free files/inodes available to unprivileged processes */
451
+ rb_define_attr(cStat, "files_available", 1, 0);
452
452
 
453
- /* The file system identifier */
454
- rb_define_attr(cStat, "filesystem_id", 1, 0);
453
+ /* The file system identifier */
454
+ rb_define_attr(cStat, "filesystem_id", 1, 0);
455
455
 
456
- /* The file system type, e.g. UFS */
457
- rb_define_attr(cStat, "base_type", 1, 0);
456
+ /* The file system type, e.g. UFS */
457
+ rb_define_attr(cStat, "base_type", 1, 0);
458
458
 
459
- /* A bit mask of flags. See the <tt>Constants</tt> for a list of flags */
460
- rb_define_attr(cStat, "flags", 1, 0);
459
+ /* A bit mask of flags. See the <tt>Constants</tt> for a list of flags */
460
+ rb_define_attr(cStat, "flags", 1, 0);
461
461
 
462
- /* The maximum length of a file name permitted on the file system */
463
- rb_define_attr(cStat, "name_max", 1, 0);
462
+ /* The maximum length of a file name permitted on the file system */
463
+ rb_define_attr(cStat, "name_max", 1, 0);
464
464
 
465
- /* Constants */
465
+ // Constants
466
466
 
467
- /* 0.3.3: The version of this library (a String) */
468
- rb_define_const(cFilesys, "VERSION", rb_str_new2("0.3.3"));
467
+ /* 0.3.4: The version of this library (a String) */
468
+ rb_define_const(cFilesys, "VERSION", rb_str_new2("0.3.4"));
469
469
 
470
- /* 0x00000001: Read only file system */
471
- rb_define_const(cStat, "RDONLY", INT2FIX(ST_RDONLY));
470
+ /* 0x00000001: Read only file system */
471
+ rb_define_const(cStat, "RDONLY", INT2FIX(ST_RDONLY));
472
472
 
473
- /* 0x00000002: File system does not support suid or sgid semantics */
474
- rb_define_const(cStat, "NOSUID", INT2FIX(ST_NOSUID));
473
+ /* 0x00000002: File system does not support suid or sgid semantics */
474
+ rb_define_const(cStat, "NOSUID", INT2FIX(ST_NOSUID));
475
475
 
476
476
  #ifdef ST_NOTRUNC
477
- /* 0x00000003: File system does not truncate file names longer than +name_max+ */
478
- rb_define_const(cStat, "NOTRUNC", INT2FIX(ST_NOTRUNC));
477
+ /* 0x00000003: File system does not truncate file names longer than +name_max+ */
478
+ rb_define_const(cStat, "NOTRUNC", INT2FIX(ST_NOTRUNC));
479
479
  #endif
480
480
 
481
- /* Aliases */
482
- rb_define_alias(cStat, "inodes", "files");
483
- rb_define_alias(cStat, "inodes_free", "files_free");
484
- rb_define_alias(cStat, "inodes_available", "files_available");
481
+ // Aliases
482
+
483
+ rb_define_alias(cStat, "inodes", "files");
484
+ rb_define_alias(cStat, "inodes_free", "files_free");
485
+ rb_define_alias(cStat, "inodes_available", "files_available");
486
+
487
+ // Convenient methods for Fixnum
485
488
 
486
- /* Convenient methods for Fixnum */
487
- rb_define_method(rb_cFixnum, "to_kb", fixnum_to_kb, 0);
488
- rb_define_method(rb_cFixnum, "to_mb", fixnum_to_mb, 0);
489
- rb_define_method(rb_cFixnum, "to_gb", fixnum_to_gb, 0);
489
+ rb_define_method(rb_cFixnum, "to_kb", fixnum_to_kb, 0);
490
+ rb_define_method(rb_cFixnum, "to_mb", fixnum_to_mb, 0);
491
+ rb_define_method(rb_cFixnum, "to_gb", fixnum_to_gb, 0);
490
492
  }
@@ -1,24 +1,24 @@
1
1
  require 'rubygems'
2
2
 
3
- spec = Gem::Specification.new do |gem|
4
- gem.name = 'sys-filesystem'
5
- gem.version = '0.3.3'
6
- gem.author = 'Daniel J. Berger'
7
- gem.email = 'djberg96@gmail.com'
8
- gem.homepage = 'http://www.rubyforge.org/projects/sysutils'
9
- gem.platform = Gem::Platform::RUBY
10
- gem.summary = 'A Ruby interface for getting file system information.'
11
- gem.test_file = 'test/test_sys_filesystem.rb'
12
- gem.has_rdoc = true
13
- gem.files = Dir['**/*'].reject{ |f| f.include?('git') }
14
- gem.license = 'Artistic 2.0'
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
- gem.extra_rdoc_files = ['CHANGES', 'README', 'MANIFEST']
17
- gem.rubyforge_project = 'sysutils'
16
+ spec.extra_rdoc_files = ['CHANGES', 'README', 'MANIFEST']
17
+ spec.rubyforge_project = 'sysutils'
18
18
 
19
- gem.add_development_dependency('test-unit', '>= 2.0.3')
19
+ spec.add_development_dependency('test-unit', '>= 2.1.1')
20
20
 
21
- gem.description = <<-EOF
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
@@ -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
- require 'test_sys_filesystem_windows'
6
+ require 'test_sys_filesystem_windows'
7
7
  else
8
- require 'test_sys_filesystem_unix'
8
+ require 'test_sys_filesystem_unix'
9
9
  end
@@ -28,7 +28,7 @@ class TC_Sys_Filesystem_Unix < Test::Unit::TestCase
28
28
  end
29
29
 
30
30
  def test_version
31
- assert_equal('0.3.3', Filesystem::VERSION)
31
+ assert_equal('0.3.4', Filesystem::VERSION)
32
32
  end
33
33
 
34
34
  def test_stat_path
@@ -22,7 +22,7 @@ class TC_Sys_Filesystem_Windows < Test::Unit::TestCase
22
22
  end
23
23
 
24
24
  def test_version
25
- assert_equal('0.3.3', Filesystem::VERSION)
25
+ assert_equal('0.3.4', Filesystem::VERSION)
26
26
  end
27
27
 
28
28
  def test_stat_path
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
- - 3
9
- version: 0.3.3
9
+ - 4
10
+ version: 0.3.4
10
11
  platform: ruby
11
12
  authors:
12
13
  - Daniel J. Berger
@@ -14,21 +15,23 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-21 00:00:00 -06:00
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
- - 0
30
- - 3
31
- version: 2.0.3
32
+ - 1
33
+ - 1
34
+ version: 2.1.1
32
35
  type: :development
33
36
  version_requirements: *id001
34
37
  description: " The sys-filesystem library provides an interface for gathering filesystem\n information, such as disk space and mount point data.\n"
@@ -64,25 +67,27 @@ rdoc_options: []
64
67
  require_paths:
65
68
  - lib
66
69
  required_ruby_version: !ruby/object:Gem::Requirement
70
+ none: false
67
71
  requirements:
68
72
  - - ">="
69
73
  - !ruby/object:Gem::Version
74
+ hash: 3
70
75
  segments:
71
- - 1
72
- - 8
73
76
  - 0
74
- version: 1.8.0
77
+ version: "0"
75
78
  required_rubygems_version: !ruby/object:Gem::Requirement
79
+ none: false
76
80
  requirements:
77
81
  - - ">="
78
82
  - !ruby/object:Gem::Version
83
+ hash: 3
79
84
  segments:
80
85
  - 0
81
86
  version: "0"
82
87
  requirements: []
83
88
 
84
89
  rubyforge_project: sysutils
85
- rubygems_version: 1.3.6
90
+ rubygems_version: 1.3.7
86
91
  signing_key:
87
92
  specification_version: 3
88
93
  summary: A Ruby interface for getting file system information.