debian/0000755000000000000000000000000012202404063007157 5ustar debian/compat0000644000000000000000000000000211635323415010367 0ustar 7 debian/changelog0000644000000000000000000000123712202404046011035 0ustar ruby-magic (0.2.6-2) unstable; urgency=low * Team upload. [ Cédric Boutillier ] * debian/control: remove obsolete DM-Upload-Allowed flag * debian/copyright: use DEP5 copyright-format/1.0 official URL for Format field [ Antonio Terceiro ] * Fix Mime.guess_string_mime_encoding * Updated Standards-Versions to 3.9.4. No changes required. -- Antonio Terceiro Tue, 13 Aug 2013 12:19:17 +0200 ruby-magic (0.2.6-1) unstable; urgency=low * Initial release (Closes: #629136) * Unit test patched not to use rubygems and to require test_declarative. -- Dmitry Borodaenko Sat, 17 Sep 2011 15:36:57 +0300 debian/copyright0000644000000000000000000000331112151744647011132 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: magic Source: https://github.com/qoobaa/magic Files: * Copyright: Copyright (c) 2010 Jakub Kuźma License: Expat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: . The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. . THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Files: debian/* Copyright: 2011, Dmitry Borodaenko License: GPL-2+ The files hereby included are free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. debian/ruby-magic.docs0000644000000000000000000000002111635323415012073 0ustar README.rdoc rdoc debian/control0000644000000000000000000000173112202403532010564 0ustar Source: ruby-magic Section: ruby Priority: optional Maintainer: Debian Ruby Extras Maintainers Uploaders: Dmitry Borodaenko Build-Depends: debhelper (>= 7.0.50~), gem2deb (>= 0.2.8~), ruby-ffi, libmagic1, ruby-test-declarative Standards-Version: 3.9.4 Vcs-Git: git://github.com/qoobaa/magic.git Vcs-Browser: https://github.com/qoobaa/magic Homepage: http://jah.pl/projects/magic.html XS-Ruby-Versions: all Package: ruby-magic Architecture: all XB-Ruby-Versions: ${ruby:Versions} Depends: ${shlibs:Depends}, ${misc:Depends}, ruby | ruby-interpreter, ruby-ffi, libmagic1 Description: Ruby FFI bindings to libmagic This package provides a Ruby FFI wrapper to the "magic" library that determines content type and encoding of files and strings. The library does three types of tests: file system tests, magic number tests, and language tests. The first test that succeeds causes the file type to be returned. debian/rules0000755000000000000000000000110711635323415010250 0ustar #!/usr/bin/make -f #export DH_VERBOSE=1 # # Uncomment to ignore all test failures (but the tests will run anyway) #export DH_RUBY_IGNORE_TESTS=all # # Uncomment to ignore some test failures (but the tests will run anyway). # Valid values: #export DH_RUBY_IGNORE_TESTS=ruby1.8 ruby1.9.1 require-rubygems # # If you need to specify the .gemspec (eg there is more than one) #export DH_RUBY_GEMSPEC=gem.gemspec %: dh $@ --buildsystem=ruby --with ruby override_dh_installdocs: rdoc --inline-source --op rdoc --main Magic lib dh_installdocs override_dh_clean: rm -rf rdoc dh_clean debian/ruby-tests.rb0000644000000000000000000000007511635323415011641 0ustar $: << 'test' Dir['test/**/test_*.rb'].each { |f| require f } debian/source/0000755000000000000000000000000011635323415010471 5ustar debian/source/format0000644000000000000000000000001411635323415011677 0ustar 3.0 (quilt) debian/watch0000644000000000000000000000007311635323415010222 0ustar version=3 http://rubygems.org/gems/magic .*/magic-(.*).gem debian/patches/0000755000000000000000000000000012202403173010607 5ustar debian/patches/0001-remove-rubygems-usage-require-test_declarative.patch0000644000000000000000000000106111635323415023441 0ustar From: Dmitry Borodaenko Date: Sat, 17 Sep 2011 16:20:22 +0300 Subject: remove rubygems usage, require test_declarative --- test/helper.rb | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/test/helper.rb b/test/helper.rb index f8e992f..1dccf12 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -1,6 +1,5 @@ -require "rubygems" -gem "test-unit" require "test/unit" +require "test_declarative" $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib")) $LOAD_PATH.unshift(File.dirname(__FILE__)) -- debian/patches/series0000644000000000000000000000015212202400141012012 0ustar 0001-remove-rubygems-usage-require-test_declarative.patch 0001-Fix-Magic.guess_string_mime_encoding.patch debian/patches/0001-Fix-Magic.guess_string_mime_encoding.patch0000644000000000000000000000272112202403173021344 0ustar From 1d6c5770bd1cf107d3067c353689bda1634c97a4 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Tue, 13 Aug 2013 11:39:16 +0200 Forwarded: https://github.com/qoobaa/magic/pull/2 Subject: [PATCH] Fix Magic.guess_string_mime_encoding This patch is sligthly modified from the version submitted upstream to disable the test on Ruby 1.8 (which upstream probably doesn not care at this point anymore) --- lib/magic.rb | 2 +- test/test_magic.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) --- a/lib/magic.rb +++ b/lib/magic.rb @@ -52,7 +52,7 @@ module Magic # Magic.guess_string_mime_encoding("Magic® File™") # # => "utf-8" def guess_string_mime_encoding(string, *args) - guess(*args.unshift(:mime_type)) { |db| db.buffer(string) } + guess(*args.unshift(:mime_encoding)) { |db| db.buffer(string) } end # Guesses mime type of given string --- a/test/test_magic.rb +++ b/test/test_magic.rb @@ -1,3 +1,5 @@ +# encoding: UTF-8 + require "helper" class TestMagic < Test::Unit::TestCase @@ -44,4 +46,10 @@ class TestMagic < Test::Unit::TestCase Magic.guess(:mime) { |db| result = db.file(fixture("filelogo.jpg")) } assert_equal "image/jpeg; charset=binary", result end + + test "guess encoding from string" do + utf8 = "utf-8".force_encoding(Encoding::ASCII_8BIT) + assert_equal utf8, Magic.guess_string_mime_encoding('áéíóú') + end if RUBY_VERSION > '1.9' + end