ruby-filemagic 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,16 +1,34 @@
1
- --------------------------------------------------------------------------------
2
- 7/28/2003 version 0.1.0
1
+ = Revision history for ruby-filemagic
3
2
 
4
- * Initial release.
3
+ == 0.4.1
5
4
 
6
- --------------------------------------------------------------------------------
7
- 7/30/2003 version 0.1.1
5
+ * Added MAGIC_VERSION
6
+ * Fixed example script
8
7
 
9
- * Added manual close method
10
- * Added unit test suite
8
+ == 0.4.0 [2010-09-14]
9
+
10
+ * Brushed up C layer
11
+ * Moved most of the Ruby stuff to C
12
+ * No longer expose internal state (@closed, @flags)
13
+ * No longer expose internal C methods (fm_*)
14
+ * Updated for magic(4) version 5.04
15
+
16
+ == 0.3.0 [2010-09-10]
11
17
 
12
- --------------------------------------------------------------------------------
13
- 9/12/2008 version 0.2.0
18
+ * Ruby 1.9.2 compatibility (Martin Carpenter)
19
+ * Exposed flags as symbols (Martin Carpenter)
20
+
21
+ == 0.2.2 [2010-03-02]
22
+
23
+ * Allow '.' when abbreviating mime types (Eric Schwartz)
24
+ * Cleanup and project file fixes
25
+
26
+ == 0.2.1 [2008-09-18]
27
+
28
+ * Added mahoro source file and tests for reference and inspiration
29
+ * We have a Rubyforge project now! :-)
30
+
31
+ == 0.2.0 [2008-09-12]
14
32
 
15
33
  * Modified C API
16
34
  * Uniform C function prefix rb_magic_ (instead of magick_)
@@ -21,29 +39,11 @@
21
39
  * Added/updated project files
22
40
  * Now available as a Rubygem!
23
41
 
24
- --------------------------------------------------------------------------------
25
- 9/18/2008 version 0.2.1
26
-
27
- * Added mahoro source file and tests for reference and inspiration
28
- * We have a Rubyforge project now! :-)
29
-
30
- --------------------------------------------------------------------------------
31
- 3/2/2010 version 0.2.2
42
+ == 0.1.1 [2003-07-30]
32
43
 
33
- * Allow '.' when abbreviating mime types (Eric Schwartz)
34
- * Cleanup and project file fixes
35
-
36
- --------------------------------------------------------------------------------
37
- 9/10/2010 version 0.3.0
38
-
39
- * Ruby 1.9.2 compatibility (Martin Carpenter)
40
- * Exposed flags as symbols (Martin Carpenter)
44
+ * Added manual close method
45
+ * Added unit test suite
41
46
 
42
- --------------------------------------------------------------------------------
43
- 9/14/2010 version 0.4.0
47
+ == 0.1.0 [2003-07-28]
44
48
 
45
- * Brushed up C layer
46
- * Moved most of the Ruby stuff to C
47
- * No longer expose internal state (@closed, @flags)
48
- * No longer expose internal C methods (fm_*)
49
- * Updated for magic(4) version 5.04
49
+ * Initial release.
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to filemagic version 0.4.0
5
+ This documentation refers to filemagic version 0.4.1
6
6
 
7
7
 
8
8
  == DESCRIPTION
data/TODO CHANGED
@@ -2,7 +2,6 @@
2
2
  * Find a way to make magic_check work on NULL
3
3
  * Refactor code into initialize instead of new
4
4
 
5
- * Expose magic(4) version (how?)
6
5
  * Properly document C methods
7
6
  * Convert tests to RSpec
8
7
  * Add Rake tasks
@@ -271,6 +271,10 @@ void
271
271
  Init_filemagic() {
272
272
  cFileMagic = rb_define_class("FileMagic", rb_cObject);
273
273
 
274
+ char version[16];
275
+ sprintf(version, "%d.%02d", FILE_VERSION_MAJOR, patchlevel);
276
+ rb_define_const(cFileMagic, "MAGIC_VERSION", rb_str_new2(version));
277
+
274
278
  rb_define_singleton_method(cFileMagic, "new", rb_magic_new, -1);
275
279
 
276
280
  rb_define_method(cFileMagic, "initialize", rb_magic_init, -1);
@@ -2,8 +2,9 @@
2
2
  #define __FILEMAGIC_H_
3
3
 
4
4
  #include "ruby.h"
5
- #include <magic.h>
6
5
  #include <math.h>
6
+ #include <magic.h>
7
+ #include <file/patchlevel.h>
7
8
 
8
9
  /* Ruby 1.8.5 compatibility */
9
10
  #ifndef RSTRING_LEN
@@ -3,26 +3,29 @@
3
3
  $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
4
  require 'filemagic'
5
5
 
6
- puts FileMagic.new.flags
6
+ p FileMagic::VERSION
7
+ p FileMagic::MAGIC_VERSION
8
+
9
+ p FileMagic.new.flags
7
10
 
8
11
  FileMagic.open(:mime) { |fm|
9
- puts fm.flags
10
- puts fm.file(__FILE__)
12
+ p fm.flags
13
+ p fm.file(__FILE__)
11
14
 
12
- fm.setflags(:raw, :continue)
13
- puts fm.flags
15
+ fm.flags = [:raw, :continue]
16
+ p fm.flags
14
17
  }
15
18
 
16
19
  fm = FileMagic.new
17
- puts fm.flags
20
+ p fm.flags
18
21
 
19
22
  mime = FileMagic.mime
20
- puts mime.flags
23
+ p mime.flags
21
24
 
22
25
  ARGV.each { |file|
23
- puts fm.file(file)
24
- puts fm.file(file, true)
26
+ p fm.file(file)
27
+ p fm.file(file, true)
25
28
 
26
- puts mime.file(file)
27
- puts mime.file(file, true)
29
+ p mime.file(file)
30
+ p mime.file(file, true)
28
31
  }
@@ -1,4 +1,5 @@
1
1
  require 'filemagic.so'
2
+ require 'filemagic/version'
2
3
 
3
4
  class FileMagic
4
5
 
@@ -4,7 +4,7 @@ class FileMagic
4
4
 
5
5
  MAJOR = 0
6
6
  MINOR = 4
7
- TINY = 0
7
+ TINY = 1
8
8
 
9
9
  class << self
10
10
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-filemagic
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 0
10
- version: 0.4.0
9
+ - 1
10
+ version: 0.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Travis Whitton
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-09-14 00:00:00 +02:00
19
+ date: 2010-09-15 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies: []
22
22
 
@@ -29,6 +29,7 @@ executables: []
29
29
  extensions:
30
30
  - ext/extconf.rb
31
31
  extra_rdoc_files:
32
+ - ChangeLog
32
33
  - README
33
34
  files:
34
35
  - lib/filemagic/ext.rb
@@ -45,7 +46,7 @@ files:
45
46
  - test/filemagic_test.rb
46
47
  - test/excel-example.xls
47
48
  - README
48
- - CHANGELOG
49
+ - ChangeLog
49
50
  - Rakefile
50
51
  - TODO
51
52
  - info/filemagic.rd