imageproxy 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
data/imageproxy.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "imageproxy"
8
- s.version = "0.4.0"
8
+ s.version = "0.4.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Erik Hanson"]
12
- s.date = "2012-05-16"
12
+ s.date = "2012-07-24"
13
13
  s.description = "A image processing proxy server, written in Ruby as a Rack application. Requires ImageMagick."
14
14
  s.email = "erik@eahanson.com"
15
15
  s.extra_rdoc_files = [
@@ -50,7 +50,7 @@ Gem::Specification.new do |s|
50
50
  s.homepage = "http://github.com/eahanson/imageproxy"
51
51
  s.licenses = ["MIT"]
52
52
  s.require_paths = ["lib"]
53
- s.rubygems_version = "1.8.12"
53
+ s.rubygems_version = "1.8.24"
54
54
  s.summary = "A image processing proxy server, written in Ruby as a Rack application."
55
55
 
56
56
  if s.respond_to? :specification_version then
@@ -4,7 +4,10 @@ module Imageproxy
4
4
 
5
5
  def execute_command(command_line)
6
6
  stdin, stdout, stderr, wait_thr = Open3.popen3(command_line)
7
- raise "Child process exited with non-zero exit code" unless wait_thr.nil? || wait_thr.value.success?
7
+ unless wait_thr.nil? || wait_thr.value.success?
8
+ $stderr.puts output_to_string(stderr)
9
+ raise "Child process exited with non-zero exit code"
10
+ end
8
11
  [output_to_string(stdout), output_to_string(stderr)].join("")
9
12
  end
10
13
 
@@ -43,6 +43,16 @@ module Imageproxy
43
43
  @hash[symbol.to_s] || @hash[symbol]
44
44
  end
45
45
 
46
+ def to_s
47
+ @hash.map do |key, value|
48
+ if key && value
49
+ "#{CGI::escape(key)}=#{CGI::escape(value)}"
50
+ else
51
+ nil
52
+ end
53
+ end.compact.join(', ')
54
+ end
55
+
46
56
  private
47
57
 
48
58
  def unescape_source
@@ -42,6 +42,7 @@ module Imageproxy
42
42
  @file_server.call(env)
43
43
  end
44
44
  rescue
45
+ STDERR.puts "Request failed: #{options}"
45
46
  STDERR.puts $!
46
47
  STDERR.puts $!.backtrace.join("\n") if config?(:verbose)
47
48
  [500, {"Content-Type" => "text/plain"}, ["Error (#{$!})"]]
data/spec/options_spec.rb CHANGED
@@ -89,6 +89,29 @@ describe Imageproxy::Options do
89
89
  end
90
90
  end
91
91
 
92
+ describe "#to_s" do
93
+ it "should show all the options" do
94
+ options = Imageproxy::Options.new "/convert", { "resize" => "20x20" }
95
+ options.to_s.should == "command=convert, resize=20x20"
96
+ end
97
+
98
+ it "should show all the options even if there is obfuscation" do
99
+ encoded = CGI.escape(Base64.encode64("resize=20x20&source=http://example.com/dog.jpg"))
100
+ options = Imageproxy::Options.new "/convert", "_" => encoded
101
+ options.to_s.should == "command=convert, resize=20x20, source=http%3A%2F%2Fexample.com%2Fdog.jpg"
102
+ end
103
+
104
+ it "should be OK with a nil key" do
105
+ options = Imageproxy::Options.new "/convert", { nil => "20x20" }
106
+ options.to_s.should == "command=convert"
107
+ end
108
+
109
+ it "should be OK with a nil value" do
110
+ options = Imageproxy::Options.new "", {}
111
+ options.to_s.should == ""
112
+ end
113
+ end
114
+
92
115
  describe "quality" do
93
116
  it "should be set to 0 if it's less than 0" do
94
117
  Imageproxy::Options.new("/convert", "quality" => "-39").quality.should == "0"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imageproxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-16 00:00:00.000000000Z
12
+ date: 2012-07-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
16
- requirement: &18224420 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *18224420
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rake
27
- requirement: &18223400 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *18223400
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: mime-types
38
- requirement: &18222140 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: '0'
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *18222140
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: heroku
49
- requirement: &18220740 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ! '>='
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: '0'
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *18220740
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: shotgun
60
- requirement: &18219680 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ! '>='
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: '0'
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *18219680
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: rspec
71
- requirement: &18218480 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ! '>='
@@ -76,10 +101,15 @@ dependencies:
76
101
  version: '0'
77
102
  type: :development
78
103
  prerelease: false
79
- version_requirements: *18218480
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
80
110
  - !ruby/object:Gem::Dependency
81
111
  name: rack-test
82
- requirement: &18214760 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
83
113
  none: false
84
114
  requirements:
85
115
  - - ! '>='
@@ -87,10 +117,15 @@ dependencies:
87
117
  version: '0'
88
118
  type: :development
89
119
  prerelease: false
90
- version_requirements: *18214760
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
91
126
  - !ruby/object:Gem::Dependency
92
127
  name: awesome_print
93
- requirement: &18213580 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
94
129
  none: false
95
130
  requirements:
96
131
  - - ! '>='
@@ -98,10 +133,15 @@ dependencies:
98
133
  version: '0'
99
134
  type: :development
100
135
  prerelease: false
101
- version_requirements: *18213580
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
102
142
  - !ruby/object:Gem::Dependency
103
143
  name: jeweler
104
- requirement: &18212420 !ruby/object:Gem::Requirement
144
+ requirement: !ruby/object:Gem::Requirement
105
145
  none: false
106
146
  requirements:
107
147
  - - ! '>='
@@ -109,7 +149,12 @@ dependencies:
109
149
  version: '0'
110
150
  type: :development
111
151
  prerelease: false
112
- version_requirements: *18212420
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
113
158
  description: A image processing proxy server, written in Ruby as a Rack application.
114
159
  Requires ImageMagick.
115
160
  email: erik@eahanson.com
@@ -163,7 +208,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
163
208
  version: '0'
164
209
  segments:
165
210
  - 0
166
- hash: 2692885004862731431
211
+ hash: 3458948603279650035
167
212
  required_rubygems_version: !ruby/object:Gem::Requirement
168
213
  none: false
169
214
  requirements:
@@ -172,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
217
  version: '0'
173
218
  requirements: []
174
219
  rubyforge_project:
175
- rubygems_version: 1.8.12
220
+ rubygems_version: 1.8.24
176
221
  signing_key:
177
222
  specification_version: 3
178
223
  summary: A image processing proxy server, written in Ruby as a Rack application.