httpimagestore 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/httpimagestore +3 -1
- data/features/httpimagestore.feature +8 -1
- data/features/step_definitions/httpimagestore_steps.rb +19 -4
- data/httpimagestore.gemspec +1 -2
- metadata +3 -4
- data/features/support/test.cfg +0 -6
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/bin/httpimagestore
CHANGED
@@ -83,7 +83,9 @@ sinatra.put %r{/thumbnail/([^/]*)/(.*)} do |classes, image_path|
|
|
83
83
|
urls << @s3.put_image(Pathname.new(image_path).thumbnail_image(image_hash, thumbnail_class.name).to_s, thumb.mime_type, thumb.data)
|
84
84
|
end
|
85
85
|
|
86
|
-
|
86
|
+
status 200
|
87
|
+
headers "Content-Type" => "text/uri-list"
|
88
|
+
body urls.map{|u| u + "\r\n"}.join
|
87
89
|
end
|
88
90
|
|
89
91
|
sinatra.error do
|
@@ -17,9 +17,16 @@ Feature: Original image and it's thumnails generation and storing on S2
|
|
17
17
|
Scenario: Putting thumbnails and original to S3 bucket
|
18
18
|
Given test.jpg file content as request body
|
19
19
|
When I do PUT request http://localhost:3000/thumbnail/small,tiny/test/image/test.jpg
|
20
|
-
Then
|
20
|
+
Then response status will be 200
|
21
|
+
And response content type will be text/uri-list
|
22
|
+
And response body will be CRLF endend lines
|
21
23
|
"""
|
22
24
|
http://rhthumbnails.s3.amazonaws.com/test/image/4006450256177f4a/test.jpg
|
23
25
|
http://rhthumbnails.s3.amazonaws.com/test/image/4006450256177f4a/test-small.jpg
|
24
26
|
http://rhthumbnails.s3.amazonaws.com/test/image/4006450256177f4a/test-tiny.jpg
|
27
|
+
|
25
28
|
"""
|
29
|
+
And http://rhthumbnails.s3.amazonaws.com/test/image/4006450256177f4a/test.jpg will contain JPEG image of size 509x719
|
30
|
+
And http://rhthumbnails.s3.amazonaws.com/test/image/4006450256177f4a/test-small.jpg will contain JPEG image of size 128x128
|
31
|
+
And http://rhthumbnails.s3.amazonaws.com/test/image/4006450256177f4a/test-tiny.jpg will contain JPEG image of size 32x32
|
32
|
+
|
@@ -32,11 +32,26 @@ When /I do (.*) request (.*)/ do |method, uri|
|
|
32
32
|
@response = HTTPClient.new.request(method, uri, nil, @request_body)
|
33
33
|
end
|
34
34
|
|
35
|
-
Then /
|
36
|
-
@response.
|
35
|
+
Then /response status will be (.*)/ do |status|
|
36
|
+
@response.status.should == status.to_i
|
37
37
|
end
|
38
38
|
|
39
|
-
Then /
|
40
|
-
@response.
|
39
|
+
Then /response content type will be (.*)/ do |content_type|
|
40
|
+
@response.header['Content-Type'].first.should == content_type
|
41
|
+
end
|
42
|
+
|
43
|
+
Then /response body will be CRLF endend lines/ do |body|
|
44
|
+
@response.body.should == body.gsub!("\n", "\r\n")
|
45
|
+
end
|
46
|
+
|
47
|
+
Then /(.*) will contain (.*) image of size (.*)/ do |url, image_type, image_size|
|
48
|
+
data = get(url)
|
49
|
+
Open3.popen3('identify -') do |stdin, stdout, stderr|
|
50
|
+
stdin.write data
|
51
|
+
stdin.close
|
52
|
+
path, type, size, *rest = *stdout.read.split(' ')
|
53
|
+
type.should == image_type
|
54
|
+
size.should == image_size
|
55
|
+
end
|
41
56
|
end
|
42
57
|
|
data/httpimagestore.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "httpimagestore"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.3"
|
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"]
|
@@ -30,7 +30,6 @@ Gem::Specification.new do |s|
|
|
30
30
|
"features/httpimagestore.feature",
|
31
31
|
"features/step_definitions/httpimagestore_steps.rb",
|
32
32
|
"features/support/env.rb",
|
33
|
-
"features/support/test.cfg",
|
34
33
|
"features/support/test.jpg",
|
35
34
|
"httpimagestore.gemspec",
|
36
35
|
"lib/httpimagestore/configuration.rb",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: httpimagestore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jakub Pastuszek
|
@@ -223,7 +223,6 @@ files:
|
|
223
223
|
- features/httpimagestore.feature
|
224
224
|
- features/step_definitions/httpimagestore_steps.rb
|
225
225
|
- features/support/env.rb
|
226
|
-
- features/support/test.cfg
|
227
226
|
- features/support/test.jpg
|
228
227
|
- httpimagestore.gemspec
|
229
228
|
- lib/httpimagestore/configuration.rb
|