sys-filesystem 0.3.4-x86-mingw32 → 1.0.0-x86-mingw32
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 +49 -45
 - data/MANIFEST +12 -13
 - data/README +83 -83
 - data/Rakefile +49 -83
 - data/examples/example_stat.rb +24 -24
 - data/lib/sys/filesystem.rb +5 -408
 - data/lib/unix/sys/filesystem.rb +561 -0
 - data/lib/windows/sys/filesystem.rb +408 -0
 - data/sys-filesystem.gemspec +24 -25
 - data/test/test_sys_filesystem.rb +7 -9
 - data/test/test_sys_filesystem_unix.rb +261 -253
 - data/test/test_sys_filesystem_windows.rb +198 -198
 - metadata +41 -66
 
    
        data/CHANGES
    CHANGED
    
    | 
         @@ -1,45 +1,49 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            == 0. 
     | 
| 
       2 
     | 
    
         
            -
            *  
     | 
| 
       3 
     | 
    
         
            -
               
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
            *  
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
            == 0.3. 
     | 
| 
       12 
     | 
    
         
            -
            *  
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
            *  
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            *  
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
            *  
     | 
| 
       27 
     | 
    
         
            -
               
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
            * Added the Filesystem. 
     | 
| 
       33 
     | 
    
         
            -
               
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
            == 0. 
     | 
| 
       36 
     | 
    
         
            -
            *  
     | 
| 
       37 
     | 
    
         
            -
               
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
            *  
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
            *  
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
            *  
     | 
| 
      
 1 
     | 
    
         
            +
            == 1.0.0 - ???
         
     | 
| 
      
 2 
     | 
    
         
            +
            * Converted everything from C to FFI for the Unix flavors. The Windows
         
     | 
| 
      
 3 
     | 
    
         
            +
              source code remains untouched.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            == 0.3.4 - 19-Nov-2010
         
     | 
| 
      
 6 
     | 
    
         
            +
            * Fixed a bug where negative block counts were happening on very large
         
     | 
| 
      
 7 
     | 
    
         
            +
              hard drives. Thanks go to Jonas Pfenniger for the spot.
         
     | 
| 
      
 8 
     | 
    
         
            +
            * Refactored the clean task in the Rakefile.
         
     | 
| 
      
 9 
     | 
    
         
            +
            * Some cosmetic source code changes.
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            == 0.3.3 - 21-May-2010
         
     | 
| 
      
 12 
     | 
    
         
            +
            * Added a workaround for the Sys::Filesystem#block_size member to deal with
         
     | 
| 
      
 13 
     | 
    
         
            +
              a bug in OS X. Thanks go to Josh Pasqualetto for the spot.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            == 0.3.2 - 29-Dec-2009
         
     | 
| 
      
 16 
     | 
    
         
            +
            * Source has been moved to github.
         
     | 
| 
      
 17 
     | 
    
         
            +
            * Added the 'gem' task and removed build logic from the gemspec.
         
     | 
| 
      
 18 
     | 
    
         
            +
            * Updated the install task.
         
     | 
| 
      
 19 
     | 
    
         
            +
            * Minor correction to the manifest.
         
     | 
| 
      
 20 
     | 
    
         
            +
            * Removed some junk build files that were inadvertently included in
         
     | 
| 
      
 21 
     | 
    
         
            +
              the last gem.
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            == 0.3.1 - 5-Aug-2009
         
     | 
| 
      
 24 
     | 
    
         
            +
            * Now compatible with Ruby 1.9.x.
         
     | 
| 
      
 25 
     | 
    
         
            +
            * Changed license to Artistic 2.0
         
     | 
| 
      
 26 
     | 
    
         
            +
            * Updated the gemspec, including the explicit addition of a license and
         
     | 
| 
      
 27 
     | 
    
         
            +
              test-unit as a development dependency, as well as an updated description. 
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            == 0.3.0 - 26-Feb-2009
         
     | 
| 
      
 30 
     | 
    
         
            +
            * Added support for OS X and FreeBSD thanks to an awesome patch by Nobuyoshi
         
     | 
