Commit 532adc43 by minad

removed hoe dependency, fix

parent a7466579
require 'hoe' task :default => :test
$:.unshift 'lib' desc 'Run tests with bacon'
require 'mimemagic' task :test => FileList['test/*_test.rb'] do |t|
sh "bacon -q -Ilib:test #{t.prerequisites.join(' ')}"
Hoe.spec 'mimemagic' do
version = MimeMagic::VERSION
developer 'Daniel Mendler', 'mail@daniel-mendler.de'
summary = 'Mime detection by extension or content'
end end
...@@ -73,9 +73,7 @@ class MimeMagic ...@@ -73,9 +73,7 @@ class MimeMagic
# This is a slow operation. # This is a slow operation.
def self.by_magic(io) def self.by_magic(io)
if !(io.respond_to?(:seek) && io.respond_to?(:read)) if !(io.respond_to?(:seek) && io.respond_to?(:read))
io = io.to_s io = StringIO.new(io.to_s, 'rb:binary')
io.force_encoding('ascii-8bit') if io.respond_to?(:force_encoding)
io = StringIO.new(io, 'rb')
end end
mime = MAGIC.find {|type, matches| magic_match(io, matches) } mime = MAGIC.find {|type, matches| magic_match(io, matches) }
mime ? new(mime[0]) : nil mime ? new(mime[0]) : nil
......
...@@ -11,7 +11,7 @@ Gem::Specification.new do |s| ...@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
s.files = %w{ s.files = %w{
lib/mimemagic.rb lib/mimemagic.rb
lib/mimemagic_tables.rb lib/mimemagic_tables.rb
test/test_mimemagic.rb test/mimemagic_test.rb
test/files/application.x-bzip test/files/application.x-bzip
test/files/image.jpeg test/files/image.jpeg
test/files/image.png test/files/image.png
...@@ -31,19 +31,6 @@ README ...@@ -31,19 +31,6 @@ README
s.rubygems_version = %q{1.3.1} s.rubygems_version = %q{1.3.1}
s.summary = %q{Mime detection by extension or content} s.summary = %q{Mime detection by extension or content}
s.homepage = 'https://github.com/minad/mimemagic' s.homepage = 'https://github.com/minad/mimemagic'
s.test_files = ["test/test_mimemagic.rb"] s.test_files = ["test/mimemagic_test.rb"]
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 2
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_development_dependency(%q<hoe>, [">= 1.8.3"])
else
s.add_dependency(%q<hoe>, [">= 1.8.3"])
end
else
s.add_dependency(%q<hoe>, [">= 1.8.3"])
end
end end
gem 'bacon', '>= 0'
require 'bacon' require 'bacon'
require 'mimemagic' require 'mimemagic'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment