magickly 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -4,8 +4,7 @@ source 'http://rubygems.org'
4
4
  # gem 'activesupport', '>= 2.3.5'
5
5
 
6
6
  gem 'sinatra', '~> 1.2.1', :require => 'sinatra/base'
7
- gem 'rack-cache', :require => 'rack/cache'
8
- gem 'dragonfly', '~> 0.8'
7
+ gem 'dragonfly', '~> 0.9.1'
9
8
  gem 'addressable', '~> 2.2', :require => 'addressable/uri'
10
9
 
11
10
  gem 'haml', '~> 3.0.25'
@@ -27,3 +26,7 @@ group :development, :test do
27
26
  gem 'ruby-debug19', :platforms => :ruby_19
28
27
  gem 'ruby-debug', :platforms => :ruby_18
29
28
  end
29
+
30
+ group :production do
31
+ gem 'newrelic_rpm', :require => false
32
+ end
data/Gemfile.lock CHANGED
@@ -7,7 +7,7 @@ GEM
7
7
  columnize (0.3.2)
8
8
  crack (0.1.8)
9
9
  diff-lcs (1.1.2)
10
- dragonfly (0.9.0)
10
+ dragonfly (0.9.1)
11
11
  rack
12
12
  rack
13
13
  git (1.2.5)
@@ -22,9 +22,8 @@ GEM
22
22
  linecache (0.43)
23
23
  linecache19 (0.5.12)
24
24
  ruby_core_source (>= 0.1.4)
25
+ newrelic_rpm (2.14.1)
25
26
  rack (1.2.2)
26
- rack-cache (1.0)
27
- rack (>= 0.4)
28
27
  rack-test (0.5.7)
29
28
  rack (>= 1.0)
30
29
  rake (0.8.7)
@@ -66,12 +65,12 @@ PLATFORMS
66
65
  DEPENDENCIES
67
66
  activesupport (>= 2.0.0)
68
67
  addressable (~> 2.2)
69
- dragonfly (~> 0.8)
68
+ dragonfly (~> 0.9.1)
70
69
  haml (~> 3.0.25)
71
70
  httparty (~> 0.7.3)
72
71
  imagesize (~> 0.1)
73
72
  jeweler (~> 1.5)
74
- rack-cache
73
+ newrelic_rpm
75
74
  rack-test
76
75
  rcov
77
76
  rspec (~> 2.4)
data/HISTORY.md CHANGED
@@ -1,3 +1,13 @@
1
+ This gem respects [semantic versioning](http://semver.org/).
2
+
3
+ # 1.1.2 (5/16/11)
4
+
5
+ * remove rack-cache - this is not the responsibility of the gem
6
+ * use NewRelic, if configured
7
+ * ignore params that do not correspond to jobs or processor methods
8
+ * get job/processor commands from Dragonfly (new in v0.9.1)
9
+ * enable tilt_shift shortcut (possible after `convert` argument order change in Dragonfly v0.9.0)
10
+
1
11
  # 1.1.1 (4/28/11)
2
12
 
3
13
  * cross-compatibility fix for Ruby 1.8/1.9 regarding the checking of available methods from the Processor
data/README.md CHANGED
@@ -88,7 +88,7 @@ The app can be accessed at [http://localhost:4567](http://localhost:4567)
88
88
  As an example, to have magickly accessible at `/magickly` in a Rails app:
89
89
 
90
90
  # Gemfile
91
- gem 'magickly', '~> 0.1'
91
+ gem 'magickly', '~> 1.1'
92
92
 
93
93
  # config/routes.rb
94
94
  match '/magickly', :to => Magickly::App, :anchor => false
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.1
1
+ 1.1.2
data/lib/magickly.rb CHANGED
@@ -15,8 +15,6 @@ module Magickly
15
15
  c.log = Logger.new($stdout)
16
16
  end
17
17
 
18
- DRAGONFLY_PROCESSOR_FUNCTIONS = @dragonfly.processor.functions.keys
19
-
20
18
  class << self
21
19
  def dragonfly
22
20
  @dragonfly
@@ -32,13 +30,16 @@ module Magickly
32
30
 
33
31
  def process_image(image, options={})
34
32
  options.each do |method, val|
35
- if !DRAGONFLY_PROCESSOR_FUNCTIONS.include?(method.to_sym)
36
- # might be an app-defined dragonfly shortcut
33
+ method = method.to_sym
34
+ if Magickly.dragonfly.processor_methods.include?(method)
35
+ if val == 'true'
36
+ image = image.process method
37
+ else
38
+ image = image.process method, val
39
+ end
40
+ elsif Magickly.dragonfly.job_methods.include?(method)
41
+ # note: might be an app-defined dragonfly shortcut
37
42
  image = image.send(method, val)
38
- elsif val == 'true'
39
- image = image.process method
40
- else
41
- image = image.process method, val
42
43
  end
43
44
  end
44
45
 
data/lib/magickly/app.rb CHANGED
@@ -6,6 +6,11 @@ module Magickly
6
6
  set :root, File.join(File.dirname(__FILE__), '..')
7
7
  set :homepage, "http://github.com/afeld/magickly"
8
8
 
9
+ configure :production do
10
+ require 'newrelic_rpm' if ENV['NEW_RELIC_ID']
11
+ end
12
+
13
+
9
14
  before do
10
15
  Magickly.dragonfly.datastore.configure do |d|
11
16
  # pass cookies to subsequent request
@@ -23,6 +28,8 @@ module Magickly
23
28
  src = params['src']
24
29
 
25
30
  if src
31
+ # process image
32
+
26
33
  uri = Addressable::URI.parse(src)
27
34
  uri.site ||= Addressable::URI.parse(request.url).site
28
35
 
@@ -31,9 +38,8 @@ module Magickly
31
38
  else
32
39
  # display demo page
33
40
 
34
- # fallback for Dragonfly v0.8.2 and below
35
- klass = Dragonfly::ImageMagick::Processor rescue Dragonfly::Processing::ImageMagickProcessor
36
- @methods = klass.instance_methods(false)
41
+ # get combined list of jobs and processor methods
42
+ @methods = ( Magickly.dragonfly.job_methods | Magickly.dragonfly.processor_methods )
37
43
  haml :index
38
44
  end
39
45
  end
@@ -43,8 +49,8 @@ module Magickly
43
49
  end
44
50
  end
45
51
 
52
+ # <b>DEPRECATED:</b> Please use <tt>Magickly::App</tt> instead.
46
53
  class MagicklyApp < Magickly::App
47
- # <b>DEPRECATED:</b> Please use <tt>Magickly::App</tt> instead.
48
54
  def self.run
49
55
  warn "This has been deprecated - please use Magickly::App.run"
50
56
  super
data/lib/shortcuts.rb CHANGED
@@ -3,15 +3,13 @@ Magickly.dragonfly.configure do |c|
3
3
  process :convert, "-filter Gaussian -resize #{size}"
4
4
  end
5
5
 
6
- # Dragonfly currently chokes on this command - see pull request #73:
7
- # https://github.com/markevans/dragonfly/pull/73
8
- #
9
- # c.job :tilt_shift do |coefficients|
10
- # if coefficients == 'true'
11
- # coefficients = "2,-2,0.5"
12
- # end
13
- #
14
- # action = "\\( +clone -sparse-color Barycentric '0,0 black 0,%[fx:h-1] white' -function polynomial #{coefficients} \\) -compose Blur -set option:compose:args 15 -composite"
15
- # process :convert, action
16
- # end
6
+ c.job :tilt_shift do |coefficients|
7
+ if coefficients == 'true'
8
+ # use default polynomial coefficients
9
+ coefficients = "2,-2,0.5"
10
+ end
11
+
12
+ action = "\\( +clone -sparse-color Barycentric '0,0 black 0,%[fx:h-1] white' -function polynomial #{coefficients} \\) -compose Blur -set option:compose:args 15 -composite"
13
+ process :convert, action
14
+ end
17
15
  end
data/magickly.gemspec CHANGED
@@ -5,15 +5,14 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{magickly}
8
- s.version = "1.1.1"
8
+ s.version = "1.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Aidan Feldman"]
12
- s.date = %q{2011-04-28}
13
- s.default_executable = %q{magickly}
11
+ s.authors = [%q{Aidan Feldman}]
12
+ s.date = %q{2011-05-16}
14
13
  s.description = %q{A service for image manipulation - built as an extensible wrapper of Imagemagick which handles caching, c/o the Dragonfly gem.}
15
14
  s.email = %q{aidan.feldman@gmail.com}
16
- s.executables = ["magickly"]
15
+ s.executables = [%q{magickly}]
17
16
  s.extra_rdoc_files = [
18
17
  "LICENSE.txt",
19
18
  "README.md"
@@ -45,9 +44,9 @@ Gem::Specification.new do |s|
45
44
  "spec/unit/remote_data_store_spec.rb"
46
45
  ]
47
46
  s.homepage = %q{http://github.com/afeld/magickly}
48
- s.licenses = ["MIT"]
49
- s.require_paths = ["lib"]
50
- s.rubygems_version = %q{1.6.2}
47
+ s.licenses = [%q{MIT}]
48
+ s.require_paths = [%q{lib}]
49
+ s.rubygems_version = %q{1.8.2}
51
50
  s.summary = %q{image manipulation as a (plugin-able) service}
52
51
  s.test_files = [
53
52
  "spec/requests/magickly_app_spec.rb",
@@ -61,8 +60,7 @@ Gem::Specification.new do |s|
61
60
 
62
61
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
63
62
  s.add_runtime_dependency(%q<sinatra>, ["~> 1.2.1"])
64
- s.add_runtime_dependency(%q<rack-cache>, [">= 0"])
65
- s.add_runtime_dependency(%q<dragonfly>, ["~> 0.8"])
63
+ s.add_runtime_dependency(%q<dragonfly>, ["~> 0.9.1"])
66
64
  s.add_runtime_dependency(%q<addressable>, ["~> 2.2"])
67
65
  s.add_runtime_dependency(%q<haml>, ["~> 3.0.25"])
68
66
  s.add_runtime_dependency(%q<httparty>, ["~> 0.7.3"])
@@ -77,8 +75,7 @@ Gem::Specification.new do |s|
77
75
  s.add_development_dependency(%q<ruby-debug>, [">= 0"])
78
76
  else
79
77
  s.add_dependency(%q<sinatra>, ["~> 1.2.1"])
80
- s.add_dependency(%q<rack-cache>, [">= 0"])
81
- s.add_dependency(%q<dragonfly>, ["~> 0.8"])
78
+ s.add_dependency(%q<dragonfly>, ["~> 0.9.1"])
82
79
  s.add_dependency(%q<addressable>, ["~> 2.2"])
83
80
  s.add_dependency(%q<haml>, ["~> 3.0.25"])
84
81
  s.add_dependency(%q<httparty>, ["~> 0.7.3"])
@@ -94,8 +91,7 @@ Gem::Specification.new do |s|
94
91
  end
95
92
  else
96
93
  s.add_dependency(%q<sinatra>, ["~> 1.2.1"])
97
- s.add_dependency(%q<rack-cache>, [">= 0"])
98
- s.add_dependency(%q<dragonfly>, ["~> 0.8"])
94
+ s.add_dependency(%q<dragonfly>, ["~> 0.9.1"])
99
95
  s.add_dependency(%q<addressable>, ["~> 2.2"])
100
96
  s.add_dependency(%q<haml>, ["~> 3.0.25"])
101
97
  s.add_dependency(%q<httparty>, ["~> 0.7.3"])
@@ -33,6 +33,18 @@ describe Magickly::App do
33
33
  compare_binary(last_response.body, IO.read(@image_path))
34
34
  end
35
35
 
36
+ it "should ignore unused params" do
37
+ setup_image
38
+
39
+ get "/?src=#{@image_url}&bad_param=666"
40
+
41
+ a_request(:get, @image_url).should have_been_made.once
42
+ last_response.should be_ok
43
+
44
+ # check that the returned file is identical to the original
45
+ compare_binary(last_response.body, IO.read(@image_path))
46
+ end
47
+
36
48
  it "retrieves an image at a relative URI" do
37
49
  setup_image "http://#{Rack::Test::DEFAULT_HOST}"
38
50
 
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magickly
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 23
4
5
  prerelease:
5
- version: 1.1.1
6
+ segments:
7
+ - 1
8
+ - 1
9
+ - 2
10
+ version: 1.1.2
6
11
  platform: ruby
7
12
  authors:
8
13
  - Aidan Feldman
@@ -10,174 +15,219 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-04-28 00:00:00 -04:00
14
- default_executable: magickly
18
+ date: 2011-05-16 00:00:00 Z
15
19
  dependencies:
16
20
  - !ruby/object:Gem::Dependency
17
- name: sinatra
18
- requirement: &id001 !ruby/object:Gem::Requirement
21
+ version_requirements: &id001 !ruby/object:Gem::Requirement
19
22
  none: false
20
23
  requirements:
21
24
  - - ~>
22
25
  - !ruby/object:Gem::Version
26
+ hash: 29
27
+ segments:
28
+ - 1
29
+ - 2
30
+ - 1
23
31
  version: 1.2.1
24
32
  type: :runtime
33
+ requirement: *id001
25
34
  prerelease: false
26
- version_requirements: *id001
35
+ name: sinatra
27
36
  - !ruby/object:Gem::Dependency
28
- name: rack-cache
29
- requirement: &id002 !ruby/object:Gem::Requirement
30
- none: false
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: "0"
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: dragonfly
40
- requirement: &id003 !ruby/object:Gem::Requirement
37
+ version_requirements: &id002 !ruby/object:Gem::Requirement
41
38
  none: false
42
39
  requirements:
43
40
  - - ~>
44
41
  - !ruby/object:Gem::Version
45
- version: "0.8"
42
+ hash: 57
43
+ segments:
44
+ - 0
45
+ - 9
46
+ - 1
47
+ version: 0.9.1
46
48
  type: :runtime
49
+ requirement: *id002
47
50
  prerelease: false
48
- version_requirements: *id003
51
+ name: dragonfly
49
52
  - !ruby/object:Gem::Dependency
50
- name: addressable
51
- requirement: &id004 !ruby/object:Gem::Requirement
53
+ version_requirements: &id003 !ruby/object:Gem::Requirement
52
54
  none: false
53
55
  requirements:
54
56
  - - ~>
55
57
  - !ruby/object:Gem::Version
58
+ hash: 7
59
+ segments:
60
+ - 2
61
+ - 2
56
62
  version: "2.2"
57
63
  type: :runtime
64
+ requirement: *id003
58
65
  prerelease: false
59
- version_requirements: *id004
66
+ name: addressable
60
67
  - !ruby/object:Gem::Dependency
61
- name: haml
62
- requirement: &id005 !ruby/object:Gem::Requirement
68
+ version_requirements: &id004 !ruby/object:Gem::Requirement
63
69
  none: false
64
70
  requirements:
65
71
  - - ~>
66
72
  - !ruby/object:Gem::Version
73
+ hash: 53
74
+ segments:
75
+ - 3
76
+ - 0
77
+ - 25
67
78
  version: 3.0.25
68
79
  type: :runtime
80
+ requirement: *id004
69
81
  prerelease: false
70
- version_requirements: *id005
82
+ name: haml
71
83
  - !ruby/object:Gem::Dependency
72
- name: httparty
73
- requirement: &id006 !ruby/object:Gem::Requirement
84
+ version_requirements: &id005 !ruby/object:Gem::Requirement
74
85
  none: false
75
86
  requirements:
76
87
  - - ~>
77
88
  - !ruby/object:Gem::Version
89
+ hash: 5
90
+ segments:
91
+ - 0
92
+ - 7
93
+ - 3
78
94
  version: 0.7.3
79
95
  type: :runtime
96
+ requirement: *id005
80
97
  prerelease: false
81
- version_requirements: *id006
98
+ name: httparty
82
99
  - !ruby/object:Gem::Dependency
83
- name: activesupport
84
- requirement: &id007 !ruby/object:Gem::Requirement
100
+ version_requirements: &id006 !ruby/object:Gem::Requirement
85
101
  none: false
86
102
  requirements:
87
103
  - - ">="
88
104
  - !ruby/object:Gem::Version
105
+ hash: 15
106
+ segments:
107
+ - 2
108
+ - 0
109
+ - 0
89
110
  version: 2.0.0
90
111
  type: :runtime
112
+ requirement: *id006
91
113
  prerelease: false
92
- version_requirements: *id007
114
+ name: activesupport
93
115
  - !ruby/object:Gem::Dependency
94
- name: jeweler
95
- requirement: &id008 !ruby/object:Gem::Requirement
116
+ version_requirements: &id007 !ruby/object:Gem::Requirement
96
117
  none: false
97
118
  requirements:
98
119
  - - ~>
99
120
  - !ruby/object:Gem::Version
121
+ hash: 5
122
+ segments:
123
+ - 1
124
+ - 5
100
125
  version: "1.5"
101
126
  type: :development
127
+ requirement: *id007
102
128
  prerelease: false
103
- version_requirements: *id008
129
+ name: jeweler
104
130
  - !ruby/object:Gem::Dependency
105
- name: rcov
106
- requirement: &id009 !ruby/object:Gem::Requirement
131
+ version_requirements: &id008 !ruby/object:Gem::Requirement
107
132
  none: false
108
133
  requirements:
109
134
  - - ">="
110
135
  - !ruby/object:Gem::Version
136
+ hash: 3
137
+ segments:
138
+ - 0
111
139
  version: "0"
112
140
  type: :development
141
+ requirement: *id008
113
142
  prerelease: false
114
- version_requirements: *id009
143
+ name: rcov
115
144
  - !ruby/object:Gem::Dependency
116
- name: rack-test
117
- requirement: &id010 !ruby/object:Gem::Requirement
145
+ version_requirements: &id009 !ruby/object:Gem::Requirement
118
146
  none: false
119
147
  requirements:
120
148
  - - ">="
121
149
  - !ruby/object:Gem::Version
150
+ hash: 3
151
+ segments:
152
+ - 0
122
153
  version: "0"
123
154
  type: :development
155
+ requirement: *id009
124
156
  prerelease: false
125
- version_requirements: *id010
157
+ name: rack-test
126
158
  - !ruby/object:Gem::Dependency
127
- name: rspec
128
- requirement: &id011 !ruby/object:Gem::Requirement
159
+ version_requirements: &id010 !ruby/object:Gem::Requirement
129
160
  none: false
130
161
  requirements:
131
162
  - - ~>
132
163
  - !ruby/object:Gem::Version
164
+ hash: 11
165
+ segments:
166
+ - 2
167
+ - 4
133
168
  version: "2.4"
134
169
  type: :development
170
+ requirement: *id010
135
171
  prerelease: false
136
- version_requirements: *id011
172
+ name: rspec
137
173
  - !ruby/object:Gem::Dependency
138
- name: webmock
139
- requirement: &id012 !ruby/object:Gem::Requirement
174
+ version_requirements: &id011 !ruby/object:Gem::Requirement
140
175
  none: false
141
176
  requirements:
142
177
  - - ~>
143
178
  - !ruby/object:Gem::Version
179
+ hash: 3
180
+ segments:
181
+ - 1
182
+ - 6
144
183
  version: "1.6"
145
184
  type: :development
185
+ requirement: *id011
146
186
  prerelease: false
147
- version_requirements: *id012
187
+ name: webmock
148
188
  - !ruby/object:Gem::Dependency
149
- name: imagesize
150
- requirement: &id013 !ruby/object:Gem::Requirement
189
+ version_requirements: &id012 !ruby/object:Gem::Requirement
151
190
  none: false
152
191
  requirements:
153
192
  - - ~>
154
193
  - !ruby/object:Gem::Version
194
+ hash: 9
195
+ segments:
196
+ - 0
197
+ - 1
155
198
  version: "0.1"
156
199
  type: :development
200
+ requirement: *id012
157
201
  prerelease: false
158
- version_requirements: *id013
202
+ name: imagesize
159
203
  - !ruby/object:Gem::Dependency
160
- name: ruby-debug19
161
- requirement: &id014 !ruby/object:Gem::Requirement
204
+ version_requirements: &id013 !ruby/object:Gem::Requirement
162
205
  none: false
163
206
  requirements:
164
207
  - - ">="
165
208
  - !ruby/object:Gem::Version
209
+ hash: 3
210
+ segments:
211
+ - 0
166
212
  version: "0"
167
213
  type: :development
214
+ requirement: *id013
168
215
  prerelease: false
169
- version_requirements: *id014
216
+ name: ruby-debug19
170
217
  - !ruby/object:Gem::Dependency
171
- name: ruby-debug
172
- requirement: &id015 !ruby/object:Gem::Requirement
218
+ version_requirements: &id014 !ruby/object:Gem::Requirement
173
219
  none: false
174
220
  requirements:
175
221
  - - ">="
176
222
  - !ruby/object:Gem::Version
223
+ hash: 3
224
+ segments:
225
+ - 0
177
226
  version: "0"
178
227
  type: :development
228
+ requirement: *id014
179
229
  prerelease: false
180
- version_requirements: *id015
230
+ name: ruby-debug
181
231
  description: A service for image manipulation - built as an extensible wrapper of Imagemagick which handles caching, c/o the Dragonfly gem.
182
232
  email: aidan.feldman@gmail.com
183
233
  executables:
@@ -212,7 +262,6 @@ files:
212
262
  - spec/support/imagemagick.png
213
263
  - spec/unit/magickly_spec.rb
214
264
  - spec/unit/remote_data_store_spec.rb
215
- has_rdoc: true
216
265
  homepage: http://github.com/afeld/magickly
217
266
  licenses:
218
267
  - MIT
@@ -226,7 +275,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
226
275
  requirements:
227
276
  - - ">="
228
277
  - !ruby/object:Gem::Version
229
- hash: -1672346397376944796
278
+ hash: 3
230
279
  segments:
231
280
  - 0
232
281
  version: "0"
@@ -235,11 +284,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
235
284
  requirements:
236
285
  - - ">="
237
286
  - !ruby/object:Gem::Version
287
+ hash: 3
288
+ segments:
289
+ - 0
238
290
  version: "0"
239
291
  requirements: []
240
292
 
241
293
  rubyforge_project:
242
- rubygems_version: 1.6.2
294
+ rubygems_version: 1.8.2
243
295
  signing_key:
244
296
  specification_version: 3
245
297
  summary: image manipulation as a (plugin-able) service