httpimagestore 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -15,9 +15,10 @@ group :development do
15
15
  gem "rspec", "~> 2.8.0"
16
16
  gem "cucumber", ">= 0"
17
17
  gem "jeweler", "~> 1.6.4"
18
- gem "rcov", ">= 0"
18
+ gem "simplecov", ">= 0"
19
19
  gem "rdoc", "~> 3.9"
20
20
  gem "daemon", "~> 1"
21
- gem "httpthumbnailer", "~> 0.1.0"
21
+ gem "httpthumbnailer", "~> 0.2"
22
22
  gem "prawn", "= 0.8.4"
23
23
  end
24
+
data/Gemfile.lock CHANGED
@@ -2,40 +2,40 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
4
  builder (3.0.0)
5
- cli (1.1.0)
6
- cucumber (1.1.3)
5
+ cli (1.1.1)
6
+ cucumber (1.2.1)
7
7
  builder (>= 2.1.2)
8
- diff-lcs (>= 1.1.2)
9
- gherkin (~> 2.6.7)
8
+ diff-lcs (>= 1.1.3)
9
+ gherkin (~> 2.11.0)
10
10
  json (>= 1.4.6)
11
- term-ansicolor (>= 1.0.6)
12
11
  daemon (1.1.0)
13
12
  daemons (1.0.10)
14
13
  diff-lcs (1.1.3)
15
14
  gem_plugin (0.2.3)
16
- gherkin (2.6.8)
15
+ gherkin (2.11.2)
17
16
  json (>= 1.4.6)
18
17
  git (1.2.5)
19
- haml (3.1.4)
20
- httpclient (2.2.4)
21
- httpthumbnailer (0.1.0)
18
+ haml (3.1.7)
19
+ httpclient (2.2.7)
20
+ httpthumbnailer (0.3.1)
22
21
  cli (~> 1.1.0)
23
22
  haml (~> 3)
24
- mongrel (>= 1.1.5)
23
+ mongrel (>= 1.2.0.pre2)
25
24
  rmagick (~> 2)
26
25
  ruby-ip (~> 0.9)
27
26
  sinatra (>= 1.2.6)
28
- httpthumbnailer-client (0.1.0)
29
- httpclient (>= 2.2.1)
27
+ httpthumbnailer-client (0.1.1)
28
+ httpclient (>= 2.2)
30
29
  jeweler (1.6.4)
31
30
  bundler (~> 1.0)
32
31
  git (>= 1.2.5)
33
32
  rake
34
- json (1.6.2)
33
+ json (1.7.5)
35
34
  mime-types (1.17.2)
36
35
  mongrel (1.2.0.pre2)
37
36
  daemons (~> 1.0.10)
38
37
  gem_plugin (~> 0.2.3)
38
+ multi_json (1.3.6)
39
39
  prawn (0.8.4)
40
40
  prawn-core (>= 0.8.4, < 0.9)
41
41
  prawn-layout (>= 0.8.4, < 0.9)
@@ -44,12 +44,11 @@ GEM
44
44
  prawn-layout (0.8.4)
45
45
  prawn-security (0.8.4)
46
46
  proxies (0.2.1)
47
- rack (1.3.5)
48
- rack-protection (1.1.4)
47
+ rack (1.4.1)
48
+ rack-protection (1.2.0)
49
49
  rack
50
50
  rake (0.9.2.2)
51
- rcov (0.9.11)
52
- rdoc (3.11)
51
+ rdoc (3.12)
53
52
  json (~> 1.4)
54
53
  retry-this (1.1)
55
54
  rmagick (2.13.1)
@@ -61,14 +60,17 @@ GEM
61
60
  rspec-expectations (2.8.0)
62
61
  diff-lcs (~> 1.1.2)
63
62
  rspec-mocks (2.8.0)
64
- ruby-ip (0.9.0)
65
- s3 (0.3.9)
63
+ ruby-ip (0.9.1)
64
+ s3 (0.3.11)
66
65
  proxies (~> 0.2.0)
67
- sinatra (1.3.1)
68
- rack (~> 1.3, >= 1.3.4)
69
- rack-protection (~> 1.1, >= 1.1.2)
66
+ simplecov (0.6.4)
67
+ multi_json (~> 1.0)
68
+ simplecov-html (~> 0.5.3)
69
+ simplecov-html (0.5.3)
70
+ sinatra (1.3.3)
71
+ rack (~> 1.3, >= 1.3.6)
72
+ rack-protection (~> 1.2)
70
73
  tilt (~> 1.3, >= 1.3.3)
71
- term-ansicolor (1.0.7)
72
74
  tilt (1.3.3)
