ruby-magic 0.0.1 → 0.4.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.
- checksums.yaml +5 -5
- data/AUTHORS +1 -1
- data/CHANGELOG.md +60 -0
- data/CONTRIBUTORS.md +17 -0
- data/COPYRIGHT +1 -1
- data/NOTICE +505 -0
- data/README.md +49 -0
- data/dependencies.yml +93 -0
- data/ext/magic/common.h +130 -59
- data/ext/magic/extconf.rb +404 -64
- data/ext/magic/functions.c +265 -187
- data/ext/magic/functions.h +46 -79
- data/ext/magic/ruby-magic.c +1288 -641
- data/ext/magic/ruby-magic.h +383 -173
- data/kwilczynski-public.pem +25 -0
- data/lib/magic.rb +86 -87
- data/lib/magic/core/file.rb +8 -66
- data/lib/magic/core/string.rb +4 -47
- data/lib/magic/version.rb +14 -48
- data/patches/libmagic/0001-Don-t-attempt-to-build-tests-documentation-and-Python-bindings.patch +44 -0
- data/ports/archives/file-5.39.tar.gz +0 -0
- metadata +36 -99
- data/CHANGES +0 -5
- data/CHANGES.rdoc +0 -5
- data/README +0 -1
- data/README.rdoc +0 -7
- data/Rakefile +0 -78
- data/TODO +0 -21
- data/VERSION +0 -1
- data/bin/magic +0 -33
- data/ruby-magic.gemspec +0 -68
- data/test/test_constants.rb +0 -47
- data/test/test_magic.rb +0 -260
data/lib/magic/version.rb
CHANGED
@@ -1,76 +1,42 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
# :stopdoc:
|
4
|
-
|
5
|
-
#
|
6
|
-
# version.rb
|
7
|
-
#
|
8
|
-
# Copyright 2013-2014 Krzysztof Wilczynski
|
9
|
-
#
|
10
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
-
# you may not use this file except in compliance with the License.
|
12
|
-
# You may obtain a copy of the License at
|
13
|
-
#
|
14
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
15
|
-
#
|
16
|
-
# Unless required by applicable law or agreed to in writing, software
|
17
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
-
# See the License for the specific language governing permissions and
|
20
|
-
# limitations under the License.
|
21
|
-
#
|
22
|
-
|
23
|
-
# :startdoc:
|
1
|
+
# frozen_string_literal: true
|
24
2
|
|
25
3
|
class Magic
|
26
4
|
#
|
27
5
|
# Current version of _Magic_.
|
28
6
|
#
|
29
|
-
VERSION = '0.0.
|
7
|
+
VERSION = '0.4.0'.freeze
|
30
8
|
|
31
9
|
class << self
|
32
10
|
#
|
33
11
|
# call-seq:
|
34
|
-
# Magic.
|
35
|
-
#
|
36
|
-
# Returns
|
12
|
+
# Magic.version_array -> array
|
37
13
|
#
|
38
14
|
# Example:
|
39
15
|
#
|
40
|
-
# Magic.
|
41
|
-
#
|
42
|
-
# Will raise <i>Magic::NotImplementedError</i> exception if, or
|
16
|
+
# Magic.version_array #=> [5, 39]
|
43
17
|
#
|
44
|
-
# See also: Magic::
|
18
|
+
# See also: Magic::version and Magic::version_string
|
45
19
|
#
|
46
|
-
def
|
20
|
+
def version_array
|
47
21
|
[self.version / 100, self.version % 100]
|
48
22
|
end
|
49
23
|
|
24
|
+
alias_method :version_to_a, :version_array
|
25
|
+
|
50
26
|
#
|
51
27
|
# call-seq:
|
52
|
-
# Magic.
|
53
|
-
#
|
54
|
-
# Returns
|
28
|
+
# Magic.version_string -> string
|
55
29
|
#
|
56
30
|
# Example:
|
57
31
|
#
|
58
|
-
# Magic.
|
59
|
-
#
|
60
|
-
# Will raise <i>Magic::NotImplementedError</i> exception if, or
|
32
|
+
# Magic.version_string #=> "5.39"
|
61
33
|
#
|
62
|
-
# See also: Magic::
|
34
|
+
# See also: Magic::version and Magic::version_array
|
63
35
|
#
|
64
|
-
def
|
65
|
-
'%d.%02d' % self.
|
36
|
+
def version_string
|
37
|
+
'%d.%02d' % self.version_array
|
66
38
|
end
|
67
39
|
|
68
|
-
alias_method :
|
69
|
-
alias_method :version_string, :version_to_s
|
40
|
+
alias_method :version_to_s, :version_string
|
70
41
|
end
|
71
42
|
end
|
72
|
-
|
73
|
-
# :enddoc:
|
74
|
-
|
75
|
-
# vim: set ts=2 sw=2 sts=2 et :
|
76
|
-
# encoding: utf-8
|
data/patches/libmagic/0001-Don-t-attempt-to-build-tests-documentation-and-Python-bindings.patch
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
From 0f2752ad4d7ea65c80d76493899aca67e90be524 Mon Sep 17 00:00:00 2001
|
2
|
+
From: =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= <kw@linux.com>
|
3
|
+
Date: Mon, 5 Apr 2021 16:51:59 +0000
|
4
|
+
Subject: [PATCH] Don't attempt to build tests, documentation and Python
|
5
|
+
bindings
|
6
|
+
MIME-Version: 1.0
|
7
|
+
Content-Type: text/plain; charset=UTF-8
|
8
|
+
Content-Transfer-Encoding: 8bit
|
9
|
+
|
10
|
+
Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
|
11
|
+
---
|
12
|
+
Makefile.am | 2 +-
|
13
|
+
Makefile.in | 2 +-
|
14
|
+
2 files changed, 2 insertions(+), 2 deletions(-)
|
15
|
+
|
16
|
+
diff --git a/Makefile.am b/Makefile.am
|
17
|
+
index 2ab67ed..c7fafeb 100644
|
18
|
+
--- a/Makefile.am
|
19
|
+
+++ b/Makefile.am
|
20
|
+
@@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS = -I m4
|
21
|
+
|
22
|
+
EXTRA_DIST = MAINT
|
23
|
+
|
24
|
+
-SUBDIRS = src magic tests doc python
|
25
|
+
+SUBDIRS = src magic
|
26
|
+
|
27
|
+
# This variable must have 'exec' in its name, in order to be installed
|
28
|
+
# by 'install-exec' target (instead of default 'install-data')
|
29
|
+
diff --git a/Makefile.in b/Makefile.in
|
30
|
+
index e19b15e..dcb5ce6 100644
|
31
|
+
--- a/Makefile.in
|
32
|
+
+++ b/Makefile.in
|
33
|
+
@@ -358,7 +358,7 @@ top_builddir = @top_builddir@
|
34
|
+
top_srcdir = @top_srcdir@
|
35
|
+
ACLOCAL_AMFLAGS = -I m4
|
36
|
+
EXTRA_DIST = MAINT
|
37
|
+
-SUBDIRS = src magic tests doc python
|
38
|
+
+SUBDIRS = src magic
|
39
|
+
|
40
|
+
# This variable must have 'exec' in its name, in order to be installed
|
41
|
+
# by 'install-exec' target (instead of default 'install-data')
|
42
|
+
--
|
43
|
+
2.31.0
|
44
|
+
|
Binary file
|
metadata
CHANGED
@@ -1,152 +1,89 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-magic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Krzysztof
|
7
|
+
- Krzysztof Wilczyński
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
|
10
|
+
cert_chain:
|
11
|
+
- kwilczynski-public.pem
|
12
|
+
date: 2021-04-08 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
15
|
+
name: mini_portile2
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
|
-
- - ~>
|
18
|
+
- - "~>"
|
18
19
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 10.1.1
|
23
|
-
type: :development
|
24
|
-
prerelease: false
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '10.1'
|
30
|
-
- - '>='
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 10.1.1
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: rdoc
|
35
|
-
requirement: !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
37
|
-
- - ~>
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '4.1'
|
40
|
-
- - '>='
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: 4.1.1
|
43
|
-
type: :development
|
44
|
-
prerelease: false
|
45
|
-
version_requirements: !ruby/object:Gem::Requirement
|
46
|
-
requirements:
|
47
|
-
- - ~>
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '4.1'
|
50
|
-
- - '>='
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: 4.1.1
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
name: test-unit
|
55
|
-
requirement: !ruby/object:Gem::Requirement
|
56
|
-
requirements:
|
57
|
-
- - ~>
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version: '2.5'
|
60
|
-
- - '>='
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 2.5.5
|
63
|
-
type: :development
|
20
|
+
version: 2.5.0
|
21
|
+
type: :runtime
|
64
22
|
prerelease: false
|
65
23
|
version_requirements: !ruby/object:Gem::Requirement
|
66
24
|
requirements:
|
67
|
-
- - ~>
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '2.5'
|
70
|
-
- - '>='
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: 2.5.5
|
73
|
-
- !ruby/object:Gem::Dependency
|
74
|
-
name: rake-compiler
|
75
|
-
requirement: !ruby/object:Gem::Requirement
|
76
|
-
requirements:
|
77
|
-
- - ~>
|
25
|
+
- - "~>"
|
78
26
|
- !ruby/object:Gem::Version
|
79
|
-
version:
|
80
|
-
- - '>='
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 0.9.2
|
83
|
-
type: :development
|
84
|
-
prerelease: false
|
85
|
-
version_requirements: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ~>
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0.9'
|
90
|
-
- - '>='
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
version: 0.9.2
|
27
|
+
version: 2.5.0
|
93
28
|
description: |
|
94
29
|
File Magic in Ruby.
|
95
30
|
|
96
31
|
Simple interface to libmagic for Ruby Programming Language.
|
97
|
-
email:
|
98
|
-
executables:
|
99
|
-
- magic
|
32
|
+
email: kw@linux.com
|
33
|
+
executables: []
|
100
34
|
extensions:
|
101
35
|
- ext/magic/extconf.rb
|
102
36
|
extra_rdoc_files: []
|
103
37
|
files:
|
104
38
|
- AUTHORS
|
105
|
-
-
|
106
|
-
-
|
39
|
+
- CHANGELOG.md
|
40
|
+
- CONTRIBUTORS.md
|
107
41
|
- COPYRIGHT
|
108
42
|
- LICENSE
|
109
|
-
-
|
110
|
-
- README.
|
111
|
-
-
|
112
|
-
- TODO
|
113
|
-
- VERSION
|
114
|
-
- bin/magic
|
43
|
+
- NOTICE
|
44
|
+
- README.md
|
45
|
+
- dependencies.yml
|
115
46
|
- ext/magic/common.h
|
116
47
|
- ext/magic/extconf.rb
|
117
48
|
- ext/magic/functions.c
|
118
49
|
- ext/magic/functions.h
|
119
50
|
- ext/magic/ruby-magic.c
|
120
51
|
- ext/magic/ruby-magic.h
|
52
|
+
- kwilczynski-public.pem
|
121
53
|
- lib/magic.rb
|
122
54
|
- lib/magic/core/file.rb
|
123
55
|
- lib/magic/core/string.rb
|
124
56
|
- lib/magic/version.rb
|
125
|
-
-
|
126
|
-
-
|
127
|
-
|
128
|
-
homepage: http://about.me/kwilczynski
|
57
|
+
- patches/libmagic/0001-Don-t-attempt-to-build-tests-documentation-and-Python-bindings.patch
|
58
|
+
- ports/archives/file-5.39.tar.gz
|
59
|
+
homepage: https://github.com/kwilczynski/ruby-magic
|
129
60
|
licenses:
|
130
|
-
- Apache
|
131
|
-
metadata:
|
132
|
-
|
61
|
+
- Apache-2.0
|
62
|
+
metadata:
|
63
|
+
bug_tracker_uri: https://github.com/kwilczynski/ruby-magic/issues
|
64
|
+
source_code_uri: https://github.com/kwilczynski/ruby-magic
|
65
|
+
changelog_uri: https://github.com/kwilczynski/ruby-magic/blob/master/CHANGELOG.md
|
66
|
+
documentation_uri: https://www.rubydoc.info/gems/ruby-magic
|
67
|
+
wiki_uri: https://github.com/kwilczynski/ruby-magic/wiki
|
68
|
+
post_install_message: 'Thank you for installing!
|
69
|
+
|
70
|
+
'
|
133
71
|
rdoc_options: []
|
134
72
|
require_paths:
|
135
73
|
- lib
|
136
74
|
- lib
|
137
75
|
required_ruby_version: !ruby/object:Gem::Requirement
|
138
76
|
requirements:
|
139
|
-
- -
|
77
|
+
- - ">="
|
140
78
|
- !ruby/object:Gem::Version
|
141
|
-
version:
|
79
|
+
version: 2.5.0
|
142
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
81
|
requirements:
|
144
|
-
- -
|
82
|
+
- - ">="
|
145
83
|
- !ruby/object:Gem::Version
|
146
84
|
version: '0'
|
147
85
|
requirements: []
|
148
|
-
|
149
|
-
rubygems_version: 2.2.2
|
86
|
+
rubygems_version: 3.1.4
|
150
87
|
signing_key:
|
151
88
|
specification_version: 4
|
152
89
|
summary: File Magic in Ruby
|
data/CHANGES
DELETED
data/CHANGES.rdoc
DELETED
data/README
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Simple interface to libmagic for Ruby Programming Language
|
data/README.rdoc
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
Simple interface to libmagic for Ruby Programming Language
|
2
|
-
|
3
|
-
{<img src="https://travis-ci.org/kwilczynski/ruby-magic.png?branch=master" alt="Build Status"/>}[https://travis-ci.org/kwilczynski/ruby-magic]
|
4
|
-
{<img src="https://coveralls.io/repos/kwilczynski/ruby-magic/badge.png?branch=master" alt="Coverage Status" />}[https://coveralls.io/r/kwilczynski/ruby-magic?branch=master]
|
5
|
-
{<img src="https://codeclimate.com/github/kwilczynski/ruby-magic.png" />}[https://codeclimate.com/github/kwilczynski/ruby-magic]
|
6
|
-
{<img src="https://gemnasium.com/kwilczynski/ruby-magic.png" alt="Dependency Status" />}[https://gemnasium.com/kwilczynski/ruby-magic]
|
7
|
-
{<img src="https://d2weczhvl823v0.cloudfront.net/kwilczynski/ruby-magic/trend.png" alt="Bitdeli Badge" />}[https://bitdeli.com/free]
|
data/Rakefile
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
# :enddoc:
|
4
|
-
|
5
|
-
#
|
6
|
-
# Rakefile
|
7
|
-
#
|
8
|
-
# Copyright 2013-2014 Krzysztof Wilczynski
|
9
|
-
#
|
10
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
-
# you may not use this file except in compliance with the License.
|
12
|
-
# You may obtain a copy of the License at
|
13
|
-
#
|
14
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
15
|
-
#
|
16
|
-
# Unless required by applicable law or agreed to in writing, software
|
17
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
-
# See the License for the specific language governing permissions and
|
20
|
-
# limitations under the License.
|
21
|
-
#
|
22
|
-
|
23
|
-
gem 'rdoc', '>= 4.1.1'
|
24
|
-
|
25
|
-
begin
|
26
|
-
require 'rake'
|
27
|
-
require 'rdoc/task'
|
28
|
-
require 'rake/testtask'
|
29
|
-
require 'rake/extensiontask'
|
30
|
-
rescue LoadError
|
31
|
-
require 'rubygems'
|
32
|
-
require 'rake'
|
33
|
-
require 'rdoc/task'
|
34
|
-
require 'rake/testtask'
|
35
|
-
require 'rake/extensiontask'
|
36
|
-
end
|
37
|
-
|
38
|
-
CLEAN.include '*{.h,.o,.log,.so}', 'ext/**/*{.o,.log,.so}', 'Makefile', 'ext/**/Makefile'
|
39
|
-
CLOBBER.include 'lib/**/*.so', 'doc/**/*'
|
40
|
-
|
41
|
-
gem = eval File.read('ruby-magic.gemspec')
|
42
|
-
|
43
|
-
RDoc::Task.new do |d|
|
44
|
-
files = %w(AUTHORS CHANGES.rdoc COPYRIGHT LICENSE README.rdoc TODO)
|
45
|
-
|
46
|
-
d.title = 'File Magic in Ruby'
|
47
|
-
d.main = 'README.rdoc'
|
48
|
-
|
49
|
-
d.rdoc_dir = 'doc/rdoc'
|
50
|
-
|
51
|
-
d.rdoc_files.include 'ext/**/*.{c,h}', 'lib/**/*.rb'
|
52
|
-
d.rdoc_files.include.add(files)
|
53
|
-
|
54
|
-
d.options << '--line-numbers'
|
55
|
-
end
|
56
|
-
|
57
|
-
Rake::TestTask.new do |t|
|
58
|
-
t.verbose = true
|
59
|
-
t.warning = true
|
60
|
-
t.test_files = Dir['test/**/test_*']
|
61
|
-
end
|
62
|
-
|
63
|
-
Gem::PackageTask.new(gem) do |p|
|
64
|
-
p.need_zip = true
|
65
|
-
p.need_tar = true
|
66
|
-
end
|
67
|
-
|
68
|
-
Rake::ExtensionTask.new('magic', gem) do |e|
|
69
|
-
e.ext_dir = 'ext/magic'
|
70
|
-
e.lib_dir = 'lib/magic'
|
71
|
-
end
|
72
|
-
|
73
|
-
Rake::Task[:test].prerequisites << :compile
|
74
|
-
|
75
|
-
task :default => :test
|
76
|
-
|
77
|
-
# vim: set ts=2 sw=2 sts=2 et :
|
78
|
-
# encoding: utf-8
|
data/TODO
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
ruby-magic (0.0.4)
|
2
|
-
|
3
|
-
* Vendor libmagic source code?
|
4
|
-
|
5
|
-
-- Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> Fri, 21 Mar 2014 18:06:21 +0000
|
6
|
-
|
7
|
-
ruby-magic (0.0.3)
|
8
|
-
|
9
|
-
* Add some examples;
|
10
|
-
* Move to YARD from RDoc (as RDoc is very bad, really);
|
11
|
-
* Improve documentation i.e. source code commenting, README file, etc.
|
12
|
-
|
13
|
-
-- Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> Fri, 21 Mar 2014 16:49:26 +0000
|
14
|
-
|
15
|
-
ruby-magic (0.0.2)
|
16
|
-
|
17
|
-
* Add implementation for the included "binary";
|
18
|
-
* Add Doxygen style comments for other functions in the source code;
|
19
|
-
* Add RDoc and improve documentation i.e. source code commenting.
|
20
|
-
|
21
|
-
-- Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> Fri, 21 Mar 2014 16:49:26 +0000
|