mirror of
https://github.com/sdsykes/fastimage.git
synced 2025-12-30 00:05:02 -05:00
Remove support for 1.8.7, bump major version
This commit is contained in:
parent
e53d427455
commit
e54e1e0b23
@ -1,6 +1,5 @@
|
||||
language: ruby
|
||||
rvm:
|
||||
- 1.8.7
|
||||
- 1.9.2
|
||||
- 1.9.3
|
||||
- 2.0.0
|
||||
|
||||
@ -67,6 +67,12 @@ FastImage.new("http://stephensykes.com/images/ExifOrientation3.jpg").orientation
|
||||
|
||||
h2. Installation
|
||||
|
||||
h4. Required Ruby version
|
||||
|
||||
FastImage version 2.0.0 and above work with Ruby 1.9.2 and above.
|
||||
|
||||
FastImage version 1.9.0 was the last version that supported Ruby 1.8.7.
|
||||
|
||||
h4. Gem
|
||||
|
||||
bc. gem install fastimage
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
Gem::Specification.new do |s|
|
||||
s.name = %q{fastimage}
|
||||
s.version = "1.9.0"
|
||||
s.version = "2.0.0"
|
||||
|
||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||
s.required_ruby_version = '>= 1.9.2'
|
||||
s.authors = ["Stephen Sykes"]
|
||||
s.date = %q{2016-02-13}
|
||||
s.date = %q{2016-03-24}
|
||||
s.description = %q{FastImage finds the size or type of an image given its uri by fetching as little as needed.}
|
||||
s.email = %q{sdsykes@gmail.com}
|
||||
s.extra_rdoc_files = [
|
||||
@ -14,7 +14,6 @@ Gem::Specification.new do |s|
|
||||
"MIT-LICENSE",
|
||||
"README.textile",
|
||||
"lib/fastimage.rb",
|
||||
"lib/fastimage/fbr.rb",
|
||||
]
|
||||
s.homepage = %q{http://github.com/sdsykes/fastimage}
|
||||
s.rdoc_options = ["--charset=UTF-8"]
|
||||
|
||||
@ -57,7 +57,6 @@
|
||||
|
||||
require 'net/https'
|
||||
require 'addressable/uri'
|
||||
require 'fastimage/fbr.rb'
|
||||
require 'delegate'
|
||||
require 'pathname'
|
||||
require 'zlib'
|
||||
|
||||
@ -1,66 +0,0 @@
|
||||
# Poor Man's Fiber (API compatible Thread based Fiber implementation for Ruby 1.8)
|
||||
# (c) 2008 Aman Gupta (tmm1)
|
||||
|
||||
unless defined? Fiber
|
||||
require 'thread'
|
||||
|
||||
class FiberError < StandardError; # :nodoc:
|
||||
end
|
||||
|
||||
class Fiber # :nodoc:
|
||||
def initialize
|
||||
raise ArgumentError, 'new Fiber requires a block' unless block_given?
|
||||
|
||||
@yield = Queue.new
|
||||
@resume = Queue.new
|
||||
|
||||
@thread = Thread.new{ @yield.push [yield(*@resume.pop)] }
|
||||
@thread.abort_on_exception = true
|
||||
@thread[:fiber] = self
|
||||
end
|
||||
attr_reader :thread
|
||||
|
||||
def resume *args
|
||||
raise FiberError, 'dead fiber called' unless @thread.alive?
|
||||
@resume.push(args)
|
||||
result = @yield.pop
|
||||
result.size > 1 ? result : result.first
|
||||
end
|
||||
|
||||
def yield *args
|
||||
@yield.push(args)
|
||||
result = @resume.pop
|
||||
result.size > 1 ? result : result.first
|
||||
end
|
||||
|
||||
def self.yield *args
|
||||
if fiber = Thread.current[:fiber]
|
||||
fiber.yield(*args)
|
||||
else
|
||||
raise FiberError, 'not inside a fiber'
|
||||
end
|
||||
end
|
||||
|
||||
def self.current
|
||||
if Thread.current == Thread.main
|
||||
return Thread.main[:fiber] ||= RootFiber.new
|
||||
end
|
||||
|
||||
Thread.current[:fiber] or raise FiberError, 'not inside a fiber'
|
||||
end
|
||||
|
||||
def inspect
|
||||
"#<#{self.class}:0x#{self.object_id.to_s(16)}>"
|
||||
end
|
||||
end
|
||||
|
||||
class RootFiber < Fiber # :nodoc:
|
||||
def initialize
|
||||
# XXX: what is a root fiber anyway?
|
||||
end
|
||||
|
||||
def self.yield *args
|
||||
raise FiberError, "can't yield from root fiber"
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user