scale_down 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -65,6 +65,8 @@ Create a rackup file (config.ru)
65
65
  # The path to the public directory
66
66
  config.public_path = File.expand_path(File.dirname(__FILE__))+"/public"
67
67
 
68
+ # Optional logger
69
+ config.logger = Logger.new("/tmp/logfile.log")
68
70
  end
69
71
 
70
72
  run ScaleDown::Controller
@@ -33,5 +33,12 @@ module ScaleDown
33
33
  ScaleDown.max_file_size = 10 * 1_048_576
34
34
  ScaleDown.max_dimensions = [1200,1200]
35
35
 
36
+ def logger=(logger)
37
+ @logger = logger
38
+ end
39
+
40
+ def logger
41
+ @logger || Logger.new("/dev/null")
42
+ end
36
43
  end
37
44
  end
@@ -31,7 +31,7 @@ class ScaleDown::Controller < Sinatra::Application
31
31
 
32
32
  path, status = dispatch(params)
33
33
 
34
- # TODO Eh? Shouldn't it be if 301
34
+ ScaleDown.logger.info "Controller#get #{path} #{status}"
35
35
  unless status == 403
36
36
  redirect URI.encode(path), status
37
37
  else
@@ -7,6 +7,8 @@ class ScaleDown::Dispatcher
7
7
  def process(params)
8
8
  dispatcher = new(params)
9
9
 
10
+ ScaleDown.logger.info "Dipatcher#process #{dispatcher.root_path}"
11
+
10
12
  return ["Missing file", 404] unless dispatcher.root_file_exists?
11
13
  return [dispatcher.redirect_path, 301] if dispatcher.scaled_file_exists?
12
14
 
@@ -1,3 +1,3 @@
1
1
  module ScaleDown
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/scale_down.rb CHANGED
@@ -3,6 +3,7 @@ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
3
3
 
4
4
  require 'rubygems'
5
5
  require 'sinatra'
6
+ require 'logger'
6
7
  require 'RMagick'
7
8
  require 'mini_magick'
8
9
  require 'hmac-sha1'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scale_down
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - John Weir
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-19 00:00:00 -05:00
18
+ date: 2011-01-11 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency