ruby-filemagic 0.7.1-x86-mingw32 → 0.7.2-x86-mingw32

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: 57ac323c7d3e9c1f8fa019df95bb00e495f789a3
4
- data.tar.gz: 8b6a2c041e524c2d06223fdda1666494592192f9
3
+ metadata.gz: 377a2c6558fb1f00fd8075cafb68e781a51ad822
4
+ data.tar.gz: fe3c12269a75fea27053601108d5f44ff0581dc4
5
5
  SHA512:
6
- metadata.gz: f1c4c128a2d60cea8cfc21458edf85ff7402581c448e3c0b261eba6b5b893760d3d599a938864a513f9d925a84f465b152d190fe1fdac38e12619903503f3a9c
7
- data.tar.gz: 31d5e91b9c96a87f51205f9db3257f8cc76576213393ce06159413362c0d4bc03499ba7f9178036c730f43fda823c2832246b3b5cdeadbbcd83b89d6a3498371
6
+ metadata.gz: 404fd6b9775a6fad5eb790e61022cb36e2e1611be559c091e582ffa9a5f6654077222035040056d7fdf558d89a38e0e0d8eb660d64b84e6a6ec2ac8dc3147a08
7
+ data.tar.gz: 14488d38240ed291076115457bfeeeefc6586a2be5188c45bbfd6d5cc171075c7a348950b718e93f40379b2f8f1dd9766b7fe61dc03630268f5ba5bf88141c58
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-mingw32
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