thumbs 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +12 -0
- data/LICENSE.txt +20 -0
- data/README.textile +49 -0
- data/Rakefile +47 -0
- data/VERSION +1 -0
- data/lib/thumbs.rb +73 -0
- data/lib/thumbs/image.rb +41 -0
- data/lib/thumbs/images/image_not_found.jpg +0 -0
- data/lib/thumbs/middleware/cache_control.rb +17 -0
- data/lib/thumbs/middleware/cache_read.rb +22 -0
- data/lib/thumbs/middleware/cache_write.rb +32 -0
- data/lib/thumbs/middleware/config.rb +40 -0
- data/lib/thumbs/middleware/content_type.rb +16 -0
- data/lib/thumbs/middleware/download.rb +27 -0
- data/lib/thumbs/middleware/logger.rb +25 -0
- data/lib/thumbs/middleware/not_found.rb +24 -0
- data/lib/thumbs/middleware/resize.rb +25 -0
- data/lib/thumbs/middleware/server_name.rb +14 -0
- data/lib/thumbs/server.rb +16 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/thumbs_spec.rb +7 -0
- data/thumbs.gemspec +98 -0
- metadata +261 -0
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Marcin Ciunelis
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.textile
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
h1. Thumbs
|
2
|
+
|
3
|
+
Image server proxy that can resize images on the fly. Built in ruby as a Rack application.
|
4
|
+
|
5
|
+
h2. Usage
|
6
|
+
|
7
|
+
config.ru
|
8
|
+
|
9
|
+
bc.. require "rubygems"
|
10
|
+
require "bundler/setup"
|
11
|
+
|
12
|
+
require 'thumbs'
|
13
|
+
|
14
|
+
run Thumbs.new(
|
15
|
+
:url_map => "/:size/:original_url", # url pattern, :original_url is required
|
16
|
+
:thumbs_folder => "public/system/thumbs", # default: false - do not write on disk
|
17
|
+
:cache => true, # cache resized images - has no effect unless thumbs_folder exist
|
18
|
+
:cache_original => true, # cache original images - has no effect unless thumbs_folder exist
|
19
|
+
:runtime => true, # add X-Runtime header
|
20
|
+
:cache_control => {
|
21
|
+
:ttl => 86400, # add Expires and Cache-Control header for 24h
|
22
|
+
:last_modified => true # add Last-Modfied header
|
23
|
+
},
|
24
|
+
:etag => true, # add ETag
|
25
|
+
:logfile => "log/thumbs.log" # log file
|
26
|
+
:server_name => "Thumbs/0.0.3", # Server header
|
27
|
+
:image_not_found => "image_not_found.jpg" # path to image_not_found
|
28
|
+
)
|
29
|
+
|
30
|
+
h2. TODO
|
31
|
+
|
32
|
+
* Tests!
|
33
|
+
* Access control
|
34
|
+
* use of Rack::Sendfile
|
35
|
+
|
36
|
+
h2. Contributing
|
37
|
+
|
38
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
39
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
40
|
+
* Fork the project
|
41
|
+
* Start a feature/bugfix branch
|
42
|
+
* Commit and push until you are happy with your contribution
|
43
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
44
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
45
|
+
|
46
|
+
h2. Copyright
|
47
|
+
|
48
|
+
Copyright (c) 2011 Marcin Ciunelis. See LICENSE.txt for further details.
|
49
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'rake'
|
11
|
+
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
+
gem.name = "thumbs"
|
16
|
+
gem.homepage = "http://github.com/martinciu/thumbs"
|
17
|
+
gem.license = "MIT"
|
18
|
+
gem.summary = "Image server proxy that can resize images on the fly. Built in ruby as a Rack application."
|
19
|
+
gem.description = ""
|
20
|
+
gem.email = "marcin.ciunelis@gmail.com"
|
21
|
+
gem.authors = ["Marcin Ciunelis"]
|
22
|
+
gem.add_bundler_dependencies
|
23
|
+
end
|
24
|
+
Jeweler::RubygemsDotOrgTasks.new
|
25
|
+
|
26
|
+
require 'rspec/core'
|
27
|
+
require 'rspec/core/rake_task'
|
28
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
29
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
30
|
+
end
|
31
|
+
|
32
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
33
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
34
|
+
spec.rcov = true
|
35
|
+
end
|
36
|
+
|
37
|
+
task :default => :spec
|
38
|
+
|
39
|
+
require 'rake/rdoctask'
|
40
|
+
Rake::RDocTask.new do |rdoc|
|
41
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
42
|
+
|
43
|
+
rdoc.rdoc_dir = 'rdoc'
|
44
|
+
rdoc.title = "thumbs #{version}"
|
45
|
+
rdoc.rdoc_files.include('README*')
|
46
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
47
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.3
|
data/lib/thumbs.rb
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "bundler/setup"
|
3
|
+
|
4
|
+
module Thumbs
|
5
|
+
autoload :Server, 'thumbs/server'
|
6
|
+
autoload :Image, 'thumbs/image'
|
7
|
+
autoload :NotFound, 'thumbs/middleware/not_found'
|
8
|
+
autoload :ServerName, 'thumbs/middleware/server_name'
|
9
|
+
autoload :CacheControl, 'thumbs/middleware/cache_control'
|
10
|
+
autoload :Download, 'thumbs/middleware/download'
|
11
|
+
autoload :Resize, 'thumbs/middleware/resize'
|
12
|
+
autoload :Config, 'thumbs/middleware/config'
|
13
|
+
autoload :CacheWrite, 'thumbs/middleware/cache_write'
|
14
|
+
autoload :CacheRead, 'thumbs/middleware/cache_read'
|
15
|
+
autoload :Logger, 'thumbs/middleware/logger'
|
16
|
+
autoload :ContentType, 'thumbs/middleware/content_type'
|
17
|
+
|
18
|
+
def self.new(args)
|
19
|
+
options = {
|
20
|
+
:thumbs_folder => false,
|
21
|
+
:etag => true,
|
22
|
+
:cache => true,
|
23
|
+
:cache_original => true,
|
24
|
+
:cache_control => {
|
25
|
+
:ttl => 86400,
|
26
|
+
:last_modified => true
|
27
|
+
},
|
28
|
+
:server_name => "Thumbs/0.0.3",
|
29
|
+
:url_map => "/:size/:original_url",
|
30
|
+
:image_not_found => File.join(File.dirname(__FILE__), "thumbs", "images", "image_not_found.jpg"),
|
31
|
+
:runtime => false,
|
32
|
+
:logfile => "log/thumbs.log"
|
33
|
+
}.merge!(args)
|
34
|
+
|
35
|
+
Rack::Builder.new do
|
36
|
+
|
37
|
+
use Rack::Runtime if options[:runtime]
|
38
|
+
|
39
|
+
use Rack::Config do |env|
|
40
|
+
env['thumbs.thumbs_folder'] = options[:thumbs_folder]
|
41
|
+
end
|
42
|
+
|
43
|
+
use Rack::ShowExceptions
|
44
|
+
|
45
|
+
use Thumbs::Config, options[:url_map]
|
46
|
+
|
47
|
+
use Thumbs::Logger, options[:logfile]
|
48
|
+
|
49
|
+
use Thumbs::ServerName, options[:server_name] if options[:server_name]
|
50
|
+
use Thumbs::CacheControl, options[:cache_control] if options[:cache_control]
|
51
|
+
use Rack::ETag if options[:etag]
|
52
|
+
|
53
|
+
use Thumbs::ContentType
|
54
|
+
|
55
|
+
if options[:cache] && options[:thumbs_folder] && File.exist?(File.expand_path(options[:thumbs_folder]))
|
56
|
+
use Thumbs::CacheRead, "resized"
|
57
|
+
use Thumbs::CacheWrite, "resized"
|
58
|
+
end
|
59
|
+
|
60
|
+
use Thumbs::Resize
|
61
|
+
|
62
|
+
use Thumbs::CacheWrite, "original" if options[:cache_original] && options[:thumbs_folder] && File.exist?(File.expand_path(options[:thumbs_folder]))
|
63
|
+
|
64
|
+
use Thumbs::NotFound, options[:image_not_found] if options[:image_not_found] && File.exist?(File.expand_path(options[:image_not_found]))
|
65
|
+
|
66
|
+
use Thumbs::CacheRead, "original" if options[:cache_original]
|
67
|
+
use Thumbs::Download
|
68
|
+
|
69
|
+
run Thumbs::Server.new
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
data/lib/thumbs/image.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'digest/sha1'
|
2
|
+
module Thumbs
|
3
|
+
|
4
|
+
class Image
|
5
|
+
|
6
|
+
attr_accessor :server, :path, :size
|
7
|
+
|
8
|
+
def initialize(params)
|
9
|
+
@size = params[:size] if params[:size] =~ /^\d+x\d+$/
|
10
|
+
@url = params[:original_url]
|
11
|
+
@thumbs_folder = params[:thumbs_folder]
|
12
|
+
end
|
13
|
+
|
14
|
+
def local_path(size)
|
15
|
+
File.join(@thumbs_folder, spread(sha(size+@url))) if @thumbs_folder
|
16
|
+
end
|
17
|
+
|
18
|
+
def original_path
|
19
|
+
local_path("original")
|
20
|
+
end
|
21
|
+
|
22
|
+
def resized_path
|
23
|
+
local_path(@size)
|
24
|
+
end
|
25
|
+
|
26
|
+
def remote_url
|
27
|
+
"http://#{@url}"
|
28
|
+
end
|
29
|
+
|
30
|
+
protected
|
31
|
+
def sha(path)
|
32
|
+
Digest::SHA1.hexdigest(path)
|
33
|
+
end
|
34
|
+
|
35
|
+
def spread(sha, n = 2)
|
36
|
+
sha[2, 0] = "/"
|
37
|
+
sha
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
Binary file
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Thumbs
|
2
|
+
class CacheControl
|
3
|
+
def initialize(app, options)
|
4
|
+
@app = app
|
5
|
+
@ttl = options[:ttl] || 86400
|
6
|
+
@last_modified = options[:last_modified].nil? ? true : options[:last_modified]
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
status, headers, body = @app.call(env)
|
11
|
+
headers['Cache-Control'] ||= "max-age=#{@ttl}, public"
|
12
|
+
headers['Expires'] ||= (Time.now + @ttl).httpdate
|
13
|
+
headers['Last-Modified'] ||= Time.now.httpdate if @last_modified
|
14
|
+
[status, headers, body]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Thumbs
|
2
|
+
class CacheRead
|
3
|
+
|
4
|
+
def initialize(app, cache_type = "resized")
|
5
|
+
@app = app
|
6
|
+
@cache_type = cache_type
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
if env["thumbs.#{@cache_type}_path"]
|
11
|
+
begin
|
12
|
+
status, headers, body = [200, {}, File.read(env["thumbs.#{@cache_type}_path"])]
|
13
|
+
env['thumbs.logger'] << "#{@cache_type}_cache"
|
14
|
+
return [status, headers, body]
|
15
|
+
rescue Errno::ENOENT, IOError => e
|
16
|
+
end
|
17
|
+
end
|
18
|
+
return @app.call(env)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Thumbs
|
2
|
+
class CacheWrite
|
3
|
+
|
4
|
+
def initialize(app, cache_type = "resized")
|
5
|
+
@app = app
|
6
|
+
@cache_type = cache_type
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
status, headers, body = @app.call(env)
|
11
|
+
|
12
|
+
path = env["thumbs.#{@cache_type}_path"]
|
13
|
+
|
14
|
+
if path && status == 200
|
15
|
+
tries = 0
|
16
|
+
begin
|
17
|
+
File.open(path, "wb") {|f| f.write(body) }
|
18
|
+
rescue Errno::ENOENT, IOError
|
19
|
+
Dir.mkdir(File.dirname(path), 0755)
|
20
|
+
retry if (tries += 1) == 1
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
[status, headers, body]
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Thumbs
|
2
|
+
class Config
|
3
|
+
|
4
|
+
def initialize(app, url_map)
|
5
|
+
@app = app
|
6
|
+
@url_pattern, @keys = compile(url_map)
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
env['thumbs.url_pattern'] = @url_pattern
|
11
|
+
if match = @url_pattern.match(env['PATH_INFO'])
|
12
|
+
values = match.captures.to_a
|
13
|
+
params = @keys.zip(values).inject({}) do |hash,(k,v)|
|
14
|
+
hash[k.to_sym] = v
|
15
|
+
hash
|
16
|
+
end
|
17
|
+
|
18
|
+
image = Image.new(params.merge(:thumbs_folder => env['thumbs.thumbs_folder']))
|
19
|
+
|
20
|
+
env['thumbs.remote_url'] = image.remote_url
|
21
|
+
env['thumbs.resized_path'] = image.resized_path
|
22
|
+
env['thumbs.original_path'] = image.original_path
|
23
|
+
env['thumbs.size'] = image.size
|
24
|
+
end
|
25
|
+
@app.call(env)
|
26
|
+
end
|
27
|
+
|
28
|
+
protected
|
29
|
+
def compile(url_map)
|
30
|
+
keys = []
|
31
|
+
pattern = url_map.gsub(/((:\w+))/) do |match|
|
32
|
+
keys << $2[1..-1]
|
33
|
+
"(.+?)"
|
34
|
+
end
|
35
|
+
[/^#{pattern}$/, keys]
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rack/mime'
|
2
|
+
|
3
|
+
module Thumbs
|
4
|
+
class ContentType
|
5
|
+
def initialize(app, default_content_type = "image/jpeg")
|
6
|
+
@app = app
|
7
|
+
@default_content_type = default_content_type
|
8
|
+
end
|
9
|
+
|
10
|
+
def call(env)
|
11
|
+
status, headers, body = @app.call(env)
|
12
|
+
headers['Content-Type'] = Rack::Mime.mime_type(File.extname(env["thumbs.remote_url"]), @default_content_type) if headers['Content-Type'].nil?
|
13
|
+
[status, headers, body]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
|
3
|
+
module Thumbs
|
4
|
+
class Download
|
5
|
+
|
6
|
+
def initialize(app)
|
7
|
+
@app = app
|
8
|
+
end
|
9
|
+
|
10
|
+
def call(env)
|
11
|
+
if env['thumbs.remote_url']
|
12
|
+
begin
|
13
|
+
status, headers, body = [200, {}, open(env['thumbs.remote_url']).read]
|
14
|
+
env['thumbs.logger'] << "download"
|
15
|
+
return [status, headers, body]
|
16
|
+
rescue StandardError, Timeout::Error => e
|
17
|
+
status, headers, body = [404, {'Content-Type' => 'text/plain'}, ["Not found"]]
|
18
|
+
env['thumbs.logger'] << "not_found"
|
19
|
+
return [status, headers, body]
|
20
|
+
end
|
21
|
+
else
|
22
|
+
return @app.call(env)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'logger'
|
2
|
+
require 'benchmark'
|
3
|
+
|
4
|
+
module Thumbs
|
5
|
+
class Logger
|
6
|
+
def initialize(app, logfile_path)
|
7
|
+
@logger = ::Logger.new(logfile_path, 0)
|
8
|
+
@logger.datetime_format = "%Y-%m-%d %H:%M:%S"
|
9
|
+
@app = app
|
10
|
+
end
|
11
|
+
|
12
|
+
def call(env)
|
13
|
+
env['thumbs.logger'] = []
|
14
|
+
env['thumbs.logger'] << "#{env['thumbs.remote_url']}@#{env['thumbs.size']}"
|
15
|
+
response = []
|
16
|
+
realtime = Benchmark.realtime do
|
17
|
+
response = @app.call(env)
|
18
|
+
end
|
19
|
+
status, headers, body = response
|
20
|
+
env['thumbs.logger'] << sprintf('%.4f', realtime)
|
21
|
+
@logger.info env['thumbs.logger'].join(" : ")
|
22
|
+
return [status, headers, body]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Thumbs
|
2
|
+
|
3
|
+
class NotFound
|
4
|
+
F = ::File
|
5
|
+
|
6
|
+
def initialize(app, image_not_found)
|
7
|
+
@app = app
|
8
|
+
file = F.expand_path(image_not_found)
|
9
|
+
@content = F.read(file)
|
10
|
+
end
|
11
|
+
|
12
|
+
def call(env)
|
13
|
+
status, headers, body = @app.call(env)
|
14
|
+
if status == 200
|
15
|
+
[status, headers, body]
|
16
|
+
else
|
17
|
+
env['thumbs.logger'] << "not_found"
|
18
|
+
[404, {}, @content]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'mini_magick'
|
2
|
+
|
3
|
+
module Thumbs
|
4
|
+
class Resize
|
5
|
+
|
6
|
+
def initialize(app)
|
7
|
+
@app = app
|
8
|
+
end
|
9
|
+
|
10
|
+
def call(env)
|
11
|
+
status, headers, body = @app.call(env)
|
12
|
+
|
13
|
+
if env['thumbs.size']
|
14
|
+
begin
|
15
|
+
thumb = MiniMagick::Image.read(body)
|
16
|
+
thumb.resize env['thumbs.size']
|
17
|
+
body = thumb.to_blob
|
18
|
+
rescue
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
[status, headers, body]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Thumbs
|
2
|
+
class ServerName
|
3
|
+
def initialize(app, server_name)
|
4
|
+
@app = app
|
5
|
+
@server_name = server_name
|
6
|
+
end
|
7
|
+
|
8
|
+
def call(env)
|
9
|
+
status, headers, body = @app.call(env)
|
10
|
+
headers['Server'] = @server_name
|
11
|
+
[status, headers, body]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'thumbs'
|
5
|
+
|
6
|
+
# Requires supporting files with custom matchers and macros, etc,
|
7
|
+
# in ./support/ and its subdirectories.
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
|
12
|
+
end
|
data/spec/thumbs_spec.rb
ADDED
data/thumbs.gemspec
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{thumbs}
|
8
|
+
s.version = "0.0.3"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Marcin Ciunelis"]
|
12
|
+
s.date = %q{2011-01-23}
|
13
|
+
s.description = %q{}
|
14
|
+
s.email = %q{marcin.ciunelis@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.textile"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
"Gemfile",
|
21
|
+
"LICENSE.txt",
|
22
|
+
"README.textile",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"lib/thumbs.rb",
|
26
|
+
"lib/thumbs/image.rb",
|
27
|
+
"lib/thumbs/images/image_not_found.jpg",
|
28
|
+
"lib/thumbs/middleware/cache_control.rb",
|
29
|
+
"lib/thumbs/middleware/cache_read.rb",
|
30
|
+
"lib/thumbs/middleware/cache_write.rb",
|
31
|
+
"lib/thumbs/middleware/config.rb",
|
32
|
+
"lib/thumbs/middleware/content_type.rb",
|
33
|
+
"lib/thumbs/middleware/download.rb",
|
34
|
+
"lib/thumbs/middleware/logger.rb",
|
35
|
+
"lib/thumbs/middleware/not_found.rb",
|
36
|
+
"lib/thumbs/middleware/resize.rb",
|
37
|
+
"lib/thumbs/middleware/server_name.rb",
|
38
|
+
"lib/thumbs/server.rb",
|
39
|
+
"spec/spec_helper.rb",
|
40
|
+
"spec/thumbs_spec.rb",
|
41
|
+
"thumbs.gemspec"
|
42
|
+
]
|
43
|
+
s.homepage = %q{http://github.com/martinciu/thumbs}
|
44
|
+
s.licenses = ["MIT"]
|
45
|
+
s.require_paths = ["lib"]
|
46
|
+
s.rubygems_version = %q{1.4.1}
|
47
|
+
s.summary = %q{Image server proxy that can resize images on the fly. Built in ruby as a Rack application.}
|
48
|
+
s.test_files = [
|
49
|
+
"spec/spec_helper.rb",
|
50
|
+
"spec/thumbs_spec.rb"
|
51
|
+
]
|
52
|
+
|
53
|
+
if s.respond_to? :specification_version then
|
54
|
+
s.specification_version = 3
|
55
|
+
|
56
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
57
|
+
s.add_runtime_dependency(%q<rack>, [">= 0"])
|
58
|
+
s.add_runtime_dependency(%q<rack-contrib>, [">= 0"])
|
59
|
+
s.add_runtime_dependency(%q<mini_magick>, [">= 0"])
|
60
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
61
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
62
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
63
|
+
s.add_runtime_dependency(%q<rack>, [">= 0"])
|
64
|
+
s.add_runtime_dependency(%q<rack-contrib>, [">= 0"])
|
65
|
+
s.add_runtime_dependency(%q<mini_magick>, [">= 0"])
|
66
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
67
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
68
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
69
|
+
else
|
70
|
+
s.add_dependency(%q<rack>, [">= 0"])
|
71
|
+
s.add_dependency(%q<rack-contrib>, [">= 0"])
|
72
|
+
s.add_dependency(%q<mini_magick>, [">= 0"])
|
73
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
74
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
75
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
76
|
+
s.add_dependency(%q<rack>, [">= 0"])
|
77
|
+
s.add_dependency(%q<rack-contrib>, [">= 0"])
|
78
|
+
s.add_dependency(%q<mini_magick>, [">= 0"])
|
79
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
80
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
81
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
82
|
+
end
|
83
|
+
else
|
84
|
+
s.add_dependency(%q<rack>, [">= 0"])
|
85
|
+
s.add_dependency(%q<rack-contrib>, [">= 0"])
|
86
|
+
s.add_dependency(%q<mini_magick>, [">= 0"])
|
87
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
88
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
89
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
90
|
+
s.add_dependency(%q<rack>, [">= 0"])
|
91
|
+
s.add_dependency(%q<rack-contrib>, [">= 0"])
|
92
|
+
s.add_dependency(%q<mini_magick>, [">= 0"])
|
93
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
94
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
95
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
metadata
ADDED
@@ -0,0 +1,261 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: thumbs
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Marcin Ciunelis
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-01-23 00:00:00 +01:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 3
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
requirement: *id001
|
32
|
+
prerelease: false
|
33
|
+
name: rack
|
34
|
+
type: :runtime
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
hash: 3
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
version: "0"
|
45
|
+
requirement: *id002
|
46
|
+
prerelease: false
|
47
|
+
name: rack-contrib
|
48
|
+
type: :runtime
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 3
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
requirement: *id003
|
60
|
+
prerelease: false
|
61
|
+
name: mini_magick
|
62
|
+
type: :runtime
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
hash: 3
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
version: "0"
|
73
|
+
requirement: *id004
|
74
|
+
prerelease: false
|
75
|
+
name: rspec
|
76
|
+
type: :development
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
hash: 3
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
version: "0"
|
87
|
+
requirement: *id005
|
88
|
+
prerelease: false
|
89
|
+
name: bundler
|
90
|
+
type: :development
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
94
|
+
requirements:
|
95
|
+
- - ~>
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
hash: 7
|
98
|
+
segments:
|
99
|
+
- 1
|
100
|
+
- 5
|
101
|
+
- 2
|
102
|
+
version: 1.5.2
|
103
|
+
requirement: *id006
|
104
|
+
prerelease: false
|
105
|
+
name: jeweler
|
106
|
+
type: :development
|
107
|
+
- !ruby/object:Gem::Dependency
|
108
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
hash: 3
|
114
|
+
segments:
|
115
|
+
- 0
|
116
|
+
version: "0"
|
117
|
+
requirement: *id007
|
118
|
+
prerelease: false
|
119
|
+
name: rack
|
120
|
+
type: :runtime
|
121
|
+
- !ruby/object:Gem::Dependency
|
122
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
hash: 3
|
128
|
+
segments:
|
129
|
+
- 0
|
130
|
+
version: "0"
|
131
|
+
requirement: *id008
|
132
|
+
prerelease: false
|
133
|
+
name: rack-contrib
|
134
|
+
type: :runtime
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
hash: 3
|
142
|
+
segments:
|
143
|
+
- 0
|
144
|
+
version: "0"
|
145
|
+
requirement: *id009
|
146
|
+
prerelease: false
|
147
|
+
name: mini_magick
|
148
|
+
type: :runtime
|
149
|
+
- !ruby/object:Gem::Dependency
|
150
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
151
|
+
none: false
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
hash: 3
|
156
|
+
segments:
|
157
|
+
- 0
|
158
|
+
version: "0"
|
159
|
+
requirement: *id010
|
160
|
+
prerelease: false
|
161
|
+
name: rspec
|
162
|
+
type: :development
|
163
|
+
- !ruby/object:Gem::Dependency
|
164
|
+
version_requirements: &id011 !ruby/object:Gem::Requirement
|
165
|
+
none: false
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
hash: 3
|
170
|
+
segments:
|
171
|
+
- 0
|
172
|
+
version: "0"
|
173
|
+
requirement: *id011
|
174
|
+
prerelease: false
|
175
|
+
name: bundler
|
176
|
+
type: :development
|
177
|
+
- !ruby/object:Gem::Dependency
|
178
|
+
version_requirements: &id012 !ruby/object:Gem::Requirement
|
179
|
+
none: false
|
180
|
+
requirements:
|
181
|
+
- - ~>
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
hash: 7
|
184
|
+
segments:
|
185
|
+
- 1
|
186
|
+
- 5
|
187
|
+
- 2
|
188
|
+
version: 1.5.2
|
189
|
+
requirement: *id012
|
190
|
+
prerelease: false
|
191
|
+
name: jeweler
|
192
|
+
type: :development
|
193
|
+
description: ""
|
194
|
+
email: marcin.ciunelis@gmail.com
|
195
|
+
executables: []
|
196
|
+
|
197
|
+
extensions: []
|
198
|
+
|
199
|
+
extra_rdoc_files:
|
200
|
+
- LICENSE.txt
|
201
|
+
- README.textile
|
202
|
+
files:
|
203
|
+
- Gemfile
|
204
|
+
- LICENSE.txt
|
205
|
+
- README.textile
|
206
|
+
- Rakefile
|
207
|
+
- VERSION
|
208
|
+
- lib/thumbs.rb
|
209
|
+
- lib/thumbs/image.rb
|
210
|
+
- lib/thumbs/images/image_not_found.jpg
|
211
|
+
- lib/thumbs/middleware/cache_control.rb
|
212
|
+
- lib/thumbs/middleware/cache_read.rb
|
213
|
+
- lib/thumbs/middleware/cache_write.rb
|
214
|
+
- lib/thumbs/middleware/config.rb
|
215
|
+
- lib/thumbs/middleware/content_type.rb
|
216
|
+
- lib/thumbs/middleware/download.rb
|
217
|
+
- lib/thumbs/middleware/logger.rb
|
218
|
+
- lib/thumbs/middleware/not_found.rb
|
219
|
+
- lib/thumbs/middleware/resize.rb
|
220
|
+
- lib/thumbs/middleware/server_name.rb
|
221
|
+
- lib/thumbs/server.rb
|
222
|
+
- spec/spec_helper.rb
|
223
|
+
- spec/thumbs_spec.rb
|
224
|
+
- thumbs.gemspec
|
225
|
+
has_rdoc: true
|
226
|
+
homepage: http://github.com/martinciu/thumbs
|
227
|
+
licenses:
|
228
|
+
- MIT
|
229
|
+
post_install_message:
|
230
|
+
rdoc_options: []
|
231
|
+
|
232
|
+
require_paths:
|
233
|
+
- lib
|
234
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
235
|
+
none: false
|
236
|
+
requirements:
|
237
|
+
- - ">="
|
238
|
+
- !ruby/object:Gem::Version
|
239
|
+
hash: 3
|
240
|
+
segments:
|
241
|
+
- 0
|
242
|
+
version: "0"
|
243
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
244
|
+
none: false
|
245
|
+
requirements:
|
246
|
+
- - ">="
|
247
|
+
- !ruby/object:Gem::Version
|
248
|
+
hash: 3
|
249
|
+
segments:
|
250
|
+
- 0
|
251
|
+
version: "0"
|
252
|
+
requirements: []
|
253
|
+
|
254
|
+
rubyforge_project:
|
255
|
+
rubygems_version: 1.4.1
|
256
|
+
signing_key:
|
257
|
+
specification_version: 3
|
258
|
+
summary: Image server proxy that can resize images on the fly. Built in ruby as a Rack application.
|
259
|
+
test_files:
|
260
|
+
- spec/spec_helper.rb
|
261
|
+
- spec/thumbs_spec.rb
|