ruby-filemagic 0.7.1-x86-mswin32-60 → 0.7.2-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 498431626772026317ebb090f420a0ef353459b8
4
- data.tar.gz: 80d113af890a76aa5bf8e85a5fed42d74a10ecc1
3
+ metadata.gz: 2cef574160acd109563220ed3a88f1ef9425cf44
4
+ data.tar.gz: 534f06010567b2aa0b05066f44f8cbbf1bbad9f3
5
5
  SHA512:
6
- metadata.gz: f9909d32739c020f4b1370fe716f8f7d383350f2674b9552755337dac7797c9c47025149d59adf611745b52f8581038bdd2387731bdb11c598253e06c22ce7eb
7
- data.tar.gz: 09006527863a70969686a40134aa87a8edddef43e348404ee2d4b8c1292f2061d693ae551457f88f661edf17cce8c656444ff8973ceaf4c4a26011687af243b8
6
+ metadata.gz: 2e5d593039930dc1064b00bca6f41bff6bf5d57a615c0e1fb9a28a6166fa3568875986842e75cc93cb3fb49af896cd022428f204174d7b7a3f7651ae7549b52f
7
+ data.tar.gz: bd97e03d99176a9f33f6927e2a46a2bc438764342a96d1c4af3cf6781ff113b129eedf20bdcaa9f1616f4c98f04f6b7b741a0c5171ec5b7d10444bd6f2d5ee95
data/ChangeLog CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  = Revision history for ruby-filemagic
4
4
 
5
+ == 0.7.3 [unreleased]
6
+
7
+ * Dockerfile to build native extension (pull request #26 by Pavel Lobashov).
8
+
9
+ == 0.7.2 [2017-07-02]
10
+
11
+ * Fix segfault on <tt>buffer(nil)</tt> when compiled with GCC (pull request
12
+ #24 by Yuya Tanaka).
13
+
5
14
  == 0.7.1 [2015-10-27]
6
15
 
7
16
  * List default lib and header directories (pull request #18 by Adam Wróbel).
@@ -0,0 +1,37 @@
1
+ FROM ruby:2.4
2
+
3
+ RUN apt-get update && apt-get install -y mingw-w64 && gem install rake-compiler
4
+ ENV HOST_ARCH i686-w64-mingw32
5
+
6
+ ENV GNURX_VERSION 2.5.1
7
+ ENV GNURX_SOURCE /mingw-libgnurx-$GNURX_VERSION
8
+ RUN curl https://vorboss.dl.sourceforge.net/project/mingw/Other/UserContributed/regex/mingw-regex-$GNURX_VERSION/mingw-libgnurx-$GNURX_VERSION-src.tar.gz | \
9
+ tar xzvf - && \
10
+ cd $GNURX_SOURCE && \
11
+ ./configure --host=$HOST_ARCH --enable-static --disable-shared && \
12
+ make
13
+
14
+ ENV MAGIC_VERSION 5.31
15
+ ENV MAGIC_SOURCE /file-$MAGIC_VERSION
16
+ RUN curl ftp://ftp.astron.com/pub/file/file-$MAGIC_VERSION.tar.gz | \
17
+ tar xzvf - && \
18
+ cd $MAGIC_SOURCE && \
19
+ ./configure --disable-silent-rules --enable-fsect-man5 && \
20
+ make && \
21
+ make clean && \
22
+ LDFLAGS=-L$GNURX_SOURCE CFLAGS=-I$GNURX_SOURCE ./configure --disable-silent-rules --enable-fsect-man5 --host=$HOST_ARCH && \
23
+ make || true
24
+
25
+ ENV CROSS_RUBIES 2.3.4 2.4.1
26
+ RUN for i in $CROSS_RUBIES; do rake-compiler cross-ruby VERSION=$i; done
27
+
28
+ ENV APP_SOURCE /ruby-filemagic
29
+ RUN mkdir $APP_SOURCE
30
+ WORKDIR $APP_SOURCE
31
+
32
+ RUN echo "source 'https://rubygems.org'\ngemspec\n" > Gemfile
33
+ COPY *.gemspec .
34
+ RUN bundle install
35
+
36
+ COPY . .
37
+ ENTRYPOINT rake gem:native WITH_CROSS_GNURX=$GNURX_SOURCE WITH_CROSS_MAGIC=$MAGIC_SOURCE
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to filemagic version 0.7.1
5
+ This documentation refers to filemagic version 0.7.2
6
6
 
7
7
 
8
8
  == DESCRIPTION
@@ -38,24 +38,33 @@ FileMagic extension module. See also libmagic(3), file(1) and magic(4).
38
38
  require 'filemagic'
39
39
 
40
40
  p FileMagic::VERSION
41
+ # => "0.7.2"
41
42
  p FileMagic::MAGIC_VERSION
43
+ # => "5.28"
42
44
 
43
45
  p FileMagic.new.flags
46
+ # => []
44
47
 
45
48
  FileMagic.open(:mime) { |fm|
46
49
  p fm.flags
50
+ # => [:mime_type, :mime_encoding]
47
51
  p fm.file(__FILE__)
52
+ # => "text/plain; charset=us-ascii"
48
53
  p fm.file(__FILE__, true)
54
+ # => "text/plain"
49
55
 
50
56
  fm.flags = [:raw, :continue]
51
57
  p fm.flags
58
+ # => [:continue, :raw]
52
59
  }
53
60
 
54
61
  fm = FileMagic.new
55
62
  p fm.flags
63
+ # => []
56
64
 
57
65
  mime = FileMagic.mime
58
66
  p mime.flags
67
+ # => [:mime_type, :mime_encoding]
59
68
 
60
69
  === Environment
61
70
 
@@ -74,6 +83,11 @@ Fedora/SuSE:: +file-devel+
74
83
  Gentoo:: +sys-libs/libmagic+
75
84
  OS X:: <tt>brew install libmagic</tt>
76
85
 
86
+ === Build native extension
87
+
88
+ rake docker:gem:native
89
+
90
+ Requires Docker[https://docker.com] to be installed.
77
91
 
78
92
  == LINKS
79
93
 
@@ -95,6 +109,9 @@ Travis CI:: https://travis-ci.org/blackwinter/ruby-filemagic
95
109
  * Martin Carpenter <mailto:mcarpenter@free.fr> for Ruby 1.9.2 compatibility
96
110
  and other improvements.
97
111
 
112
+ * Pavel Lobashov (@ShockwaveNN) for Dockerfile to build cross-compiled Windows
113
+ extension (pull request #26).
114
+
98
115
 
99
116
  == COPYING
100
117
 
data/Rakefile CHANGED
@@ -32,3 +32,20 @@ begin
32
32
  rescue LoadError => err
33
33
  warn "Please install the `hen' gem. (#{err})"
34
34
  end
35
+
36
+ namespace :docker do
37
+
38
+ name = "ruby-filemagic-gem-native:#{FileMagic::VERSION}"
39
+
40
+ task :build do
41
+ sh *%W[docker build -t #{name} .]
42
+ end
43
+
44
+ task :run do
45
+ sh *%W[docker run -it --rm -v #{Dir.pwd}/pkg:/ruby-filemagic/pkg #{name}]
46
+ end
47
+
48
+ desc "Build native gems using docker image #{name}"
49
+ task 'gem:native' => %w[build run]
50
+
51
+ end
@@ -112,6 +112,7 @@ rb_magic_init(int argc, VALUE *argv, VALUE self) {
112
112
 
113
113
  rb_iv_set(self, "iflags", flags);
114
114
  rb_iv_set(self, "closed", Qfalse);
115
+ rb_iv_set(self, "@simplified", Qfalse);
115
116
 
116
117
  keys = rb_funcall(options, rb_intern("keys"), 0);
117
118
 
@@ -18,9 +18,9 @@
18
18
  }\
19
19
  }
20
20
 
21
- #define RB_MAGIC_TYPE_FILE magic_file(ms, StringValuePtr(arg))
22
- #define RB_MAGIC_TYPE_BUFFER magic_buffer(ms, StringValuePtr(arg), RSTRING_LEN(arg))
23
- #define RB_MAGIC_TYPE_DESCRIPTOR magic_descriptor(ms, NUM2INT(arg))
21
+ #define RB_MAGIC_TYPE_FILE type = magic_file(ms, StringValuePtr(arg));
22
+ #define RB_MAGIC_TYPE_BUFFER { char *arg_str = StringValuePtr(arg); type = magic_buffer(ms, arg_str, RSTRING_LEN(arg)); }
23
+ #define RB_MAGIC_TYPE_DESCRIPTOR type = magic_descriptor(ms, NUM2INT(arg));
24
24
 
25
25
  #define RB_MAGIC_TYPE(what, WHAT) \
26
26
  static VALUE \
@@ -32,7 +32,8 @@ rb_magic_##what(int argc, VALUE *argv, VALUE self) {\
32
32
  rb_scan_args(argc, argv, "11", &arg, &simple);\
33
33
  GetMagicSet(self, ms);\
34
34
  \
35
- if ((type = RB_MAGIC_TYPE_##WHAT) == NULL) {\
35
+ RB_MAGIC_TYPE_##WHAT\
36
+ if (type == NULL) {\
36
37
  rb_raise(rb_FileMagicError, "failed lookup: %s", magic_error(ms));\
37
38
  }\
38
39
  \
Binary file
@@ -4,7 +4,7 @@ class FileMagic
4
4
 
5
5
  MAJOR = 0
6
6
  MINOR = 7
7
- TINY = 1
7
+ TINY = 2
8
8
 
9
9
  class << self
10
10
 
@@ -62,6 +62,12 @@ magic file from #{FileMagic.path}
62
62
  assert_equal('POSIX shell script, ASCII text executable', res)
63
63
  end
64
64
 
65
+ def test_nil_buffer
66
+ fm = FileMagic.new(FileMagic::MAGIC_NONE)
67
+ assert_raise(TypeError) { fm.buffer(nil) }
68
+ fm.close
69
+ end
70
+
65
71
  def test_descriptor
66
72
  fm = FileMagic.new(FileMagic::MAGIC_NONE)
67
73
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-filemagic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: x86-mswin32-60
6
6
  authors:
7
7
  - Travis Whitton
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-27 00:00:00.000000000 Z
12
+ date: 2017-08-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hen
@@ -20,7 +20,7 @@ dependencies:
20
20
  version: '0.8'
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.8.3
23
+ version: 0.8.7
24
24
  type: :development
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
@@ -30,7 +30,7 @@ dependencies:
30
30
  version: '0.8'
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.8.3
33
+ version: 0.8.7
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: rake
36
36
  requirement: !ruby/object:Gem::Requirement
@@ -84,6 +84,7 @@ extra_rdoc_files:
84
84
  files:
85
85
  - CONTRIBUTING.md
86
86
  - ChangeLog
87
+ - Dockerfile
87
88
  - README
88
89
  - Rakefile
89
90
  - TODO
@@ -91,10 +92,8 @@ files:
91
92
  - ext/filemagic/filemagic.c
92
93
  - ext/filemagic/filemagic.h
93
94
  - lib/filemagic.rb
94
- - lib/filemagic/1.9/ruby_filemagic.so
95
- - lib/filemagic/2.0/ruby_filemagic.so
96
- - lib/filemagic/2.1/ruby_filemagic.so
97
- - lib/filemagic/2.2/ruby_filemagic.so
95
+ - lib/filemagic/2.3/ruby_filemagic.so
96
+ - lib/filemagic/2.4/ruby_filemagic.so
98
97
  - lib/filemagic/ext.rb
99
98
  - lib/filemagic/magic.mgc
100
99
  - lib/filemagic/version.rb
@@ -114,13 +113,14 @@ licenses:
114
113
  metadata: {}
115
114
  post_install_message: |2+
116
115
 
117
- ruby-filemagic-0.7.1 [2015-10-27]:
116
+ ruby-filemagic-0.7.2 [2017-07-02]:
118
117
 
119
- * List default lib and header directories (pull request #18 by Adam Wróbel).
118
+ * Fix segfault on <tt>buffer(nil)</tt> when compiled with GCC (pull request
119
+ #24 by Yuya Tanaka).
120
120
 
121
121
  rdoc_options:
122
122
  - "--title"
123
- - ruby-filemagic Application documentation (v0.7.1)
123
+ - ruby-filemagic Application documentation (v0.7.2)
124
124
  - "--charset"
125
125
  - UTF-8
126
126
  - "--line-numbers"
@@ -133,7 +133,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
133
  requirements:
134
134
  - - ">="
135
135
  - !ruby/object:Gem::Version
136
- version: 1.9.3
136
+ version: '2.3'
137
+ - - "<"
138
+ - !ruby/object:Gem::Version
139
+ version: '2.5'
137
140
  required_rubygems_version: !ruby/object:Gem::Requirement
138
141
  requirements:
139
142
  - - ">="
@@ -141,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
144
  version: '0'
142
145
  requirements: []
143
146
  rubyforge_project:
144
- rubygems_version: 2.4.8
147
+ rubygems_version: 2.6.12
145
148
  signing_key:
146
149
  specification_version: 4
147
150
  summary: Ruby bindings to the magic(4) library