sys-filesystem 0.1.0-mswin32
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 +2 -0
 - data/MANIFEST +14 -0
 - data/README +49 -0
 - data/extconf.rb +9 -0
 - data/lib/sys/filesystem.rb +184 -0
 - data/sys-filesystem-0.1.0-mswin32.gem +0 -0
 - data/sys-filesystem.gemspec +34 -0
 - data/test/tc_filesystem.rb +7 -0
 - data/test/tc_unix.rb +129 -0
 - data/test/tc_windows.rb +129 -0
 - metadata +61 -0
 
    
        data/CHANGES
    ADDED
    
    
    
        data/MANIFEST
    ADDED
    
    
    
        data/README
    ADDED
    
    | 
         @@ -0,0 +1,49 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            = Description
         
     | 
| 
      
 2 
     | 
    
         
            +
               A Ruby interface for getting file system information.
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            = Prerequisites
         
     | 
| 
      
 5 
     | 
    
         
            +
            === MS Windows 
         
     | 
| 
      
 6 
     | 
    
         
            +
            * windows-pr, 0.6.0 or later.
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            = Installation
         
     | 
| 
      
 9 
     | 
    
         
            +
            === MS Windows:
         
     | 
| 
      
 10 
     | 
    
         
            +
               ruby test/tc_filesystem.rb (optional)
         
     | 
| 
      
 11 
     | 
    
         
            +
               ruby install.rb
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            === All other platforms:
         
     | 
| 
      
 14 
     | 
    
         
            +
               ruby extconf.rb
         
     | 
| 
      
 15 
     | 
    
         
            +
               make
         
     | 
| 
      
 16 
     | 
    
         
            +
               ruby test/tc_filesystem.rb (optional)
         
     | 
| 
      
 17 
     | 
    
         
            +
               make install
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            = Notes
         
     | 
| 
      
 20 
     | 
    
         
            +
            === MS Windows
         
     | 
| 
      
 21 
     | 
    
         
            +
               This is a pure Ruby implementation using the windows-pr package, which in
         
     | 
| 
      
 22 
     | 
    
         
            +
               turn wraps native Windows functions.
         
     | 
| 
      
 23 
     | 
    
         
            +
            === UNIX
         
     | 
| 
      
 24 
     | 
    
         
            +
               This is a C extension that wraps statvfs, etc.
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            = Known Bugs
         
     | 
| 
      
 27 
     | 
    
         
            +
               None that I'm aware of.  Please report bugs on the project page at
         
     | 
| 
      
 28 
     | 
    
         
            +
               http://www.rubyforge.org/projects/sysutils.
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            = Future Plans
         
     | 
| 
      
 31 
     | 
    
         
            +
               Add support for mount points/volumes.
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            = Acknowledgements
         
     | 
| 
      
 34 
     | 
    
         
            +
               Mike Hall, for ideas and code that I borrowed from his 'filesystem' package.
         
     | 
| 
      
 35 
     | 
    
         
            +
               Park Heesob, for implementation and API ideas for the MS Windows version.
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            = Copyright
         
     | 
| 
      
 38 
     | 
    
         
            +
               (C) 2003-2006 Daniel J. Berger
         
     | 
| 
      
 39 
     | 
    
         
            +
               All Rights Reserved
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            = Warranty
         
     | 
| 
      
 42 
     | 
    
         
            +
               This package is provided "as is" and without any express or
         
     | 
| 
      
 43 
     | 
    
         
            +
               implied warranties, including, without limitation, the implied
         
     | 
| 
      
 44 
     | 
    
         
            +
               warranties of merchantability and fitness for a particular purpose.
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            = Author
         
     | 
| 
      
 47 
     | 
    
         
            +
               Daniel J. Berger
         
     | 
| 
      
 48 
     | 
    
         
            +
               djberg96 at gmail dot com
         
     | 
| 
      
 49 
     | 
    
         
            +
               imperator on IRC (irc.freenode.net)
         
     | 
    
        data/extconf.rb
    ADDED
    
    
| 
         @@ -0,0 +1,184 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'windows/error'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'windows/filesystem'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'windows/volume'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module Sys
         
     | 
| 
      
 6 
     | 
    
         
            +
               class Filesystem
         
     | 
| 
      
 7 
     | 
    
         
            +
                  extend Windows::Error
         
     | 
| 
      
 8 
     | 
    
         
            +
                  extend Windows::FileSystem
         
     | 
| 
      
 9 
     | 
    
         
            +
                  extend Windows::Volume
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                  # Error raised if any of the Windows API functions fail.
         
     | 
| 
      
 12 
     | 
    
         
            +
                  class Error < StandardError; end
         
     | 
| 
      
 13 
     | 
    
         
            +
                  
         
     | 
| 
      
 14 
     | 
    
         
            +
                  VERSION = '0.1.0'
         
     | 
| 
      
 15 
     | 
    
         
            +
                  
         
     | 
| 
      
 16 
     | 
    
         
            +
                  class Stat
         
     | 
| 
      
 17 
     | 
    
         
            +
                     CASE_SENSITIVE_SEARCH      = 0x00000001  
         
     | 
| 
      
 18 
     | 
    
         
            +
                     CASE_PRESERVED_NAMES       = 0x00000002  
         
     | 
| 
      
 19 
     | 
    
         
            +
                     UNICODE_ON_DISK            = 0x00000004  
         
     | 
| 
      
 20 
     | 
    
         
            +
                     PERSISTENT_ACLS            = 0x00000008  
         
     | 
| 
      
 21 
     | 
    
         
            +
                     FILE_COMPRESSION           = 0x00000010  
         
     | 
| 
      
 22 
     | 
    
         
            +
                     VOLUME_QUOTAS              = 0x00000020  
         
     | 
| 
      
 23 
     | 
    
         
            +
                     SUPPORTS_SPARSE_FILES      = 0x00000040  
         
     | 
| 
      
 24 
     | 
    
         
            +
                     SUPPORTS_REPARSE_POINTS    = 0x00000080  
         
     | 
| 
      
 25 
     | 
    
         
            +
                     SUPPORTS_REMOTE_STORAGE    = 0x00000100  
         
     | 
| 
      
 26 
     | 
    
         
            +
                     VOLUME_IS_COMPRESSED       = 0x00008000  
         
     | 
| 
      
 27 
     | 
    
         
            +
                     SUPPORTS_OBJECT_IDS        = 0x00010000  
         
     | 
| 
      
 28 
     | 
    
         
            +
                     SUPPORTS_ENCRYPTION        = 0x00020000  
         
     | 
| 
      
 29 
     | 
    
         
            +
                     NAMED_STREAMS              = 0x00040000  
         
     | 
| 
      
 30 
     | 
    
         
            +
                     READ_ONLY_VOLUME           = 0x00080000
         
     | 
| 
      
 31 
     | 
    
         
            +
                     
         
     | 
| 
      
 32 
     | 
    
         
            +
                     # The path of the file system.
         
     | 
| 
      
 33 
     | 
    
         
            +
                     attr_reader :path
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                     # The file system block size.  MS Windows typically defaults to 4096.
         
     | 
| 
      
 36 
     | 
    
         
            +
                     attr_reader :block_size
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                     # Fragment size. Meaningless at the moment.
         
     | 
| 
      
 39 
     | 
    
         
            +
                     attr_reader :fragment_size
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                     # The total number of blocks available (used or unused) on the file
         
     | 
| 
      
 42 
     | 
    
         
            +
                     # system.
         
     | 
| 
      
 43 
     | 
    
         
            +
                     attr_reader :blocks
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                     # The total number of unused blocks.
         
     | 
| 
      
 46 
     | 
    
         
            +
                     attr_reader :blocks_free
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                     # The total number of unused blocks available to unprivileged
         
     | 
| 
      
 49 
     | 
    
         
            +
                     # processes. Identical to +blocks+ at the moment.
         
     | 
| 
      
 50 
     | 
    
         
            +
                     attr_reader :blocks_available
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                     # Total number of files/inodes that can be created on the file system.
         
     | 
| 
      
 53 
     | 
    
         
            +
                     # This attribute is always nil on MS Windows.
         
     | 
| 
      
 54 
     | 
    
         
            +
                     attr_reader :files
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                     # Total number of free files/inodes that can be created on the file
         
     | 
| 
      
 57 
     | 
    
         
            +
                     # system.  This attribute is always nil on MS Windows.
         
     | 
| 
      
 58 
     | 
    
         
            +
                     attr_reader :files_free
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                     # Total number of available files/inodes for unprivileged processes
         
     | 
| 
      
 61 
     | 
    
         
            +
                     # that can be created on the file system. This attribute is always
         
     | 
| 
      
 62 
     | 
    
         
            +
                     # nil on MS Windows.
         
     | 
| 
      
 63 
     | 
    
         
            +
                     attr_reader :files_available
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                     # The file system volume id.
         
     | 
| 
      
 66 
     | 
    
         
            +
                     attr_reader :filesystem_id
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                     # A bit mask of file system flags.
         
     | 
| 
      
 69 
     | 
    
         
            +
                     attr_reader :flags
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                     # The maximum length of a file name permitted on the file system.
         
     | 
| 
      
 72 
     | 
    
         
            +
                     attr_reader :name_max
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                     # The file system type, e.g. NTFS, FAT, etc.
         
     | 
| 
      
 75 
     | 
    
         
            +
                     attr_reader :base_type
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                     alias inodes files
         
     | 
| 
      
 78 
     | 
    
         
            +
                     alias inodes_free files_free
         
     | 
| 
      
 79 
     | 
    
         
            +
                     alias inodes_available files_available
         
     | 
| 
      
 80 
     | 
    
         
            +
                  end
         
     | 
| 
      
 81 
     | 
    
         
            +
                 
         
     | 
| 
      
 82 
     | 
    
         
            +
                  # Returns a Filesystem::Stat object that contains information about the
         
     | 
| 
      
 83 
     | 
    
         
            +
                  # +path+ file system.
         
     | 
| 
      
 84 
     | 
    
         
            +
                  #
         
     | 
| 
      
 85 
     | 
    
         
            +
                  def self.stat(path)
         
     | 
| 
      
 86 
     | 
    
         
            +
                     bytes_avail = [0].pack('Q')
         
     | 
| 
      
 87 
     | 
    
         
            +
                     bytes_free  = [0].pack('Q')
         
     | 
| 
      
 88 
     | 
    
         
            +
                     total_bytes = [0].pack('Q')
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
                     unless GetDiskFreeSpaceEx(path, bytes_avail, total_bytes, bytes_free)
         
     | 
| 
      
 91 
     | 
    
         
            +
                        raise Error, get_last_error 
         
     | 
| 
      
 92 
     | 
    
         
            +
                     end                           
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
                     bytes_avail = bytes_avail.unpack('Q').first
         
     | 
| 
      
 95 
     | 
    
         
            +
                     bytes_free  = bytes_free.unpack('Q').first
         
     | 
| 
      
 96 
     | 
    
         
            +
                     total_bytes = total_bytes.unpack('Q').first
         
     | 
| 
      
 97 
     | 
    
         
            +
             
     | 
| 
      
 98 
     | 
    
         
            +
                     sectors = [0].pack('Q')
         
     | 
| 
      
 99 
     | 
    
         
            +
                     bytes   = [0].pack('Q')
         
     | 
| 
      
 100 
     | 
    
         
            +
                     free    = [0].pack('Q')
         
     | 
| 
      
 101 
     | 
    
         
            +
                     total   = [0].pack('Q')
         
     | 
| 
      
 102 
     | 
    
         
            +
             
     | 
| 
      
 103 
     | 
    
         
            +
                     unless GetDiskFreeSpace(path, sectors, bytes, free, total)
         
     | 
| 
      
 104 
     | 
    
         
            +
                        raise Error, get_last_error
         
     | 
| 
      
 105 
     | 
    
         
            +
                     end
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
                     sectors = sectors.unpack('Q').first
         
     | 
| 
      
 108 
     | 
    
         
            +
                     bytes   = bytes.unpack('Q').first
         
     | 
| 
      
 109 
     | 
    
         
            +
                     free    = free.unpack('Q').first
         
     | 
| 
      
 110 
     | 
    
         
            +
                     total   = total.unpack('Q').first
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
                     block_size   = sectors * bytes
         
     | 
| 
      
 113 
     | 
    
         
            +
                     blocks_avail = total_bytes / block_size
         
     | 
| 
      
 114 
     | 
    
         
            +
                     blocks_free  = bytes_free / block_size
         
     | 
| 
      
 115 
     | 
    
         
            +
             
     | 
| 
      
 116 
     | 
    
         
            +
                     vol_name   = 0.chr * 260
         
     | 
| 
      
 117 
     | 
    
         
            +
                     base_type  = 0.chr * 260
         
     | 
| 
      
 118 
     | 
    
         
            +
                     vol_serial = [0].pack('L')
         
     | 
| 
      
 119 
     | 
    
         
            +
                     name_max   = [0].pack('L')
         
     | 
| 
      
 120 
     | 
    
         
            +
                     flags      = [0].pack('L')
         
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
      
 122 
     | 
    
         
            +
                     bool = GetVolumeInformation(
         
     | 
| 
      
 123 
     | 
    
         
            +
                        path,
         
     | 
| 
      
 124 
     | 
    
         
            +
                        vol_name,
         
     | 
| 
      
 125 
     | 
    
         
            +
                        vol_name.size,
         
     | 
| 
      
 126 
     | 
    
         
            +
                        vol_serial,
         
     | 
| 
      
 127 
     | 
    
         
            +
                        name_max,
         
     | 
| 
      
 128 
     | 
    
         
            +
                        flags,
         
     | 
| 
      
 129 
     | 
    
         
            +
                        base_type,
         
     | 
| 
      
 130 
     | 
    
         
            +
                        base_type.size
         
     | 
| 
      
 131 
     | 
    
         
            +
                     )
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
                     unless bool
         
     | 
| 
      
 134 
     | 
    
         
            +
                        raise Error, get_last_error
         
     | 
| 
      
 135 
     | 
    
         
            +
                     end
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     | 
| 
      
 137 
     | 
    
         
            +
                     vol_serial = vol_serial.unpack('L').first
         
     | 
| 
      
 138 
     | 
    
         
            +
                     name_max   = name_max.unpack('L').first
         
     | 
| 
      
 139 
     | 
    
         
            +
                     flags      = flags.unpack('L').first
         
     | 
| 
      
 140 
     | 
    
         
            +
                     base_type  = base_type[/^[^\0]*/]
         
     | 
| 
      
 141 
     | 
    
         
            +
             
     | 
| 
      
 142 
     | 
    
         
            +
                     stat_obj = Stat.new
         
     | 
| 
      
 143 
     | 
    
         
            +
                     stat_obj.instance_variable_set(:@path, path)
         
     | 
| 
      
 144 
     | 
    
         
            +
                     stat_obj.instance_variable_set(:@block_size, block_size)
         
     | 
| 
      
 145 
     | 
    
         
            +
                     stat_obj.instance_variable_set(:@blocks, blocks_avail)
         
     | 
| 
      
 146 
     | 
    
         
            +
                     stat_obj.instance_variable_set(:@blocks_available, blocks_avail)
         
     | 
| 
      
 147 
     | 
    
         
            +
                     stat_obj.instance_variable_set(:@blocks_free, blocks_free)
         
     | 
| 
      
 148 
     | 
    
         
            +
                     stat_obj.instance_variable_set(:@name_max, name_max)
         
     | 
| 
      
 149 
     | 
    
         
            +
                     stat_obj.instance_variable_set(:@base_type, base_type)
         
     | 
| 
      
 150 
     | 
    
         
            +
                     stat_obj.instance_variable_set(:@flags, flags)
         
     | 
| 
      
 151 
     | 
    
         
            +
                     stat_obj.instance_variable_set(:@filesystem_id, vol_serial)
         
     | 
| 
      
 152 
     | 
    
         
            +
               
         
     | 
| 
      
 153 
     | 
    
         
            +
                     stat_obj.freeze # Read-only object
         
     | 
| 
      
 154 
     | 
    
         
            +
                  end
         
     | 
| 
      
 155 
     | 
    
         
            +
               end
         
     | 
| 
      
 156 
     | 
    
         
            +
            end
         
     | 
| 
      
 157 
     | 
    
         
            +
             
     | 
| 
      
 158 
     | 
    
         
            +
            # Some convenient methods for converting bytes to kb, mb, and gb.
         
     | 
| 
      
 159 
     | 
    
         
            +
            # 
         
     | 
| 
      
 160 
     | 
    
         
            +
            class Fixnum
         
     | 
| 
      
 161 
     | 
    
         
            +
               # call-seq:
         
     | 
| 
      
 162 
     | 
    
         
            +
               #  <tt>fix</tt>.to_kb
         
     | 
| 
      
 163 
     | 
    
         
            +
               #
         
     | 
| 
      
 164 
     | 
    
         
            +
               # Returns +fix+ in terms of kilobytes.
         
     | 
| 
      
 165 
     | 
    
         
            +
               def to_kb
         
     | 
| 
      
 166 
     | 
    
         
            +
                  self / 1024
         
     | 
| 
      
 167 
     | 
    
         
            +
               end
         
     | 
| 
      
 168 
     | 
    
         
            +
               
         
     | 
| 
      
 169 
     | 
    
         
            +
               # call-seq:
         
     | 
| 
      
 170 
     | 
    
         
            +
               #  <tt>fix</tt>.to_mb
         
     | 
| 
      
 171 
     | 
    
         
            +
               #
         
     | 
| 
      
 172 
     | 
    
         
            +
               # Returns +fix+ in terms of megabytes.
         
     | 
| 
      
 173 
     | 
    
         
            +
               def to_mb
         
     | 
| 
      
 174 
     | 
    
         
            +
                  self / 1048576
         
     | 
| 
      
 175 
     | 
    
         
            +
               end
         
     | 
| 
      
 176 
     | 
    
         
            +
               
         
     | 
| 
      
 177 
     | 
    
         
            +
               # call-seq:
         
     | 
| 
      
 178 
     | 
    
         
            +
               #  <tt>fix</tt>.to_gb
         
     | 
| 
      
 179 
     | 
    
         
            +
               #
         
     | 
| 
      
 180 
     | 
    
         
            +
               # Returns +fix+ in terms of gigabytes.
         
     | 
| 
      
 181 
     | 
    
         
            +
               def to_gb
         
     | 
| 
      
 182 
     | 
    
         
            +
                  self / 1073741824
         
     | 
| 
      
 183 
     | 
    
         
            +
               end
         
     | 
| 
      
 184 
     | 
    
         
            +
            end
         
     | 
| 
         
            File without changes
         
     | 
| 
         @@ -0,0 +1,34 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            spec = Gem::Specification.new do |gem|
         
     | 
| 
      
 4 
     | 
    
         
            +
               gem.name         = 'sys-filesystem'
         
     | 
| 
      
 5 
     | 
    
         
            +
               gem.version      = '0.1.0'
         
     | 
| 
      
 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.description  = 'A Ruby interface for getting file system information.'
         
     | 
| 
      
 12 
     | 
    
         
            +
               gem.test_file    = 'test/tc_filesystem.rb'
         
     | 
| 
      
 13 
     | 
    
         
            +
               gem.has_rdoc     = true
         
     | 
| 
      
 14 
     | 
    
         
            +
               gem.extra_rdoc_files  = ['CHANGES', 'README', 'MANIFEST']
         
     | 
| 
      
 15 
     | 
    
         
            +
               gem.rubyforge_project = 'sysutils'
         
     | 
| 
      
 16 
     | 
    
         
            +
               files = Dir["doc/*"] + Dir["test/*"] + Dir["[A-Z]*"]
         
     | 
| 
      
 17 
     | 
    
         
            +
               files.delete_if{ |item| item.include?('CVS') }
         
     | 
| 
      
 18 
     | 
    
         
            +
               gem.files = files
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            if $PROGRAM_NAME == __FILE__
         
     | 
| 
      
 22 
     | 
    
         
            +
               if RUBY_PLATFORM.match('mswin')
         
     | 
| 
      
 23 
     | 
    
         
            +
                  spec.required_ruby_version = '>= 1.8.2'
         
     | 
| 
      
 24 
     | 
    
         
            +
                  spec.files += ['lib/sys/filesystem.rb']
         
     | 
| 
      
 25 
     | 
    
         
            +
                  spec.platform = Gem::Platform::WIN32
         
     | 
| 
      
 26 
     | 
    
         
            +
               else
         
     | 
| 
      
 27 
     | 
    
         
            +
                  spec.required_ruby_version = '>= 1.8.0'
         
     | 
| 
      
 28 
     | 
    
         
            +
                  spec.extensions = ['extconf.rb']
         
     | 
| 
      
 29 
     | 
    
         
            +
                  spec.files += ['ext/filesystem.c']
         
     | 
| 
      
 30 
     | 
    
         
            +
               end
         
     | 
| 
      
 31 
     | 
    
         
            +
            	
         
     | 
| 
      
 32 
     | 
    
         
            +
               Gem.manage_gems
         
     | 
| 
      
 33 
     | 
    
         
            +
               Gem::Builder.new(spec).build
         
     | 
| 
      
 34 
     | 
    
         
            +
            end
         
     | 
    
        data/test/tc_unix.rb
    ADDED
    
    | 
         @@ -0,0 +1,129 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ####################################################################
         
     | 
| 
      
 2 
     | 
    
         
            +
            # tc_unix.rb
         
     | 
| 
      
 3 
     | 
    
         
            +
            #
         
     | 
| 
      
 4 
     | 
    
         
            +
            # Test case for the Sys::Filesystem.stat method and related stuff.
         
     | 
| 
      
 5 
     | 
    
         
            +
            ####################################################################
         
     | 
| 
      
 6 
     | 
    
         
            +
            base = File.basename(Dir.pwd)
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            if base == 'test' || base =~ /filesystem/i
         
     | 
| 
      
 9 
     | 
    
         
            +
               require 'fileutils'
         
     | 
| 
      
 10 
     | 
    
         
            +
               require 'rbconfig'
         
     | 
| 
      
 11 
     | 
    
         
            +
               Dir.chdir('..') if base == 'test'
         
     | 
| 
      
 12 
     | 
    
         
            +
               Dir.mkdir('sys') rescue nil
         
     | 
| 
      
 13 
     | 
    
         
            +
               file = 'filesystem.' + Config::CONFIG['DLEXT']
         
     | 
| 
      
 14 
     | 
    
         
            +
               FileUtils.cp(file, 'sys')
         
     | 
| 
      
 15 
     | 
    
         
            +
               $LOAD_PATH.unshift(Dir.pwd)
         
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            require 'test/unit'
         
     | 
| 
      
 19 
     | 
    
         
            +
            require 'sys/filesystem'
         
     | 
| 
      
 20 
     | 
    
         
            +
            include Sys
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            class TC_Filesystem_Unix < Test::Unit::TestCase
         
     | 
| 
      
 23 
     | 
    
         
            +
               def setup
         
     | 
| 
      
 24 
     | 
    
         
            +
                  @dir = "/"
         
     | 
| 
      
 25 
     | 
    
         
            +
                  @stat = Filesystem.stat(@dir)
         
     | 
| 
      
 26 
     | 
    
         
            +
                  @size = 58720256
         
     | 
| 
      
 27 
     | 
    
         
            +
               end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
               def test_version
         
     | 
| 
      
 30 
     | 
    
         
            +
                  assert_equal('0.1.0', Filesystem::VERSION)
         
     | 
| 
      
 31 
     | 
    
         
            +
               end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
               def test_stat_path
         
     | 
| 
      
 34 
     | 
    
         
            +
                  assert_respond_to(@stat, :path)
         
     | 
| 
      
 35 
     | 
    
         
            +
                  assert_equal("/", @stat.path)
         
     | 
| 
      
 36 
     | 
    
         
            +
               end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
               def test_stat_block_size
         
     | 
| 
      
 39 
     | 
    
         
            +
                  assert_respond_to(@stat, :block_size)
         
     | 
| 
      
 40 
     | 
    
         
            +
                  assert_kind_of(Fixnum, @stat.block_size)
         
     | 
| 
      
 41 
     | 
    
         
            +
               end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
               def test_stat_fragment_size
         
     | 
| 
      
 44 
     | 
    
         
            +
                  assert_respond_to(@stat, :fragment_size)
         
     | 
| 
      
 45 
     | 
    
         
            +
                  assert_kind_of(Fixnum, @stat.fragment_size)
         
     | 
| 
      
 46 
     | 
    
         
            +
               end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
               def test_stat_blocks
         
     | 
| 
      
 49 
     | 
    
         
            +
                  assert_respond_to(@stat, :blocks)
         
     | 
| 
      
 50 
     | 
    
         
            +
                  assert_kind_of(Fixnum, @stat.blocks)
         
     | 
| 
      
 51 
     | 
    
         
            +
               end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
               def test_stat_blocks_free
         
     | 
| 
      
 54 
     | 
    
         
            +
                  assert_respond_to(@stat, :blocks_free)
         
     | 
| 
      
 55 
     | 
    
         
            +
                  assert_kind_of(Fixnum, @stat.blocks_free)
         
     | 
| 
      
 56 
     | 
    
         
            +
               end
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
               def test_stat_blocks_available
         
     | 
| 
      
 59 
     | 
    
         
            +
                  assert_respond_to(@stat, :blocks_available)
         
     | 
| 
      
 60 
     | 
    
         
            +
                  assert_kind_of(Fixnum, @stat.blocks_available)
         
     | 
| 
      
 61 
     | 
    
         
            +
               end
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
               def test_stat_files
         
     | 
| 
      
 64 
     | 
    
         
            +
                  assert_respond_to(@stat, :files)
         
     | 
| 
      
 65 
     | 
    
         
            +
                  assert_respond_to(@stat, :inodes)            # Alias
         
     | 
| 
      
 66 
     | 
    
         
            +
                  assert_kind_of(Fixnum, @stat.files)
         
     | 
| 
      
 67 
     | 
    
         
            +
               end
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
               def test_stat_files_free
         
     | 
| 
      
 70 
     | 
    
         
            +
                  assert_respond_to(@stat, :files_free)
         
     | 
| 
      
 71 
     | 
    
         
            +
                  assert_respond_to(@stat, :inodes_free)       # Alias
         
     | 
| 
      
 72 
     | 
    
         
            +
                  assert_kind_of(Fixnum, @stat.files_free)
         
     | 
| 
      
 73 
     | 
    
         
            +
               end
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
               def test_stat_files_available
         
     | 
| 
      
 76 
     | 
    
         
            +
                  assert_respond_to(@stat, :files_available)
         
     | 
| 
      
 77 
     | 
    
         
            +
                  assert_respond_to(@stat, :inodes_available)  # Alias
         
     | 
| 
      
 78 
     | 
    
         
            +
                  assert_kind_of(Fixnum, @stat.files_available)
         
     | 
| 
      
 79 
     | 
    
         
            +
               end
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
               def test_stat_filesystem_id
         
     | 
| 
      
 82 
     | 
    
         
            +
                  assert_respond_to(@stat, :filesystem_id)
         
     | 
| 
      
 83 
     | 
    
         
            +
                  assert_kind_of(Fixnum, @stat.filesystem_id)
         
     | 
| 
      
 84 
     | 
    
         
            +
               end
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
               def test_stat_flags
         
     | 
| 
      
 87 
     | 
    
         
            +
                  assert_respond_to(@stat, :flags)
         
     | 
| 
      
 88 
     | 
    
         
            +
                  assert_kind_of(Fixnum, @stat.flags)
         
     | 
| 
      
 89 
     | 
    
         
            +
               end
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
               def test_stat_name_max
         
     | 
| 
      
 92 
     | 
    
         
            +
                  assert_respond_to(@stat, :name_max)
         
     | 
| 
      
 93 
     | 
    
         
            +
                  assert_kind_of(Fixnum, @stat.name_max)
         
     | 
| 
      
 94 
     | 
    
         
            +
               end
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
               unless RUBY_PLATFORM.match('linux')
         
     | 
| 
      
 97 
     | 
    
         
            +
                  def test_stat_base_type
         
     | 
| 
      
 98 
     | 
    
         
            +
                     assert_respond_to(@stat, :base_type)
         
     | 
| 
      
 99 
     | 
    
         
            +
                     assert_kind_of(String, @stat.base_type)
         
     | 
| 
      
 100 
     | 
    
         
            +
                  end
         
     | 
| 
      
 101 
     | 
    
         
            +
               end
         
     | 
| 
      
 102 
     | 
    
         
            +
             
     | 
| 
      
 103 
     | 
    
         
            +
               def test_stat_constants
         
     | 
| 
      
 104 
     | 
    
         
            +
                  assert_not_nil(Filesystem::Stat::RDONLY)
         
     | 
| 
      
 105 
     | 
    
         
            +
                  assert_not_nil(Filesystem::Stat::NOSUID)
         
     | 
| 
      
 106 
     | 
    
         
            +
                  unless RUBY_PLATFORM.match('linux')
         
     | 
| 
      
 107 
     | 
    
         
            +
                     assert_not_nil(Filesystem::Stat::NOTRUNC)
         
     | 
| 
      
 108 
     | 
    
         
            +
                  end
         
     | 
| 
      
 109 
     | 
    
         
            +
               end
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
               def test_stat_expected_errors
         
     | 
| 
      
 112 
     | 
    
         
            +
                  assert_raises(ArgumentError){ Filesystem.stat }
         
     | 
| 
      
 113 
     | 
    
         
            +
               end
         
     | 
| 
      
 114 
     | 
    
         
            +
             
     | 
| 
      
 115 
     | 
    
         
            +
               def test_fixnum_methods
         
     | 
| 
      
 116 
     | 
    
         
            +
                  assert_respond_to(@size, :to_kb)
         
     | 
| 
      
 117 
     | 
    
         
            +
                  assert_respond_to(@size, :to_mb)
         
     | 
| 
      
 118 
     | 
    
         
            +
                  assert_respond_to(@size, :to_gb)
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
                  assert_equal(57344, @size.to_kb)
         
     | 
| 
      
 121 
     | 
    
         
            +
                  assert_equal(56, @size.to_mb)
         
     | 
| 
      
 122 
     | 
    
         
            +
                  assert_equal(0, @size.to_gb)
         
     | 
| 
      
 123 
     | 
    
         
            +
               end
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
      
 125 
     | 
    
         
            +
               def teardown
         
     | 
| 
      
 126 
     | 
    
         
            +
                  @dir  = nil
         
     | 
| 
      
 127 
     | 
    
         
            +
                  @stat = nil
         
     | 
| 
      
 128 
     | 
    
         
            +
               end
         
     | 
| 
      
 129 
     | 
    
         
            +
            end
         
     | 
    
        data/test/tc_windows.rb
    ADDED
    
    | 
         @@ -0,0 +1,129 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ####################################################################
         
     | 
| 
      
 2 
     | 
    
         
            +
            # tc_unix.rb
         
     | 
| 
      
 3 
     | 
    
         
            +
            #
         
     | 
| 
      
 4 
     | 
    
         
            +
            # Test case for the Sys::Filesystem.stat method and related stuff.
         
     | 
| 
      
 5 
     | 
    
         
            +
            ####################################################################
         
     | 
| 
      
 6 
     | 
    
         
            +
            Dir.chdir('..') if File.basename(Dir.pwd) == 'test'
         
     | 
| 
      
 7 
     | 
    
         
            +
            $LOAD_PATH.unshift(Dir.pwd + '/lib')
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            require 'test/unit'
         
     | 
| 
      
 10 
     | 
    
         
            +
            require 'sys/filesystem'
         
     | 
| 
      
 11 
     | 
    
         
            +
            include Sys
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            class TC_Filesystem_Unix < Test::Unit::TestCase
         
     | 
| 
      
 14 
     | 
    
         
            +
               def setup
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @dir = "/"
         
     | 
| 
      
 16 
     | 
    
         
            +
                  @stat = Filesystem.stat(@dir)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @size = 58720256
         
     | 
| 
      
 18 
     | 
    
         
            +
               end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
               def test_version
         
     | 
| 
      
 21 
     | 
    
         
            +
                  assert_equal('0.1.0', Filesystem::VERSION)
         
     | 
| 
      
 22 
     | 
    
         
            +
               end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
               def test_stat_path
         
     | 
| 
      
 25 
     | 
    
         
            +
                  assert_respond_to(@stat, :path)
         
     | 
| 
      
 26 
     | 
    
         
            +
                  assert_equal("/", @stat.path)
         
     | 
| 
      
 27 
     | 
    
         
            +
               end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
               def test_stat_block_size
         
     | 
| 
      
 30 
     | 
    
         
            +
                  assert_respond_to(@stat, :block_size)
         
     | 
| 
      
 31 
     | 
    
         
            +
                  assert_kind_of(Fixnum, @stat.block_size)
         
     | 
| 
      
 32 
     | 
    
         
            +
               end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
               def test_stat_fragment_size
         
     | 
| 
      
 35 
     | 
    
         
            +
                  assert_respond_to(@stat, :fragment_size)
         
     | 
| 
      
 36 
     | 
    
         
            +
                  assert_nil(@stat.fragment_size)
         
     | 
| 
      
 37 
     | 
    
         
            +
               end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
               def test_stat_blocks
         
     | 
| 
      
 40 
     | 
    
         
            +
                  assert_respond_to(@stat, :blocks)
         
     | 
| 
      
 41 
     | 
    
         
            +
                  assert_kind_of(Fixnum, @stat.blocks)
         
     | 