| 
      
 31 
     | 
    
         
            +
              Miyokawa.
         
     | 
| 
      
 32 
     | 
    
         
            +
            * Added the Filesystem.mount_point method that takes a file and returns
         
     | 
| 
      
 33 
     | 
    
         
            +
              the mount point it's sitting on.
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            == 0.2.0 - 30-Dec-2008
         
     | 
| 
      
 36 
     | 
    
         
            +
            * Added the Filesystem.mounts method for iterating over mount or volume
         
     | 
| 
      
 37 
     | 
    
         
            +
              information.
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            == 0.1.1 - 28-Mar-2007
         
     | 
| 
      
 40 
     | 
    
         
            +
            * Bug fix for BSD flavors.  Thanks go to Jeremy Kemper and Ole Christian
         
     | 
| 
      
 41 
     | 
    
         
            +
              Rynning for the spot.
         
     | 
| 
      
 42 
     | 
    
         
            +
            * Bug fix for OS X (along the same lines as the BSD fix). Thanks go to
         
     | 
| 
      
 43 
     | 
    
         
            +
              Aurelian Dehay for the spot.
         
     | 
| 
      
 44 
     | 
    
         
            +
            * Some Rdoc improvements for the C extension.
         
     | 
| 
      
 45 
     | 
    
         
            +
            * Tweaks to the gemspec.
         
     | 
| 
      
 46 
     | 
    
         
            +
            * Added synopsis to the README.
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            == 0.1.0 - 17-Nov-2006
         
     | 
| 
      
 49 
     | 
    
         
            +
            * Initial release.  Alpha. Code is stable, but API is not.
         
     | 
    
        data/MANIFEST
    CHANGED
    
    | 
         @@ -1,13 +1,12 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            * MANIFEST
         
     | 
| 
       2 
     | 
    
         
            -
            * CHANGES
         
     | 
| 
       3 
     | 
    
         
            -
            * Rakefile
         
     | 
| 
       4 
     | 
    
         
            -
            * README
         
     | 
| 
       5 
     | 
    
         
            -
            * sys-fileystem.gemspec
         
     | 
| 
       6 
     | 
    
         
            -
            * examples/example_stat.rb
         
     | 
| 
       7 
     | 
    
         
            -
            *  
     | 
| 
       8 
     | 
    
         
            -
            *  
     | 
| 
       9 
     | 
    
         
            -
            *  
     | 
| 
       10 
     | 
    
         
            -
            *  
     | 
| 
       11 
     | 
    
         
            -
            * test/ 
     | 
| 
       12 
     | 
    
         
            -
            * test/ 
     | 
| 
       13 
     | 
    
         
            -
            * test/test_sys_filesystem_windows
         
     | 
| 
      
 1 
     | 
    
         
            +
            * MANIFEST
         
     | 
| 
      
 2 
     | 
    
         
            +
            * CHANGES
         
     | 
| 
      
 3 
     | 
    
         
            +
            * Rakefile
         
     | 
| 
      
 4 
     | 
    
         
            +
            * README
         
     | 
| 
      
 5 
     | 
    
         
            +
            * sys-fileystem.gemspec
         
     | 
| 
      
 6 
     | 
    
         
            +
            * examples/example_stat.rb
         
     | 
| 
      
 7 
     | 
    
         
            +
            * lib/sys/filesystem.rb
         
     | 
| 
      
 8 
     | 
    
         
            +
            * lib/unix/sys/filesystem.rb
         
     | 
| 
      
 9 
     | 
    
         
            +
            * lib/windows/sys/filesystem.rb
         
     | 
| 
      
 10 
     | 
    
         
            +
            * test/test_sys_filesystem.rb
         
     | 
| 
      
 11 
     | 
    
         
            +
            * test/test_sys_filesystem_unix
         
     | 
| 
      
 12 
     | 
    
         
            +
            * test/test_sys_filesystem_windows
         
     | 
    
        data/README
    CHANGED
    
    | 
         @@ -1,83 +1,83 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            = Description
         
     | 
| 
       2 
     | 
    
         
            -
              A Ruby interface for getting file system information.
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            = Installation
         
     | 
| 
       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 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            = Synopsis
         
     | 
| 
       13 
     | 
    
         
            -
              require 'sys/filesystem'
         
     | 
| 
       14 
     | 
    
         
            -
              include Sys
         
     | 
| 
       15 
     | 
    
         
            -
               
         
     | 
| 
       16 
     | 
    
         
            -
              # Display information about a particular filesystem.
         
     | 
| 
       17 
     | 
    
         
            -
              p Filesystem.stat('/')
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
              # Sample output
         
     | 
| 
       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 
     | 
    
         
            -
              >
         
     | 
| 
       36 
     | 
    
         
            -
               
         
     | 
| 
       37 
     | 
    
         
            -
              # Describe all mount points on the system
         
     | 
| 
       38 
     | 
    
         
            -
              Filesystem.mounts{ |mount| p mount }
         
     | 
| 
       39 
     | 
    
         
            -
               
         
     | 
| 
       40 
     | 
    
         
            -
              # Find the mount point of any particular file
         
     | 
| 
       41 
     | 
    
         
            -
              puts Filesystem.mount_point('/home/djberge/some_file.txt') => '/home'
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
            = Notes
         
     | 
| 
       44 
     | 
    
         
            -
            === MS Windows
         
     | 
| 
       45 
     | 
    
         
            -
              This is a pure Ruby implementation using the windows-pr library, which in
         
     | 
| 
       46 
     | 
    
         
            -
              turn wraps native Windows functions.
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
            === UNIX
         
     | 
| 
       49 
     | 
    
         
            -
              This is a C extension that wraps statvfs, etc.
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
            = Sample code
         
     | 
| 
       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.
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
            = Known Bugs
         
     | 
| 
       56 
     | 
    
         
            -
              None that I'm aware of.  Please report bugs on the project page at
         
     | 
| 
       57 
     | 
    
         
            -
              http://www.rubyforge.org/projects/sysutils.
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
            = Future Plans
         
     | 
| 
       60 
     | 
    
         
            -
              Suggestions welcome.
         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
            = Acknowledgements
         
     | 
| 
       63 
     | 
    
         
            -
              Mike Hall, for ideas and code that I borrowed from his 'filesystem'
         
     | 
| 
       64 
     | 
    
         
            -
              library.
         
     | 
| 
       65 
     | 
    
         
            -
               
         
     | 
| 
       66 
     | 
    
         
            -
              Park Heesob, for implementation and API ideas for the MS Windows version.
         
     | 
| 
       67 
     | 
    
         
            -
               
         
     | 
| 
       68 
     | 
    
         
            -
              Nobuyoshi Miyokawa, for adding FreeBSD and OS X support.
         
     | 
| 
       69 
     | 
    
         
            -
               
         
     | 
| 
       70 
     | 
    
         
            -
            = License
         
     | 
| 
       71 
     | 
    
         
            -
              Artistic 2.0
         
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
            = Copyright
         
     | 
| 
       74 
     | 
    
         
            -
              (C) 2003-2010 Daniel J. Berger
         
     | 
| 
       75 
     | 
    
         
            -
              All Rights Reserved
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
            = Warranty
         
     | 
| 
       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.
         
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
            = Author
         
     | 
| 
       83 
     | 
    
         
            -
              Daniel J. Berger
         
     | 
| 
      
 1 
     | 
    
         
            +
            = Description
         
     | 
| 
      
 2 
     | 
    
         
            +
              A Ruby interface for getting file system information.
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            = Installation
         
     | 
| 
      
 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 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            = Synopsis
         
     | 
| 
      
 13 
     | 
    
         
            +
              require 'sys/filesystem'
         
     | 
| 
      
 14 
     | 
    
         
            +
              include Sys
         
     | 
| 
      
 15 
     | 
    
         
            +
               
         
     | 