73
75
 
74
76
  PLATFORMS
@@ -78,16 +80,16 @@ DEPENDENCIES
78
80
  cli (~> 1.1.0)
79
81
  cucumber
80
82
  daemon (~> 1)
81
- httpthumbnailer (~> 0.1.0)
83
+ httpthumbnailer (~> 0.2)
82
84
  httpthumbnailer-client (~> 0.1.0)
83
85
  jeweler (~> 1.6.4)
84
86
  mime-types (~> 1.17.2)
85
87
  mongrel (>= 1.2.0.pre2)
86
88
  prawn (= 0.8.4)
87
- rcov
88
89
  rdoc (~> 3.9)
89
90
  retry-this (~> 1.1)
90
91
  rspec (~> 2.8.0)
91
92
  ruby-ip (~> 0.9)
92
93
  s3 (~> 0.3)
94
+ simplecov
93
95
  sinatra (>= 1.2.6)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
data/bin/httpimagestore CHANGED
@@ -55,13 +55,6 @@ class ThumbnailingError < RuntimeError
55
55
  attr_reader :remote_error
56
56
  end
57
57
 
58
- sinatra.before do
59
- logger.level = Logger::DEBUG if settings.logging and settings.debug
60
- # singletons
61
- $s3 ||= S3Service.new(settings.s3_key_id, settings.s3_key_secret, settings.s3_bucket, :logger => logger, :upload_retry_times => settings.upload_retry_times, :upload_retry_delay => settings.upload_retry_delay)
62
- $thumbnailer ||= HTTPThumbnailerClient.new(settings.thumbnailer_url)
63
- end
64
-
65
58
  sinatra.helpers do
66
59
  def hatl_response(status, msg)
67
60
  headers "Content-Type" => "text/plain"
@@ -70,7 +63,13 @@ sinatra.helpers do
70
63
  end
71
64
 
72
65
  def halt_exception(status, exception)
73
- hatl_response(status, "Error: #{exception.class.name}: #{exception}")
66
+ msg = "Error: #{exception.class.name}: #{exception}"
67
+ if status >= 500
68
+ logger.error msg
69
+ else
70
+ logger.warn msg
71
+ end
72
+ hatl_response(status, msg)
74
73
  end
75
74
 
76
75
  def digest(data)
@@ -78,6 +77,17 @@ sinatra.helpers do
78
77
  end
79
78
  end
80
79
 
80
+ sinatra.before do
81
+ begin
82
+ logger.level = Logger::DEBUG if settings.logging and settings.debug
83
+ # singletons
84
+ $s3 ||= S3Service.new(settings.s3_key_id, settings.s3_key_secret, settings.s3_bucket, :logger => logger, :upload_retry_times => settings.upload_retry_times, :upload_retry_delay => settings.upload_retry_delay)
85
+ $thumbnailer ||= HTTPThumbnailerClient.new(settings.thumbnailer_url)
86
+ rescue => exception
87
+ halt_exception(500, exception)
88
+ end
89
+ end
90
+
81
91
  sinatra.get '/' do
82
92
  "hello"
83
93
  end
@@ -130,12 +140,12 @@ end
130
140
 
131
141
  # problem with singe thumbnail
132
142
  sinatra.error ThumbnailingError do
133
- e = env['sinatra.error']
134
- case e.remote_error.type
143
+ exception = env['sinatra.error']
144
+ case exception.remote_error.type
135
145
  when "Thumbnailer::ImageTooLargeError"
136
- halt_exception(413, e)
146
+ halt_exception(413, exception)
137
147
  else
138
- halt_exception(500, e)
148
+ halt_exception(500, exception)
139
149
  end
140
150
  end
141
151
 
@@ -20,6 +20,7 @@ Feature: Storing of original image and specified classes of its thumbnails on S3
20
20
  Given httpthumbnailer log is empty
21
21
  Given httpthumbnailer server is running at http://localhost:3100/
22
22
  Given issthumbtest S3 bucket with key AKIAJMUYVYOSACNXLPTQ and secret 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
23
+ Given Content-Type header set to image/autodetect
23
24
 
24
25
  Scenario: Putting original and its thumbnails to S3 bucket
25
26
  Given there is no 4006450256177f4a.jpg file in S3 bucket
@@ -25,11 +25,13 @@ Given /httpthumbnailer server is running at (.*)/ do |url|
25
25
  end
26
26
 
27
27
  Given /httpimagestore log is empty/ do
28
- (support_dir + 'server.log').truncate(0)
28
+ log = support_dir + 'server.log'
29
+ log.truncate(0) if log.exist?
29
30
  end