| 
      
 42 
     | 
    
         
            +
               end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
               def test_stat_blocks_free
         
     | 
| 
      
 45 
     | 
    
         
            +
                  assert_respond_to(@stat, :blocks_free)
         
     | 
| 
      
 46 
     | 
    
         
            +
                  assert_kind_of(Fixnum, @stat.blocks_free)
         
     | 
| 
      
 47 
     | 
    
         
            +
               end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
               def test_stat_blocks_available
         
     | 
| 
      
 50 
     | 
    
         
            +
                  assert_respond_to(@stat, :blocks_available)
         
     | 
| 
      
 51 
     | 
    
         
            +
                  assert_kind_of(Fixnum, @stat.blocks_available)
         
     | 
| 
      
 52 
     | 
    
         
            +
               end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
               def test_stat_files
         
     | 
| 
      
 55 
     | 
    
         
            +
                  assert_respond_to(@stat, :files)
         
     | 
| 
      
 56 
     | 
    
         
            +
                  assert_respond_to(@stat, :inodes)            # Alias
         
     | 
| 
      
 57 
     | 
    
         
            +
                  assert_nil(@stat.files)
         
     | 
| 
      
 58 
     | 
    
         
            +
               end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
               def test_stat_files_free
         
     | 
| 
      
 61 
     | 
    
         
            +
                  assert_respond_to(@stat, :files_free)
         
     | 
| 
      
 62 
     | 
    
         
            +
                  assert_respond_to(@stat, :inodes_free)       # Alias
         
     | 
| 
      
 63 
     | 
    
         
            +
                  assert_nil(@stat.files_free)
         
     | 
| 
      
 64 
     | 
    
         
            +
               end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
               def test_stat_files_available
         
     | 
| 
      
 67 
     | 
    
         
            +
                  assert_respond_to(@stat, :files_available)
         
     | 
| 
      
 68 
     | 
    
         
            +
                  assert_respond_to(@stat, :inodes_available)  # Alias
         
     | 
| 
      
 69 
     | 
    
         
            +
                  assert_nil(@stat.files_available)
         
     | 
| 
      
 70 
     | 
    
         
            +
               end
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
               def test_stat_filesystem_id
         
     | 
| 
      
 73 
     | 
    
         
            +
                  assert_respond_to(@stat, :filesystem_id)
         
     | 
| 
      
 74 
     | 
    
         
            +
                  assert_kind_of(Integer, @stat.filesystem_id)
         
     | 
| 
      
 75 
     | 
    
         
            +
               end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
               def test_stat_flags
         
     | 
| 
      
 78 
     | 
    
         
            +
                  assert_respond_to(@stat, :flags)
         
     | 
| 
      
 79 
     | 
    
         
            +
                  assert_kind_of(Fixnum, @stat.flags)
         
     | 
| 
      
 80 
     | 
    
         
            +
               end
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
               def test_stat_name_max
         
     | 
| 
      
 83 
     | 
    
         
            +
                  assert_respond_to(@stat, :name_max)
         
     | 
| 
      
 84 
     | 
    
         
            +
                  assert_kind_of(Fixnum, @stat.name_max)
         
     | 
| 
      
 85 
     | 
    
         
            +
               end
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
               unless RUBY_PLATFORM.match('linux')
         
     | 
| 
      
 88 
     | 
    
         
            +
                  def test_stat_base_type
         
     | 
| 
      
 89 
     | 
    
         
            +
                     assert_respond_to(@stat, :base_type)
         
     | 
| 
      
 90 
     | 
    
         
            +
                     assert_kind_of(String, @stat.base_type)
         
     | 
| 
      
 91 
     | 
    
         
            +
                  end
         
     | 
| 
      
 92 
     | 
    
         
            +
               end
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
               def test_stat_constants
         
     | 
| 
      
 95 
     | 
    
         
            +
                  assert_not_nil(Filesystem::Stat::CASE_SENSITIVE_SEARCH)
         
     | 
| 
      
 96 
     | 
    
         
            +
                  assert_not_nil(Filesystem::Stat::CASE_PRESERVED_NAMES)
         
     | 
| 
      
 97 
     | 
    
         
            +
                  assert_not_nil(Filesystem::Stat::UNICODE_ON_DISK)
         
     | 
| 
      
 98 
     | 
    
         
            +
                  assert_not_nil(Filesystem::Stat::PERSISTENT_ACLS)
         
     | 
| 
      
 99 
     | 
    
         
            +
                  assert_not_nil(Filesystem::Stat::FILE_COMPRESSION)
         
     | 
| 
      
 100 
     | 
    
         
            +
                  assert_not_nil(Filesystem::Stat::VOLUME_QUOTAS)
         
     | 
| 
      
 101 
     | 
    
         
            +
                  assert_not_nil(Filesystem::Stat::SUPPORTS_SPARSE_FILES)
         
     | 
| 
      
 102 
     | 
    
         
            +
                  assert_not_nil(Filesystem::Stat::SUPPORTS_REPARSE_POINTS)
         
     | 
| 
      
 103 
     | 
    
         
            +
                  assert_not_nil(Filesystem::Stat::SUPPORTS_REMOTE_STORAGE)
         
     | 
| 
      
 104 
     | 
    
         
            +
                  assert_not_nil(Filesystem::Stat::VOLUME_IS_COMPRESSED)
         
     | 
| 
      
 105 
     | 
    
         
            +
                  assert_not_nil(Filesystem::Stat::SUPPORTS_OBJECT_IDS)
         
     | 
| 
      
 106 
     | 
    
         
            +
                  assert_not_nil(Filesystem::Stat::SUPPORTS_ENCRYPTION)
         
     | 
| 
      
 107 
     | 
    
         
            +
                  assert_not_nil(Filesystem::Stat::NAMED_STREAMS)
         
     | 
| 
      
 108 
     | 
    
         
            +
                  assert_not_nil(Filesystem::Stat::READ_ONLY_VOLUME)
         
     | 
| 
      
 109 
     | 
    
         
            +
               end
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
               def test_stat_expected_errors
         
     | 
| 
      
 112 
     | 
    
         
            +
                  assert_raises(ArgumentError){ Filesystem.stat }
         
     | 
| 
      
 113 
     | 
    
         
            +
               end
         
     | 
| 
      
 114 
     | 
    
         
            +
             
     | 
| 
      
 115 
     | 
    
         
            +
               def test_fixnum_methods
         
     | 
| 
      
 116 
     | 
    
         
            +
                  assert_respond_to(@size, :to_kb)
         
     | 
| 
      
 117 
     | 
    
         
            +
                  assert_respond_to(@size, :to_mb)
         
     | 
| 
      
 118 
     | 
    
         
            +
                  assert_respond_to(@size, :to_gb)
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
                  assert_equal(57344, @size.to_kb)
         
     | 
| 
      
 121 
     | 
    
         
            +
                  assert_equal(56, @size.to_mb)
         
     | 
| 
      
 122 
     | 
    
         
            +
                  assert_equal(0, @size.to_gb)
         
     | 
| 
      
 123 
     | 
    
         
            +
               end
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
      
 125 
     | 
    
         
            +
               def teardown
         
     | 
| 
      
 126 
     | 
    
         
            +
                  @dir  = nil
         
     | 
| 
      
 127 
     | 
    
         
            +
                  @stat = nil
         
     | 
| 
      
 128 
     | 
    
         
            +
               end
         
     | 
| 
      
 129 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,61 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification 
         
     | 
| 
      
 2 
     | 
    
         
            +
            rubygems_version: 0.9.0
         
     | 
| 
      
 3 
     | 
    
         
            +
            specification_version: 1
         
     | 
| 
      
 4 
     | 
    
         
            +
            name: sys-filesystem
         
     | 
| 
      
 5 
     | 
    
         
            +
            version: !ruby/object:Gem::Version 
         
     | 
| 
      
 6 
     | 
    
         
            +
              version: 0.1.0
         
     | 
| 
      
 7 
     | 
    
         
            +
            date: 2006-11-17 00:00:00 -07:00
         
     | 
| 
      
 8 
     | 
    
         
            +
            summary: A Ruby interface for getting file system information.
         
     | 
| 
      
 9 
     | 
    
         
            +
            require_paths: 
         
     | 
| 
      
 10 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 11 
     | 
    
         
            +
            email: djberg96@gmail.com
         
     | 
| 
      
 12 
     | 
    
         
            +
            homepage: http://www.rubyforge.org/projects/sysutils
         
     | 
| 
      
 13 
     | 
    
         
            +
            rubyforge_project: sysutils
         
     | 
| 
      
 14 
     | 
    
         
            +
            description: A Ruby interface for getting file system information.
         
     | 
| 
      
 15 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 16 
     | 
    
         
            +
            default_executable: 
         
     | 
| 
      
 17 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 18 
     | 
    
         
            +
            has_rdoc: true
         
     | 
| 
      
 19 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Version::Requirement 
         
     | 
| 
      
 20 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 21 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 22 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 23 
     | 
    
         
            +
                  version: 1.8.2
         
     | 
| 
      
 24 
     | 
    
         
            +
              version: 
         
     | 
| 
      
 25 
     | 
    
         
            +
            platform: mswin32
         
     | 
| 
      
 26 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 27 
     | 
    
         
            +
            cert_chain: 
         
     | 
| 
      
 28 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 29 
     | 
    
         
            +
            authors: 
         
     | 
| 
      
 30 
     | 
    
         
            +
            - Daniel J. Berger
         
     | 
| 
      
 31 
     | 
    
         
            +
            files: 
         
     | 
| 
      
 32 
     | 
    
         
            +
            - test/tc_filesystem.rb
         
     | 
| 
      
 33 
     | 
    
         
            +
            - test/tc_unix.rb
         
     | 
| 
      
 34 
     | 
    
         
            +
            - test/tc_windows.rb
         
     | 
| 
      
 35 
     | 
    
         
            +
            - CHANGES
         
     | 
| 
      
 36 
     | 
    
         
            +
            - examples
         
     | 
| 
      
 37 
     | 
    
         
            +
            - ext
         
     | 
| 
      
 38 
     | 
    
         
            +
            - extconf.rb
         
     | 
| 
      
 39 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 40 
     | 
    
         
            +
            - MANIFEST
         
     | 
| 
      
 41 
     | 
    
         
            +
            - README
         
     | 
| 
      
 42 
     | 
    
         
            +
            - sys-filesystem-0.1.0-mswin32.gem
         
     | 
| 
      
 43 
     | 
    
         
            +
            - sys-filesystem.gemspec
         
     | 
| 
      
 44 
     | 
    
         
            +
            - test
         
     | 
| 
      
 45 
     | 
    
         
            +
            - lib/sys/filesystem.rb
         
     | 
| 
      
 46 
     | 
    
         
            +
            test_files: 
         
     | 
| 
      
 47 
     | 
    
         
            +
            - test/tc_filesystem.rb
         
     | 
| 
      
 48 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            extra_rdoc_files: 
         
     | 
| 
      
 51 
     | 
    
         
            +
            - CHANGES
         
     | 
| 
      
 52 
     | 
    
         
            +
            - README
         
     | 
| 
      
 53 
     | 
    
         
            +
            - MANIFEST
         
     | 
| 
      
 54 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
            dependencies: []
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     |