| 
      
 16 
     | 
    
         
            +
              # Display information about a particular filesystem.
         
     | 
| 
      
 17 
     | 
    
         
            +
              p Filesystem.stat('/')
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
              # Sample output
         
     | 
| 
      
 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 
     | 
    
         
            +
              >
         
     | 
| 
      
 36 
     | 
    
         
            +
               
         
     | 
| 
      
 37 
     | 
    
         
            +
              # Describe all mount points on the system
         
     | 
| 
      
 38 
     | 
    
         
            +
              Filesystem.mounts{ |mount| p mount }
         
     | 
| 
      
 39 
     | 
    
         
            +
               
         
     | 
| 
      
 40 
     | 
    
         
            +
              # Find the mount point of any particular file
         
     | 
| 
      
 41 
     | 
    
         
            +
              puts Filesystem.mount_point('/home/djberge/some_file.txt') => '/home'
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            = Notes
         
     | 
| 
      
 44 
     | 
    
         
            +
            === MS Windows
         
     | 
| 
      
 45 
     | 
    
         
            +
              This is a pure Ruby implementation using the windows-pr library, which in
         
     | 
| 
      
 46 
     | 
    
         
            +
              turn wraps native Windows functions.
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            === UNIX
         
     | 
| 
      
 49 
     | 
    
         
            +
              This is a C extension that wraps statvfs, etc.
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            = Sample code
         
     | 
| 
      
 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.
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
            = Known Bugs
         
     | 
| 
      
 56 
     | 
    
         
            +
              None that I'm aware of.  Please report bugs on the project page at
         
     | 
| 
      
 57 
     | 
    
         
            +
              http://www.rubyforge.org/projects/sysutils.
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            = Future Plans
         
     | 
| 
      
 60 
     | 
    
         
            +
              Suggestions welcome.
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
            = Acknowledgements
         
     | 
| 
      
 63 
     | 
    
         
            +
              Mike Hall, for ideas and code that I borrowed from his 'filesystem'
         
     | 
| 
      
 64 
     | 
    
         
            +
              library.
         
     | 
| 
      
 65 
     | 
    
         
            +
               
         
     | 
| 
      
 66 
     | 
    
         
            +
              Park Heesob, for implementation and API ideas for the MS Windows version.
         
     | 
| 
      
 67 
     | 
    
         
            +
               
         
     | 
| 
      
 68 
     | 
    
         
            +
              Nobuyoshi Miyokawa, for adding FreeBSD and OS X support.
         
     | 
| 
      
 69 
     | 
    
         
            +
               
         
     | 
| 
      
 70 
     | 
    
         
            +
            = License
         
     | 
| 
      
 71 
     | 
    
         
            +
              Artistic 2.0
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
            = Copyright
         
     | 
| 
      
 74 
     | 
    
         
            +
              (C) 2003-2010 Daniel J. Berger
         
     | 
| 
      
 75 
     | 
    
         
            +
              All Rights Reserved
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
            = Warranty
         
     | 
| 
      
 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.
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
            = Author
         
     | 
| 
      
 83 
     | 
    
         
            +
              Daniel J. Berger
         
     | 
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -1,83 +1,49 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'rake'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'rake/clean'
         
     | 
| 
       3 
     | 
    
         
            -
            require 'rake/testtask'
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
               
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
               
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
               
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
               
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
              FileUtils.cp('ext/sys/filesystem.' + CONFIG['DLEXT'], 'examples/sys')
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
              Dir.chdir('examples') do
         
     | 
| 
       54 
     | 
    
         
            -
                ruby 'example_stat.rb'
         
     | 
| 
       55 
     | 
    
         
            -
              end
         
     | 
| 
       56 
     | 
    
         
            -
            end
         
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       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'))
         
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       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
         
     | 
| 
       74 
     | 
    
         
            -
              end
         
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
              desc "Install the sys-filesystem gem"
         
     | 
| 
       77 
     | 
    
         
            -
              task :install => [:create] do
         
     | 
