thumbs 0.0.6 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,6 +10,8 @@ h2. Requirements
10
10
 
11
11
  h2. Usage
12
12
 
13
+ 1. as a standalone rack app
14
+
13
15
  config.ru
14
16
 
15
17
  bc.. require "rubygems"
@@ -26,16 +28,29 @@ run Thumbs.new(
26
28
  :last_modified => true # add Last-Modfied header
27
29
  },
28
30
  :etag => true, # add ETag
29
- :logfile => "log/thumbs.log" # log file
30
- :server_name => "Thumbs/0.0.3", # Server header
31
+ :logfile => false # will write log file if filepath is provided
32
+ :server_name => "Thumbs/0.0.8", # Server header
31
33
  :image_not_found => "image_not_found.jpg" # path to image_not_found
32
34
  )
33
35
 
36
+ 2. as a moundable rails app
37
+
38
+ YourApplication::Application.routes.draw do
39
+
40
+ mount Thumbs.new(:url_map => "/:size/:original_url") => "images/resized"
41
+
42
+ ....
43
+ end
44
+
45
+ 3. you can even use it on heroku for free
46
+
47
+ create your own rack app, or use this one: http://thumbs-gem.heroku.com/i/100x100/www.google.com/images/logos/ps_logo2.png
48
+
34
49
  h2. TODO
35
50
 
36
51
  * Tests!
37
52
  * Access control
38
- * use of Rack::Sendfile
53
+ * SSL support
39
54
 
40
55
  h2. Contributing
41
56
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.8
@@ -10,7 +10,7 @@ module Thumbs
10
10
  if env["thumbs.#{@cache_type}_path"]
11
11
  begin
12
12
  status, headers, body = [200, {}, File.read(env["thumbs.#{@cache_type}_path"])]
13
- env['thumbs.logger'] << "#{@cache_type}_cache"
13
+ env['thumbs.logger'] << "#{@cache_type}_cache" if env['thumbs.logger']
14
14
  return [status, headers, body]
15
15
  rescue Errno::ENOENT, IOError => e
16
16
  end
@@ -10,12 +10,12 @@ module Thumbs
10
10
  def call(env)
11
11
  if env['thumbs.remote_url']
12
12
  begin
13
- status, headers, body = [200, {}, open(env['thumbs.remote_url']).read]
14
- env['thumbs.logger'] << "download"
13
+ status, headers, body = [200, {}, open(URI.escape(env['thumbs.remote_url'])).read]
14
+ env['thumbs.logger'] << "download" if env['thumbs.logger']
15
15
  return [status, headers, body]
16
16
  rescue StandardError, Timeout::Error => e
17
17
  status, headers, body = [404, {'Content-Type' => 'text/plain'}, ["Not found"]]
18
- env['thumbs.logger'] << "not_found"
18
+ env['thumbs.logger'] << "not_found" if env['thumbs.logger']
19
19
  return [status, headers, body]
20
20
  end
21
21
  else
@@ -14,7 +14,7 @@ module Thumbs
14
14
  if status == 200
15
15
  [status, headers, body]
16
16
  else
17
- env['thumbs.logger'] << "not_found"
17
+ env['thumbs.logger'] << "not_found" if env['thumbs.logger']
18
18
  [404, {}, @content]
19
19
  end
20
20
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{thumbs}
8
- s.version = "0.0.6"
8
+ s.version = "0.0.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Marcin Ciunelis"]
12
- s.date = %q{2011-02-26}
12
+ s.date = %q{2011-03-06}
13
13
  s.description = %q{}
14
14
  s.email = %q{marcin.ciunelis@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -43,7 +43,7 @@ Gem::Specification.new do |s|
43
43
  s.homepage = %q{http://github.com/martinciu/thumbs}
44
44
  s.licenses = ["MIT"]
45
45
  s.require_paths = ["lib"]
46
- s.rubygems_version = %q{1.5.2}
46
+ s.rubygems_version = %q{1.6.0}
47
47
  s.summary = %q{Image server proxy that can resize images on the fly. Built in ruby as a Rack application.}
48
48
  s.test_files = [
49
49
  "spec/spec_helper.rb",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thumbs
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 8
10
+ version: 0.0.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marcin Ciunelis
@@ -15,12 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-26 00:00:00 +01:00
18
+ date: 2011-03-06 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: rack
23
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ requirement: &id001 !ruby/object:Gem::Requirement
24
23
  none: false
25
24
  requirements:
26
25
  - - ">="
@@ -29,12 +28,12 @@ dependencies:
29
28
  segments:
30
29
  - 0
31
30
  version: "0"
31
+ version_requirements: *id001
32
+ name: rack
32
33
  prerelease: false
33
34
  type: :runtime
34
- requirement: *id001
35
35
  - !ruby/object:Gem::Dependency
36
- name: rack-contrib
37
- version_requirements: &id002 !ruby/object:Gem::Requirement
36
+ requirement: &id002 !ruby/object:Gem::Requirement
38
37
  none: false
39
38
  requirements:
40
39
  - - ">="
@@ -43,12 +42,12 @@ dependencies:
43
42
  segments:
44
43
  - 0
45
44
  version: "0"
45
+ version_requirements: *id002
46
+ name: rack-contrib
46
47
  prerelease: false
47
48
  type: :runtime
48
- requirement: *id002
49
49
  - !ruby/object:Gem::Dependency
50
- name: mini_magick
51
- version_requirements: &id003 !ruby/object:Gem::Requirement
50
+ requirement: &id003 !ruby/object:Gem::Requirement
52
51
  none: false
53
52
  requirements:
54
53
  - - ">="
@@ -57,12 +56,12 @@ dependencies:
57
56
  segments:
58
57
  - 0
59
58
  version: "0"
59
+ version_requirements: *id003
60
+ name: mini_magick
60
61
  prerelease: false
61
62
  type: :runtime
62
- requirement: *id003
63
63
  - !ruby/object:Gem::Dependency
64
- name: lumberjack
65
- version_requirements: &id004 !ruby/object:Gem::Requirement
64
+ requirement: &id004 !ruby/object:Gem::Requirement
66
65
  none: false
67
66
  requirements:
68
67
  - - ">="
@@ -71,12 +70,12 @@ dependencies:
71
70
  segments:
72
71
  - 0
73
72
  version: "0"
73
+ version_requirements: *id004
74
+ name: lumberjack
74
75
  prerelease: false
75
76
  type: :runtime
76
- requirement: *id004
77
77
  - !ruby/object:Gem::Dependency
78
- name: rspec
79
- version_requirements: &id005 !ruby/object:Gem::Requirement
78
+ requirement: &id005 !ruby/object:Gem::Requirement
80
79
  none: false
81
80
  requirements:
82
81
  - - ">="
@@ -85,12 +84,12 @@ dependencies:
85
84
  segments:
86
85
  - 0
87
86
  version: "0"
87
+ version_requirements: *id005
88
+ name: rspec
88
89
  prerelease: false
89
90
  type: :development
90
- requirement: *id005
91
91
  - !ruby/object:Gem::Dependency
92
- name: bundler
93
- version_requirements: &id006 !ruby/object:Gem::Requirement
92
+ requirement: &id006 !ruby/object:Gem::Requirement
94
93
  none: false
95
94
  requirements:
96
95
  - - ">="
@@ -99,12 +98,12 @@ dependencies:
99
98
  segments:
100
99
  - 0
101
100
  version: "0"
101
+ version_requirements: *id006
102
+ name: bundler
102
103
  prerelease: false
103
104
  type: :development
104
- requirement: *id006
105
105
  - !ruby/object:Gem::Dependency
106
- name: jeweler
107
- version_requirements: &id007 !ruby/object:Gem::Requirement
106
+ requirement: &id007 !ruby/object:Gem::Requirement
108
107
  none: false
109
108
  requirements:
110
109
  - - ~>
@@ -115,9 +114,10 @@ dependencies:
115
114
  - 5
116
115
  - 2
117
116
  version: 1.5.2
117
+ version_requirements: *id007
118
+ name: jeweler
118
119
  prerelease: false
119
120
  type: :development
120
- requirement: *id007
121
121
  description: ""
122
122
  email: marcin.ciunelis@gmail.com
123
123
  executables: []
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  requirements: []
181
181
 
182
182
  rubyforge_project:
183
- rubygems_version: 1.5.2
183
+ rubygems_version: 1.6.0
184
184
  signing_key:
185
185
  specification_version: 3
186
186
  summary: Image server proxy that can resize images on the fly. Built in ruby as a Rack application.