ruby-magic 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/magic/version.rb CHANGED
@@ -1,76 +1,42 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- # :stopdoc:
4
-
5
- #
6
- # version.rb
7
- #
8
- # Copyright 2013-2015 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.2.0'.freeze
7
+ VERSION = '0.3.0'.freeze
30
8
 
31
9
  class << self
32
10
  #
33
11
  # call-seq:
34
- # Magic.version_to_a -> array
35
- #
36
- # Returns
12
+ # Magic.version_array -> array
37
13
  #
38
14
  # Example:
39
15
  #
40
- # Magic.version_to_a #=> [5, 17]
41
- #
42
- # Will raise <i>Magic::NotImplementedError</i> exception if, or
16
+ # Magic.version_array #=> [5, 39]
43
17
  #
44
- # See also: Magic::version_to_s
18
+ # See also: Magic::version and Magic::version_string
45
19
  #
46
- def version_to_a
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.version_to_s -> string
53
- #
54
- # Returns
28
+ # Magic.version_string -> string
55
29
  #
56
30
  # Example:
57
31
  #
58
- # Magic.version_to_s #=> "5.17"
59
- #
60
- # Will raise <i>Magic::NotImplementedError</i> exception if, or
32
+ # Magic.version_string #=> "5.39"
61
33
  #
62
- # See also: Magic::version_to_a
34
+ # See also: Magic::version and Magic::version_array
63
35
  #
64
- def version_to_s
65
- '%d.%02d' % self.version_to_a
36
+ def version_string
37
+ '%d.%02d' % self.version_array
66
38
  end
67
39
 
68
- alias_method :version_array, :version_to_a
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
metadata CHANGED
@@ -1,56 +1,56 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-magic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
- - Krzysztof Wilczynski
7
+ - Krzysztof Wilczyński
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain: []
11
- date: 2015-03-26 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - kwilczynski-public.pem
12
+ date: 2021-03-25 00:00:00.000000000 Z
12
13
  dependencies: []
13
14
  description: |
14
15
  File Magic in Ruby.
15
16
 
16
17
  Simple interface to libmagic for Ruby Programming Language.
17
- email: krzysztof.wilczynski@linux.com
18
- executables:
19
- - magic
18
+ email: kw@linux.com
19
+ executables: []
20
20
  extensions:
21
21
  - ext/magic/extconf.rb
22
22
  extra_rdoc_files: []
23
23
  files:
24
24
  - AUTHORS
25
- - CHANGES
26
- - CHANGES.rdoc
25
+ - CHANGELOG.md
27
26
  - COPYRIGHT
28
27
  - LICENSE
29
- - README
30
- - README.rdoc
31
- - Rakefile
32
- - TODO
28
+ - NOTICE
29
+ - README.md
33
30
  - VERSION
34
- - bin/magic
35
31
  - ext/magic/common.h
36
32
  - ext/magic/extconf.rb
37
33
  - ext/magic/functions.c
38
34
  - ext/magic/functions.h
39
35
  - ext/magic/ruby-magic.c
40
36
  - ext/magic/ruby-magic.h
37
+ - kwilczynski-public.pem
41
38
  - lib/magic.rb
42
39
  - lib/magic/core/file.rb
43
40
  - lib/magic/core/string.rb
44
41
  - lib/magic/version.rb
45
- - ruby-magic.gemspec
46
- - test/helpers/magic_test_helper.rb
47
- - test/test_constants.rb
48
- - test/test_magic.rb
49
- homepage: http://about.me/kwilczynski
42
+ homepage: https://github.com/kwilczynski/ruby-magic
50
43
  licenses:
51
- - Apache License, Version 2.0
52
- metadata: {}
53
- post_install_message:
44
+ - Apache-2.0
45
+ metadata:
46
+ bug_tracker_uri: https://github.com/kwilczynski/ruby-magic/issues
47
+ source_code_uri: https://github.com/kwilczynski/ruby-magic
48
+ changelog_uri: https://github.com/kwilczynski/ruby-magic/blob/master/CHANGELOG.md
49
+ documentation_uri: https://www.rubydoc.info/gems/ruby-magic
50
+ wiki_uri: https://github.com/kwilczynski/ruby-magic/wiki
51
+ post_install_message: 'Thank you for installing!
52
+
53
+ '
54
54
  rdoc_options: []
55
55
  require_paths:
56
56
  - lib
@@ -59,15 +59,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: 1.9.2
62
+ version: 2.5.0
63
63
  required_rubygems_version: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - ">="
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0'
68
68
  requirements: []
69
- rubyforge_project:
70
- rubygems_version: 2.4.5
69
+ rubygems_version: 3.1.4
71
70
  signing_key:
72
71
  specification_version: 4
73
72
  summary: File Magic in Ruby
data/CHANGES DELETED
@@ -1,50 +0,0 @@
1
- ruby-magic (0.2.0)
2
-
3
- * Fixed formatting and white spaces.
4
- * Added Gemnasium, plus Coveralls and Code Climate integration (and hence improved
5
- code test coverage).
6
- * Fixed Travis CI build against Rubinius.
7
- * Re-factored the API and cleaned up small portions of code and documentation.
8
- * Retired support for Ruby 1.8.x (no support for MRI, Ruby Enterprise Edition and Rubinius).
9
- * Added functionality to handle releasing the GVL for any file and/or I/O operations.
10
- * Added ability to Magic#flags_array to return name of each flag that is set.
11
- * Changed Magic#version_array and Magic#version_string methods to be a singleton methods.
12
- * Renamed the Magic#flags_array method to Magic#flags_to_a.
13
- * Retired testing with Ruby 1.9.2 and 2.1.0, and added 2.2.0 on Travis CI.
14
- * Added naïve synchronization via Mutex#lock and Mutex#unlock methods to make interactions
15
- with libmagic more thread-safe.
16
- * Changed the Magic::new method, so that it accepts an array of paths from which to load
17
- the Magic database.
18
- * Fixed setting of global errno value to avoid race conditions.
19
- * Added ability for Travis CI test against multiple versions of vanilla libmagic.
20
- * Added LLVM (clang) compiler to build with to Travis CI, and fixed various issues reported
21
- by clang compiler during build-time.
22
- * Added ability for Magic#load to take nil as valid argument.
23
- * Fixed issue with libmagic's regular expression (regex) library not working with UTF-8 (or
24
- any other wide-character encoding).
25
- * Fixed build to make it work with C++ compilers.
26
- * Added support for the MAGIC_CONTINUE flag so that Magic#file, Magic#buffer and
27
- Magic#descriptor methods will return an array for multiple results when appropriate.
28
- * Moved integration with File and String core classes into separate namespace.
29
- * Removed forward declaration of errno as it's not needed on systems with modern C/C++
30
- libraries and compilers.
31
- * Added rudimentary Vagrantfile that can be used to build a development environment.
32
- * Removed the "-Wl,--no-undefined" option from LDFLAGS, as they might break on some systems.
33
- * Fixed any C90 standard related build-time warnings.
34
- * Changed the behaviour not to catch the generic Magic::Error, plus always to raise on errors
35
- coming from libmagic. This is to make it more aligned with the standard library, where file
36
- and I/O related errors would raise an appropriate exception.
37
- * Fixed version number to comply with Semantic Versioning 2 (http://semver.org/).
38
- * Added the Guard Ruby gem for convenience, with an appropriate Guardfile.
39
- * Changed behaviour consistent among various versions of libmagic adhering to the POSIX
40
- standard. This concerns the following IEEE 1003.1 standards:
41
- - http://pubs.opengroup.org/onlinepubs/007904975/utilities/file.html
42
- - http://pubs.opengroup.org/onlinepubs/9699919799/utilities/file.html
43
-
44
- -- Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> Wed, 25 Mar 2015 23:27:00 +0000
45
-
46
- ruby-magic (0.0.1)
47
-
48
- * First version.
49
-
50
- -- Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> Fri, 21 Mar 2014 16:49:26 +0000
data/CHANGES.rdoc DELETED
@@ -1,50 +0,0 @@
1
- ruby-magic (0.2.0)
2
-
3
- * Fixed formatting and white spaces.
4
- * Added Gemnasium, plus Coveralls and Code Climate integration (and hence improved
5
- code test coverage).
6
- * Fixed Travis CI build against Rubinius.
7
- * Re-factored the API and cleaned up small portions of code and documentation.
8
- * Retired support for Ruby 1.8.x (no support for MRI, Ruby Enterprise Edition and Rubinius).
9
- * Added functionality to handle releasing the GVL for any file and/or I/O operations.
10
- * Added ability to Magic#flags_array to return name of each flag that is set.
11
- * Changed Magic#version_array and Magic#version_string methods to be a singleton methods.
12
- * Renamed the Magic#flags_array method to Magic#flags_to_a.
13
- * Retired testing with Ruby 1.9.2 and 2.1.0, and added 2.2.0 on Travis CI.
14
- * Added naïve synchronization via Mutex#lock and Mutex#unlock methods to make interactions
15
- with libmagic more thread-safe.
16
- * Changed the Magic::new method, so that it accepts an array of paths from which to load
17
- the Magic database.
18
- * Fixed setting of global errno value to avoid race conditions.
19
- * Added ability for Travis CI test against multiple versions of vanilla libmagic.
20
- * Added LLVM (clang) compiler to build with to Travis CI, and fixed various issues reported
21
- by clang compiler during build-time.
22
- * Added ability for Magic#load to take nil as valid argument.
23
- * Fixed issue with libmagic's regular expression (regex) library not working with UTF-8 (or
24
- any other wide-character encoding).
25
- * Fixed build to make it work with C++ compilers.
26
- * Added support for the MAGIC_CONTINUE flag so that Magic#file, Magic#buffer and
27
- Magic#descriptor methods will return an array for multiple results when appropriate.
28
- * Moved integration with File and String core classes into separate namespace.
29
- * Removed forward declaration of errno as it's not needed on systems with modern C/C++
30
- libraries and compilers.
31
- * Added rudimentary Vagrantfile that can be used to build a development environment.
32
- * Removed the "-Wl,--no-undefined" option from LDFLAGS, as they might break on some systems.
33
- * Fixed any C90 standard related build-time warnings.
34
- * Changed the behaviour not to catch the generic Magic::Error, plus always to raise on errors
35
- coming from libmagic. This is to make it more aligned with the standard library, where file
36
- and I/O related errors would raise an appropriate exception.
37
- * Fixed version number to comply with Semantic Versioning 2 (http://semver.org/).
38
- * Added the Guard Ruby gem for convenience, with an appropriate Guardfile.
39
- * Changed behaviour consistent among various versions of libmagic adhering to the POSIX
40
- standard. This concerns the following IEEE 1003.1 standards:
41
- - http://pubs.opengroup.org/onlinepubs/007904975/utilities/file.html
42
- - http://pubs.opengroup.org/onlinepubs/9699919799/utilities/file.html
43
-
44
- -- Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> Wed, 25 Mar 2015 23:27:00 +0000
45
-
46
- ruby-magic (0.0.1)
47
-
48
- * First version.
49
-
50
- -- Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> Fri, 21 Mar 2014 16:49:26 +0000
data/README DELETED
@@ -1 +0,0 @@
1
- Simple interface to libmagic for Ruby Programming Language
data/README.rdoc DELETED
@@ -1,8 +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="http://inch-ci.org/github/kwilczynski/ruby-magic.svg?branch=master" alt="Documentation Status" />}[http://inch-ci.org/github/kwilczynski/ruby-magic]
5
- {<img src="https://badge.fury.io/rb/ruby-magic.png" alt="Gem Version" />}[http://badge.fury.io/rb/ruby-magic]
6
- {<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]
7
- {<img src="https://codeclimate.com/github/kwilczynski/ruby-magic.png" alt="Code Quality" />}[https://codeclimate.com/github/kwilczynski/ruby-magic]
8
- {<img src="https://gemnasium.com/kwilczynski/ruby-magic.png" alt="Dependency Status" />}[https://gemnasium.com/kwilczynski/ruby-magic]
data/Rakefile DELETED
@@ -1,79 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- # :enddoc:
4
-
5
- #
6
- # Rakefile
7
- #
8
- # Copyright 2013-2015 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 << :clobber
74
- Rake::Task[:test].prerequisites << :compile
75
-
76
- task :default => :test
77
-
78
- # vim: set ts=2 sw=2 sts=2 et :
79
- # encoding: utf-8
data/TODO DELETED
@@ -1,24 +0,0 @@
1
- ruby-magic (0.5.0)
2
-
3
- * Vendor libmagic source code?
4
-
5
- -- Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> Wed, 25 Mar 2015 23:27:00 +0000
6
-
7
- ruby-magic (0.4.0)
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> Wed, 25 Mar 2015 23:27:00 +0000
14
-
15
- ruby-magic (0.3.0)
16
-
17
- * Improve test coverage (if possible to 100%);
18
- * Add implementation for the included "binary";
19
- * Add Doxygen style comments for other functions in the source code;
20
- * Add RDoc and improve documentation i.e. source code commenting;
21
- * Add support for magic_load_buffers(magic_t, void **, size_t *, size_t);
22
- * Add support for Windows (if possible).
23
-
24
- -- Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> Wed, 25 Mar 2015 23:27:00 +0000
data/bin/magic DELETED
@@ -1,33 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # -*- encoding: utf-8 -*-
4
-
5
- # :enddoc:
6
-
7
- #
8
- # magic
9
- #
10
- # Copyright 2013-2015 Krzysztof Wilczynski
11
- #
12
- # Licensed under the Apache License, Version 2.0 (the "License");
13
- # you may not use this file except in compliance with the License.
14
- # You may obtain a copy of the License at
15
- #
16
- # http://www.apache.org/licenses/LICENSE-2.0
17
- #
18
- # Unless required by applicable law or agreed to in writing, software
19
- # distributed under the License is distributed on an "AS IS" BASIS,
20
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
- # See the License for the specific language governing permissions and
22
- # limitations under the License.
23
- #
24
-
25
- begin
26
- require 'magic'
27
- rescue LoadError
28
- require 'rubygems'
29
- require 'magic'
30
- end
31
-
32
- # vim: set ts=2 sw=2 sts=2 et :
33
- # encoding: utf-8
data/ruby-magic.gemspec DELETED
@@ -1,62 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- # :enddoc:
4
-
5
- #
6
- # ruby-magic.gemspec
7
- #
8
- # Copyright 2013-2015 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
- signing_key = File.expand_path('~/.gem/kwilczynski-private.pem')
24
-
25
- Gem::Specification.new do |s|
26
- s.name = 'ruby-magic'
27
- s.summary = 'File Magic in Ruby'
28
-
29
- s.description = <<-EOS
30
- File Magic in Ruby.
31
-
32
- Simple interface to libmagic for Ruby Programming Language.
33
- EOS
34
-
35
- s.platform = Gem::Platform::RUBY
36
- s.version = File.read('VERSION').strip
37
- s.license = 'Apache License, Version 2.0'
38
- s.author = 'Krzysztof Wilczynski'
39
- s.email = 'krzysztof.wilczynski@linux.com'
40
- s.homepage = 'http://about.me/kwilczynski'
41
- s.has_rdoc = true
42
-
43
- s.required_ruby_version = '>= 1.9.2'
44
- s.rubygems_version = '~> 2.2.0'
45
-
46
- s.files = Dir['ext/**/*.{c,h,rb}'] +
47
- Dir['lib/**/*.rb'] +
48
- Dir['benchmark/**/*.rb'] +
49
- Dir['test/**/*.rb'] +
50
- %w(Rakefile ruby-magic.gemspec AUTHORS
51
- CHANGES CHANGES.rdoc COPYRIGHT LICENSE
52
- README README.rdoc TODO VERSION)
53
-
54
- s.executables << 'magic'
55
- s.require_paths << 'lib'
56
- s.extensions << 'ext/magic/extconf.rb'
57
-
58
- s.signing_key = signing_key if File.exists?(signing_key)
59
- end
60
-
61
- # vim: set ts=2 sw=2 sts=2 et :
62
- # encoding: utf-8