Ruby FileMagic Library Bindings
C Ruby R
Latest commit 24cfb1c May 8, 2015 @ricardochimal Merge pull request #2 from marv/master
tests: Fix for recent versions of file/libmagic
Permalink
Failed to load latest commit information.
test
.gitignore
AUTHORS
CHANGELOG Update README and CHANGELOG Sep 4, 2010
README
Rakefile
TODO Update documentation for Rdoc Sep 4, 2010
extconf.rb
filemagic.c
filemagic.rd Make flags arg to #new optional, implement #flags and #flags= Sep 4, 2010
ruby-filemagic.gemspec Update gem version to 0.1.3 Sep 4, 2010

README

= Ruby FileMagic Library Binding

== Summary

ruby-filemagic provides a ruby binding to GNU libmagic.


== Prerequisites

GNU file package to provide libmagic (tested with 5.04).  On
Debian-like Linux systems this is provided by package libmagic-dev.
For Solaris systems sunfreeware.com provides package SMCfile.


== Build and install

To build either:

    rake build

or run:

    ruby extconf.rb
    make

To install (non-gem) either:

    rake install

or run:

    make install


== Gem

To create a gem, build as above then either:

    rake gem

or run:

    gem build ruby-filemagic.gemspec


== Tests

Note that tests may fail if you have a different version of libmagic
since the file content descriptive text may vary slightly. For example,
a plain file gives these differing results:

  libmagic v5.04: text/plain; charset=us-ascii
  libmagic v4.26: text/plain charset=us-ascii

To run the unit tests:

    rake test

or run:

    ruby test/regress.rb


== Examples

    require 'filemagic'
    magic = FileMagic.new
    puts magic.file('/tmp/foo')
    magic.close


== Copying

The filemagic extension library is copywrited free software by Travis
Whitton <whitton@atlantic.net>. You can redistribute it under the terms
specified in the COPYING file of the Ruby distribution.


== WARRANTY

THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.