30
31
 
31
32
  Given /httpthumbnailer log is empty/ do
32
- (support_dir + 'thumbniler.log').truncate(0)
33
+ log = support_dir + 'thumbniler.log'
34
+ log.truncate(0) if log.exist?
33
35
  end
34
36
 
35
37
  Given /(.*) file content as request body/ do |file|
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "httpimagestore"
8
- s.version = "0.3.1"
8
+ s.version = "0.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jakub Pastuszek"]
12
- s.date = "2012-08-20"
12
+ s.date = "2012-09-05"
13
13
  s.description = "Thumbnails images using httpthumbnailer and stored data on HTTP server (S3)"
14
14
  s.email = "jpastuszek@gmail.com"
15
15
  s.executables = ["httpimagestore"]
@@ -64,10 +64,10 @@ Gem::Specification.new do |s|
64
64
  s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
65
65
  s.add_development_dependency(%q<cucumber>, [">= 0"])
66
66
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
67
- s.add_development_dependency(%q<rcov>, [">= 0"])
67
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
68
68
  s.add_development_dependency(%q<rdoc>, ["~> 3.9"])
69
69
  s.add_development_dependency(%q<daemon>, ["~> 1"])
70
- s.add_development_dependency(%q<httpthumbnailer>, ["~> 0.1.0"])
70
+ s.add_development_dependency(%q<httpthumbnailer>, ["~> 0.2"])
71
71
  s.add_development_dependency(%q<prawn>, ["= 0.8.4"])
72
72
  else
73
73
  s.add_dependency(%q<sinatra>, [">= 1.2.6"])
@@ -81,10 +81,10 @@ Gem::Specification.new do |s|
81
81
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
82
82
  s.add_dependency(%q<cucumber>, [">= 0"])
83
83
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
84
- s.add_dependency(%q<rcov>, [">= 0"])
84
+ s.add_dependency(%q<simplecov>, [">= 0"])
85
85
  s.add_dependency(%q<rdoc>, ["~> 3.9"])
86
86
  s.add_dependency(%q<daemon>, ["~> 1"])
87
- s.add_dependency(%q<httpthumbnailer>, ["~> 0.1.0"])
87
+ s.add_dependency(%q<httpthumbnailer>, ["~> 0.2"])
88
88
  s.add_dependency(%q<prawn>, ["= 0.8.4"])
89
89
  end
90
90
  else
@@ -99,10 +99,10 @@ Gem::Specification.new do |s|
99
99
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
100
100
  s.add_dependency(%q<cucumber>, [">= 0"])
101
101
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
102
- s.add_dependency(%q<rcov>, [">= 0"])
102
+ s.add_dependency(%q<simplecov>, [">= 0"])
103
103
  s.add_dependency(%q<rdoc>, ["~> 3.9"])
104
104
  s.add_dependency(%q<daemon>, ["~> 1"])
105
- s.add_dependency(%q<httpthumbnailer>, ["~> 0.1.0"])
105
+ s.add_dependency(%q<httpthumbnailer>, ["~> 0.2"])
106
106
  s.add_dependency(%q<prawn>, ["= 0.8.4"])
107
107
  end
108
108
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpimagestore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-20 00:00:00.000000000 Z
12
+ date: 2012-09-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
@@ -188,7 +188,7 @@ dependencies:
188
188
  - !ruby/object:Gem::Version
189
189
  version: 1.6.4
190
190
  - !ruby/object:Gem::Dependency
191
- name: rcov
191
+ name: simplecov
192
192
  requirement: !ruby/object:Gem::Requirement
193
193
  none: false
194
194
  requirements:
@@ -242,7 +242,7 @@ dependencies:
242
242
  requirements:
243
243
  - - ~>
244
244
  - !ruby/object:Gem::Version
245
- version: 0.1.0
245
+ version: '0.2'
246
246
  type: :development
247
247
  prerelease: false
248
248
  version_requirements: !ruby/object:Gem::Requirement
@@ -250,7 +250,7 @@ dependencies:
250
250
  requirements:
251
251
  - - ~>
252
252
  - !ruby/object:Gem::Version
253
- version: 0.1.0
253
+ version: '0.2'
254
254
  - !ruby/object:Gem::Dependency
255
255
  name: prawn
256
256
  requirement: !ruby/object:Gem::Requirement
@@ -316,7 +316,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
316
316
  version: '0'
317
317
  segments:
318
318
  - 0
319
- hash: 4193891708801063626
319
+ hash: -3544343476789840343
320
320
  required_rubygems_version: !ruby/object:Gem::Requirement
321
321
  none: false
322
322
  requirements: