thumbs 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ source "http://rubygems.org"
4
4
  gem "rack"
5
5
  gem "rack-contrib"
6
6
  gem "mini_magick"
7
+ gem "lumberjack"
7
8
 
8
9
  group :development do
9
10
  gem "rspec"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
data/lib/thumbs/image.rb CHANGED
@@ -3,7 +3,7 @@ module Thumbs
3
3
 
4
4
  class Image
5
5
 
6
- attr_accessor :server, :path, :size
6
+ attr_accessor :server, :path, :size, :url
7
7
 
8
8
  def initialize(params)
9
9
  @size = params[:size] if params[:size] =~ /^\d+x\d+$/
@@ -18,6 +18,7 @@ module Thumbs
18
18
  image = Image.new(params.merge(:thumbs_folder => env['thumbs.thumbs_folder']))
19
19
 
20
20
  env['thumbs.remote_url'] = image.remote_url
21
+ env['thumbs.url'] = image.url
21
22
  env['thumbs.resized_path'] = image.resized_path
22
23
  env['thumbs.original_path'] = image.original_path
23
24
  env['thumbs.size'] = image.size
@@ -1,24 +1,24 @@
1
- require 'logger'
1
+ require 'lumberjack'
2
2
  require 'benchmark'
3
3
 
4
4
  module Thumbs
5
5
  class Logger
6
6
  def initialize(app, logfile_path)
7
- @logger = ::Logger.new(logfile_path, 0)
8
- @logger.datetime_format = "%Y-%m-%d %H:%M:%S"
7
+ @logger = Lumberjack::Logger.new(logfile_path, :time_format => "%Y-%m-%d %H:%M:%S", :roll => :daily, :flush_seconds => 5)
9
8
  @app = app
10
9
  end
11
10
 
12
11
  def call(env)
13
12
  env['thumbs.logger'] = []
14
- env['thumbs.logger'] << "#{env['thumbs.remote_url']}@#{env['thumbs.size']}"
13
+ env['thumbs.logger'] << env['thumbs.url']
14
+ env['thumbs.logger'] << env['thumbs.size']
15
15
  response = []
16
16
  realtime = Benchmark.realtime do
17
17
  response = @app.call(env)
18
18
  end
19
19
  status, headers, body = response
20
20
  env['thumbs.logger'] << sprintf('%.4f', realtime)
21
- @logger.info env['thumbs.logger'].join(" : ")
21
+ @logger.info env['thumbs.logger'].join("\t")
22
22
  return [status, headers, body]
23
23
  end
24
24
  end
data/lib/thumbs.rb CHANGED
@@ -26,11 +26,11 @@ module Thumbs
26
26
  :ttl => 86400,
27
27
  :last_modified => true
28
28
  },
29
- :server_name => "Thumbs/0.0.3",
29
+ :server_name => "Thumbs/0.0.6",
30
30
  :url_map => "/:size/:original_url",
31
31
  :image_not_found => File.join(File.dirname(__FILE__), "thumbs", "images", "image_not_found.jpg"),
32
32
  :runtime => false,
33
- :logfile => "log/thumbs.log"
33
+ :logfile => false
34
34
  }.merge!(args)
35
35
 
36
36
  Rack::Builder.new do
@@ -45,7 +45,7 @@ module Thumbs
45
45
 
46
46
  use Thumbs::Config, options[:url_map]
47
47
 
48
- use Thumbs::Logger, options[:logfile]
48
+ use Thumbs::Logger, options[:logfile] if options[:logfile]
49
49
 
50
50
  use Thumbs::ServerName, options[:server_name] if options[:server_name]
51
51
  use Thumbs::CacheControl, options[:cache_control] if options[:cache_control]
data/thumbs.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{thumbs}
8
- s.version = "0.0.5"
8
+ s.version = "0.0.6"
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-01-23}
12
+ s.date = %q{2011-02-26}
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.4.1}
46
+ s.rubygems_version = %q{1.5.2}
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",
@@ -57,6 +57,7 @@ Gem::Specification.new do |s|
57
57
  s.add_runtime_dependency(%q<rack>, [">= 0"])
58
58
  s.add_runtime_dependency(%q<rack-contrib>, [">= 0"])
59
59
  s.add_runtime_dependency(%q<mini_magick>, [">= 0"])
60
+ s.add_runtime_dependency(%q<lumberjack>, [">= 0"])
60
61
  s.add_development_dependency(%q<rspec>, [">= 0"])
61
62
  s.add_development_dependency(%q<bundler>, [">= 0"])
62
63
  s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
@@ -64,6 +65,7 @@ Gem::Specification.new do |s|
64
65
  s.add_dependency(%q<rack>, [">= 0"])
65
66
  s.add_dependency(%q<rack-contrib>, [">= 0"])
66
67
  s.add_dependency(%q<mini_magick>, [">= 0"])
68
+ s.add_dependency(%q<lumberjack>, [">= 0"])
67
69
  s.add_dependency(%q<rspec>, [">= 0"])
68
70
  s.add_dependency(%q<bundler>, [">= 0"])
69
71
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
@@ -72,6 +74,7 @@ Gem::Specification.new do |s|
72
74
  s.add_dependency(%q<rack>, [">= 0"])
73
75
  s.add_dependency(%q<rack-contrib>, [">= 0"])
74
76
  s.add_dependency(%q<mini_magick>, [">= 0"])
77
+ s.add_dependency(%q<lumberjack>, [">= 0"])
75
78
  s.add_dependency(%q<rspec>, [">= 0"])
76
79
  s.add_dependency(%q<bundler>, [">= 0"])
77
80
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
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: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marcin Ciunelis
@@ -15,10 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-23 00:00:00 +01:00
18
+ date: 2011-02-26 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
+ name: rack
22
23
  version_requirements: &id001 !ruby/object:Gem::Requirement
23
24
  none: false
24
25
  requirements:
@@ -28,11 +29,11 @@ dependencies:
28
29
  segments:
29
30
  - 0
30
31
  version: "0"
31
- requirement: *id001
32
32
  prerelease: false
33
- name: rack
34
33
  type: :runtime
34
+ requirement: *id001
35
35
  - !ruby/object:Gem::Dependency
36
+ name: rack-contrib
36
37
  version_requirements: &id002 !ruby/object:Gem::Requirement
37
38
  none: false
38
39
  requirements:
@@ -42,11 +43,11 @@ dependencies:
42
43
  segments:
43
44
  - 0
44
45
  version: "0"
45
- requirement: *id002
46
46
  prerelease: false
47
- name: rack-contrib
48
47
  type: :runtime
48
+ requirement: *id002
49
49
  - !ruby/object:Gem::Dependency
50
+ name: mini_magick
50
51
  version_requirements: &id003 !ruby/object:Gem::Requirement
51
52
  none: false
52
53
  requirements:
@@ -56,11 +57,11 @@ dependencies:
56
57
  segments:
57
58
  - 0
58
59
  version: "0"
59
- requirement: *id003
60
60
  prerelease: false
61
- name: mini_magick
62
61
  type: :runtime
62
+ requirement: *id003
63
63
  - !ruby/object:Gem::Dependency
64
+ name: lumberjack
64
65
  version_requirements: &id004 !ruby/object:Gem::Requirement
65
66
  none: false
66
67
  requirements:
@@ -70,11 +71,11 @@ dependencies:
70
71
  segments:
71
72
  - 0
72
73
  version: "0"
73
- requirement: *id004
74
74
  prerelease: false
75
- name: rspec
76
- type: :development
75
+ type: :runtime
76
+ requirement: *id004
77
77
  - !ruby/object:Gem::Dependency
78
+ name: rspec
78
79
  version_requirements: &id005 !ruby/object:Gem::Requirement
79
80
  none: false
80
81
  requirements:
@@ -84,12 +85,26 @@ dependencies:
84
85
  segments:
85
86
  - 0
86
87
  version: "0"
87
- requirement: *id005
88
88
  prerelease: false
89
- name: bundler
90
89
  type: :development
90
+ requirement: *id005
91
91
  - !ruby/object:Gem::Dependency
92
+ name: bundler
92
93
  version_requirements: &id006 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ hash: 3
99
+ segments:
100
+ - 0
101
+ version: "0"
102
+ prerelease: false
103
+ type: :development
104
+ requirement: *id006
105
+ - !ruby/object:Gem::Dependency
106
+ name: jeweler
107
+ version_requirements: &id007 !ruby/object:Gem::Requirement
93
108
  none: false
94
109
  requirements:
95
110
  - - ~>
@@ -100,10 +115,9 @@ dependencies:
100
115
  - 5
101
116
  - 2
102
117
  version: 1.5.2
103
- requirement: *id006
104
118
  prerelease: false
105
- name: jeweler
106
119
  type: :development
120
+ requirement: *id007
107
121
  description: ""
108
122
  email: marcin.ciunelis@gmail.com
109
123
  executables: []
@@ -166,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
180
  requirements: []
167
181
 
168
182
  rubyforge_project:
169
- rubygems_version: 1.4.1
183
+ rubygems_version: 1.5.2
170
184
  signing_key:
171
185
  specification_version: 3
172
186
  summary: Image server proxy that can resize images on the fly. Built in ruby as a Rack application.