| 
       78 
     | 
    
         
            -
                file = Dir['*.gem'].first
         
     | 
| 
       79 
     | 
    
         
            -
                sh "gem install #{file}"
         
     | 
| 
       80 
     | 
    
         
            -
              end
         
     | 
| 
       81 
     | 
    
         
            -
            end
         
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
            task :default => :test
         
     | 
| 
      
 1 
     | 
    
         
            +
            require 'rake'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rake/clean'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'rake/testtask'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            CLEAN.include('**/*.gem', '**/*.rbc', '**/*.rbx')
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            desc "Run the test suite"
         
     | 
| 
      
 8 
     | 
    
         
            +
            Rake::TestTask.new("test") do |t|
         
     | 
| 
      
 9 
     | 
    
         
            +
              if File::ALT_SEPARATOR
         
     | 
| 
      
 10 
     | 
    
         
            +
                t.libs << 'lib/windows'
         
     | 
| 
      
 11 
     | 
    
         
            +
              else
         
     | 
| 
      
 12 
     | 
    
         
            +
                t.libs << 'lib/unix'
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              t.warning = true
         
     | 
| 
      
 16 
     | 
    
         
            +
              t.verbose = true
         
     | 
| 
      
 17 
     | 
    
         
            +
              t.test_files = FileList['test/test_sys_filesystem.rb']
         
     | 
| 
      
 18 
     | 
    
         
            +
            end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            desc "Run the example program"
         
     | 
| 
      
 21 
     | 
    
         
            +
            task :example do |t|
         
     | 
| 
      
 22 
     | 
    
         
            +
              sh "ruby -Ilib -Ilib/unix -Ilib/windows examples/example_stat.rb"
         
     | 
| 
      
 23 
     | 
    
         
            +
            end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            namespace :gem do
         
     | 
| 
      
 26 
     | 
    
         
            +
              desc "Build the sys-filesystem gem"
         
     | 
| 
      
 27 
     | 
    
         
            +
              task :create do |t|
         
     | 
| 
      
 28 
     | 
    
         
            +
                spec = eval(IO.read('sys-filesystem.gemspec'))
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                if File::ALT_SEPARATOR
         
     | 
| 
      
 31 
     | 
    
         
            +
                  spec.add_dependency('windows-pr', '>= 1.0.5')
         
     | 
| 
      
 32 
     | 
    
         
            +
                  spec.platform = Gem::Platform::CURRENT
         
     | 
| 
      
 33 
     | 
    
         
            +
                  spec.platform.cpu = 'universal'
         
     | 
| 
      
 34 
     | 
    
         
            +
                  spec.platform.version = nil
         
     | 
| 
      
 35 
     | 
    
         
            +
                else
         
     | 
| 
      
 36 
     | 
    
         
            +
                  spec.add_dependency('ffi', '>= 1.0.0')
         
     | 
| 
      
 37 
     | 
    
         
            +
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                Gem::Builder.new(spec).build
         
     | 
| 
      
 40 
     | 
    
         
            +
              end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
              desc "Install the sys-filesystem gem"
         
     | 
| 
      
 43 
     | 
    
         
            +
              task :install => [:create] do
         
     | 
| 
      
 44 
     | 
    
         
            +
                file = Dir['*.gem'].first
         
     | 
| 
      
 45 
     | 
    
         
            +
                sh "gem install #{file}"
         
     | 
| 
      
 46 
     | 
    
         
            +
              end
         
     | 
| 
      
 47 
     | 
    
         
            +
            end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
            task :default => :test
         
     | 
    
        data/examples/example_stat.rb
    CHANGED
    
    | 
         @@ -1,24 +1,24 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            ######################################################################
         
     | 
| 
       2 
     | 
    
         
            -
            # example_stat.rb
         
     | 
| 
       3 
     | 
    
         
            -
            #
         
     | 
| 
       4 
     | 
    
         
            -
            # Example program that demonstrates the FileSystem.stat method.
         
     | 
| 
       5 
     | 
    
         
            -
            # Use the 'rake example' task to run this program.
         
     | 
| 
       6 
     | 
    
         
            -
            ######################################################################
         
     | 
| 
       7 
     | 
    
         
            -
            require 'sys/filesystem'
         
     | 
| 
       8 
     | 
    
         
            -
            include Sys
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            p Filesystem::VERSION
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            stat = Filesystem.stat("/")
         
     | 
| 
       13 
     | 
    
         
            -
            puts "Path: " + stat.path
         
     | 
| 
       14 
     | 
    
         
            -
            puts "Block size: " + stat.block_size.to_s
         
     | 
| 
       15 
     | 
    
         
            -
            puts "Fragment size: " + stat.fragment_size.to_s
         
     | 
| 
       16 
     | 
    
         
            -
            puts "Blocks free: " + stat.blocks_free.to_s
         
     | 
| 
       17 
     | 
    
         
            -
            puts "Blocks available: " + stat.blocks_available.to_s
         
     | 
| 
       18 
     | 
    
         
            -
            puts "Files/Inodes: " + stat.files.to_s
         
     | 
| 
       19 
     | 
    
         
            -
            puts "Files/Inodes free: " + stat.files_free.to_s
         
     | 
| 
       20 
     | 
    
         
            -
            puts "Files/Inodes available: " + stat.files_available.to_s
         
     | 
| 
       21 
     | 
    
         
            -
            puts "File system id: " + stat.filesystem_id.to_s
         
     | 
| 
       22 
     | 
    
         
            -
            puts "Base type: " + stat.base_type if stat.base_type
         
     | 
| 
       23 
     | 
    
         
            -
            puts "Flags: " + stat.flags.to_s
         
     | 
| 
       24 
     | 
    
         
            -
            puts "Name max: " + stat.name_max.to_s
         
     | 
| 
      
 1 
     | 
    
         
            +
            ######################################################################
         
     | 
| 
      
 2 
     | 
    
         
            +
            # example_stat.rb
         
     | 
| 
      
 3 
     | 
    
         
            +
            #
         
     | 
| 
      
 4 
     | 
    
         
            +
            # Example program that demonstrates the FileSystem.stat method.
         
     | 
| 
      
 5 
     | 
    
         
            +
            # Use the 'rake example' task to run this program.
         
     | 
| 
      
 6 
     | 
    
         
            +
            ######################################################################
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'sys/filesystem'
         
     | 
| 
      
 8 
     | 
    
         
            +
            include Sys
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            p Filesystem::VERSION
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            stat = Filesystem.stat("/")
         
     | 
| 
      
 13 
     | 
    
         
            +
            puts "Path: " + stat.path
         
     | 
| 
      
 14 
     | 
    
         
            +
            puts "Block size: " + stat.block_size.to_s
         
     | 
| 
      
 15 
     | 
    
         
            +
            puts "Fragment size: " + stat.fragment_size.to_s
         
     | 
| 
      
 16 
     | 
    
         
            +
            puts "Blocks free: " + stat.blocks_free.to_s
         
     | 
| 
      
 17 
     | 
    
         
            +
            puts "Blocks available: " + stat.blocks_available.to_s
         
     | 
| 
      
 18 
     | 
    
         
            +
            puts "Files/Inodes: " + stat.files.to_s
         
     | 
| 
      
 19 
     | 
    
         
            +
            puts "Files/Inodes free: " + stat.files_free.to_s
         
     | 
| 
      
 20 
     | 
    
         
            +
            puts "Files/Inodes available: " + stat.files_available.to_s
         
     | 
| 
      
 21 
     | 
    
         
            +
            puts "File system id: " + stat.filesystem_id.to_s
         
     | 
| 
      
 22 
     | 
    
         
            +
            puts "Base type: " + stat.base_type if stat.base_type
         
     | 
| 
      
 23 
     | 
    
         
            +
            puts "Flags: " + stat.flags.to_s
         
     | 
| 
      
 24 
     | 
    
         
            +
            puts "Name max: " + stat.name_max.to_s
         
     |