Sha256: 0050852bd34fe497cf4f3d895685520d7d547c46e88ede430a26a2a765fcb151
Contents?: true
Size: 1.92 KB
Versions: 2
Compression:
Stored size: 1.92 KB
Contents
ffiruby-filemagic ================= Win32 Support? sorry. A new implementation of the ancient ruby-filemagic gem (http://grub.ath.cx/filemagic/). This version uses FFI to talk to the native library (JRuby friendly). (Blurb from the original gem site follows) What is FileMagic? FileMagic is a Ruby binding to the magic(4) library, which you may know better as the file(1) command. The file command identifies the type of a file using, among other tests, a test for whether the file begins with a certain magic number. Install: Make sure you have the magic(4) library installed. > sudo gem sources -a http://gems.github.com > sudo gem install glongman-ffiruby-filemagic After Install: > irb >> require 'ffi_file_magic' => true >> fm = FFIFileMagic.new(FFIFileMagic::MAGIC_MIME) => #<FFIFileMagic:0x11a4d9c @cookie=#<Native Pointer address=0x13606f0>> >> fm.file('rails.png') #supply a path to your own image => "image/png" >> Install Problems? If the gem complains that it can't find the magic library you can run the setup.rb file in the root of the gem > sudo ruby /path/to/ffiruby-filemagic/setup.rb (where is the gem? 'gem contents ffiruby-filemagic') Without any arguments setup.rb will look around the filesystem for a magic library and test to see if that library is compatible. If so a small modification will be made so the gem will work. You can run setup.rb more than once. you can also tell setup.rb exactly where to look for the magic libary > sudo ruby /path/to/ffiruby-filemagic/setup.rb --with-magic-lib=/opt/local/lib This gem has been tested with the magic library shipped with File 4.26 from ftp://ftp.astron.com/pub/file On OSX, and at the time of writing this, you can get file using macports (http://www.macports.org/) > sudo port install file On other Unix variants, download the source, build and install. then run setup.rb COPYRIGHT ========= Copyright (c) 2009 Overlay TV. See LICENSE for details.
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
glongman-ffiruby-filemagic-0.3.3 | README |
glongman-ffiruby-filemagic-0.3.4 | README |