glongman-otv-ffiruby-filemagic 0.1.0 → 0.2.0
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/LICENSE +20 -0
- data/README +43 -0
- data/Rakefile +45 -0
- data/VERSION.yml +1 -1
- metadata +5 -2
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Overlay TV
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
ffiruby-filemagic
|
2
|
+
=================
|
3
|
+
|
4
|
+
A new implementation of the ancient ruby-filemagic gem (http://grub.ath.cx/filemagic/).
|
5
|
+
|
6
|
+
This version uses FFI to talk to the native library (JRuby friendly).
|
7
|
+
|
8
|
+
(Blurb from the original gem site follows)
|
9
|
+
|
10
|
+
What is FileMagic?
|
11
|
+
|
12
|
+
FileMagic is a Ruby binding to the magic(4) library, which you may know better as the file(1) command.
|
13
|
+
The file command identifies the type of a file using, among other tests, a test for whether the file
|
14
|
+
begins with a certain magic number.
|
15
|
+
|
16
|
+
Install:
|
17
|
+
|
18
|
+
Make sure you have the magic(4) library installed. On OSX this can be done using MacPorts (http://www.macports.org/)
|
19
|
+
|
20
|
+
> sudo port install file
|
21
|
+
> sudo gem sources -a http://gems.github.com
|
22
|
+
> sudo gem install glongman-otv-ffiruby-filemagic
|
23
|
+
|
24
|
+
- Linux? should just work
|
25
|
+
- Cygwin? no idea, never use it
|
26
|
+
- Windows? see above
|
27
|
+
|
28
|
+
Usage:
|
29
|
+
|
30
|
+
> irb
|
31
|
+
>> require 'ffi_file_magic'
|
32
|
+
=> true
|
33
|
+
>> fm = FFIFileMagic.new(FFIFileMagic::MAGIC_MIME)
|
34
|
+
=> #<FFIFileMagic:0x11a4d9c @cookie=#<Native Pointer address=0x13606f0>>
|
35
|
+
>> fm.file('rails.png')
|
36
|
+
=> "image/png"
|
37
|
+
>>
|
38
|
+
|
39
|
+
|
40
|
+
COPYRIGHT
|
41
|
+
=========
|
42
|
+
|
43
|
+
Copyright (c) 2009 Overlay TV. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'jeweler'
|
7
|
+
Jeweler::Tasks.new do |s|
|
8
|
+
s.name = "ffiruby-filemagic"
|
9
|
+
s.summary = %Q{new implementation of the ancient ruby-filemagic gem. Uses FFI to talk to native library}
|
10
|
+
s.email = "glongman@overlay.tv"
|
11
|
+
s.homepage = "http://github.com/glongman-otv/ffiruby-filemagic"
|
12
|
+
s.description = %Q{new implementation of the ancient ruby-filemagic gem. Uses FFI to talk to native library}
|
13
|
+
s.authors = ["Geoff Longman"]
|
14
|
+
s.add_dependency 'ffi'
|
15
|
+
s.files = FileList["[A-Z]*", "{lib,test}/**/*"]
|
16
|
+
end
|
17
|
+
rescue LoadError
|
18
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
19
|
+
end
|
20
|
+
|
21
|
+
Rake::TestTask.new do |t|
|
22
|
+
t.libs << 'lib'
|
23
|
+
t.pattern = 'test/**/*_test.rb'
|
24
|
+
t.verbose = false
|
25
|
+
end
|
26
|
+
|
27
|
+
Rake::RDocTask.new do |rdoc|
|
28
|
+
rdoc.rdoc_dir = 'rdoc'
|
29
|
+
rdoc.title = 'ffiruby-filemagic'
|
30
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
31
|
+
rdoc.rdoc_files.include('README*')
|
32
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
33
|
+
end
|
34
|
+
|
35
|
+
begin
|
36
|
+
require 'rcov/rcovtask'
|
37
|
+
Rcov::RcovTask.new do |t|
|
38
|
+
t.libs << 'test'
|
39
|
+
t.test_files = FileList['test/**/*_test.rb']
|
40
|
+
t.verbose = true
|
41
|
+
end
|
42
|
+
rescue LoadError
|
43
|
+
end
|
44
|
+
|
45
|
+
task :default => :test
|
data/VERSION.yml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glongman-otv-ffiruby-filemagic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoff Longman
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-02-
|
12
|
+
date: 2009-02-03 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -30,6 +30,9 @@ extensions: []
|
|
30
30
|
extra_rdoc_files: []
|
31
31
|
|
32
32
|
files:
|
33
|
+
- LICENSE
|
34
|
+
- Rakefile
|
35
|
+
- README
|
33
36
|
- VERSION.yml
|
34
37
|
- lib/ffi_file_magic.rb
|
35
38
|
- test/ffiruby_filemagic_test.rb
|