magickly 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ source 'http://rubygems.org'
5
5
 
6
6
  gem 'sinatra', '~> 1.2.1', :require => 'sinatra/base'
7
7
  gem 'rack-cache', :require => 'rack/cache'
8
- gem 'dragonfly', '~> 0.8.2'
8
+ gem 'dragonfly', '~> 0.8'
9
9
  gem 'addressable', '~> 2.2', :require => 'addressable/uri'
10
10
 
11
11
  gem 'haml', '~> 3.0.25'
data/Gemfile.lock CHANGED
@@ -7,7 +7,8 @@ GEM
7
7
  columnize (0.3.2)
8
8
  crack (0.1.8)
9
9
  diff-lcs (1.1.2)
10
- dragonfly (0.8.2)
10
+ dragonfly (0.9.0)
11
+ rack
11
12
  rack
12
13
  git (1.2.5)
13
14
  haml (3.0.25)
@@ -65,7 +66,7 @@ PLATFORMS
65
66
  DEPENDENCIES
66
67
  activesupport (>= 2.0.0)
67
68
  addressable (~> 2.2)
68
- dragonfly (~> 0.8.2)
69
+ dragonfly (~> 0.8)
69
70
  haml (~> 3.0.25)
70
71
  httparty (~> 0.7.3)
71
72
  imagesize (~> 0.1)
data/HISTORY.md CHANGED
@@ -1,8 +1,14 @@
1
- # 1.1.0
1
+ # 1.1.1 (4/28/11)
2
+
3
+ * cross-compatibility fix for Ruby 1.8/1.9 regarding the checking of available methods from the Processor
4
+ * Addressable now required properly when included as a gem
5
+
6
+ # 1.1.0 (4/26/11)
2
7
 
3
8
  * make underlying Dragonfly application accessible for external configuration
9
+ * added some example Dragonfly shortcuts
4
10
  * major refactoring: namespacing inside of Magickly module (should be entirely backwards compatible)
5
11
 
6
- # 1.0.0
12
+ # 1.0.0 (4/19/11)
7
13
 
8
14
  * initial release
data/README.md CHANGED
@@ -4,6 +4,10 @@ A service for image manipulation - built as a simple wrapper of Imagemagick whic
4
4
 
5
5
  Say the base URL is the hosted version of this app, [magickly.heroku.com](http://magickly.heroku.com). The image URL is appended to the query string as a `src=`, followed by any of the supported operations below. Multiple operations can be combined, and will be applied in order.
6
6
 
7
+ If no query params are provided, a simple sandbox page is displayed. Try it here:
8
+
9
+ [magickly.heroku.com](http://magickly.heroku.com)
10
+
7
11
  ## Parameters
8
12
 
9
13
  *See the [Dragonfly documentation](http://markevans.github.com/dragonfly/file.Processing.html#ImageMagickProcessor) for more details about the permitted* `geometry` *values.*
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.1.1
data/lib/magickly.rb CHANGED
@@ -2,22 +2,21 @@ require 'active_support/core_ext/object/blank'
2
2
  require 'active_support/ordered_hash'
3
3
 
4
4
  require 'sinatra/base'
5
+ require 'addressable/uri'
5
6
  require 'dragonfly'
6
7
  require File.expand_path(File.join(File.dirname(__FILE__), 'dragonfly', 'data_storage', 'remote_data_store'))
7
8
  Dir["#{File.dirname(__FILE__)}/magickly/*.rb"].each {|file| require file }
8
9
 
9
10
 
10
11
  module Magickly
11
- # fallback for Dragonfly v0.8.2 and below
12
- dragonfly_processor = Dragonfly::ImageMagick::Processor rescue Dragonfly::Processing::ImageMagickProcessor
13
- @dragonfly_processor_methods = dragonfly_processor.instance_methods(false)
14
-
15
12
  @dragonfly = Dragonfly[:images].configure_with(:imagemagick)
16
13
  @dragonfly.configure do |c|
17
14
  c.datastore = Dragonfly::DataStorage::RemoteDataStore.new
18
15
  c.log = Logger.new($stdout)
19
16
  end
20
17
 
18
+ DRAGONFLY_PROCESSOR_FUNCTIONS = @dragonfly.processor.functions.keys
19
+
21
20
  class << self
22
21
  def dragonfly
23
22
  @dragonfly
@@ -33,7 +32,7 @@ module Magickly
33
32
 
34
33
  def process_image(image, options={})
35
34
  options.each do |method, val|
36
- if !@dragonfly_processor_methods.include?(method)
35
+ if !DRAGONFLY_PROCESSOR_FUNCTIONS.include?(method.to_sym)
37
36
  # might be an app-defined dragonfly shortcut
38
37
  image = image.send(method, val)
39
38
  elsif val == 'true'
data/lib/shortcuts.rb CHANGED
@@ -3,6 +3,9 @@ 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
+ #
6
9
  # c.job :tilt_shift do |coefficients|
7
10
  # if coefficients == 'true'
8
11
  # coefficients = "2,-2,0.5"
data/magickly.gemspec CHANGED
@@ -5,11 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{magickly}
8
- s.version = "1.1.0"
8
+ s.version = "1.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Aidan Feldman"]
12
- s.date = %q{2011-04-26}
12
+ s.date = %q{2011-04-28}
13
+ s.default_executable = %q{magickly}
13
14
  s.description = %q{A service for image manipulation - built as an extensible wrapper of Imagemagick which handles caching, c/o the Dragonfly gem.}
14
15
  s.email = %q{aidan.feldman@gmail.com}
15
16
  s.executables = ["magickly"]
@@ -46,7 +47,7 @@ Gem::Specification.new do |s|
46
47
  s.homepage = %q{http://github.com/afeld/magickly}
47
48
  s.licenses = ["MIT"]
48
49
  s.require_paths = ["lib"]
49
- s.rubygems_version = %q{1.7.2}
50
+ s.rubygems_version = %q{1.6.2}
50
51
  s.summary = %q{image manipulation as a (plugin-able) service}
51
52
  s.test_files = [
52
53
  "spec/requests/magickly_app_spec.rb",
@@ -61,7 +62,7 @@ Gem::Specification.new do |s|
61
62
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
62
63
  s.add_runtime_dependency(%q<sinatra>, ["~> 1.2.1"])
63
64
  s.add_runtime_dependency(%q<rack-cache>, [">= 0"])
64
- s.add_runtime_dependency(%q<dragonfly>, ["~> 0.8.2"])
65
+ s.add_runtime_dependency(%q<dragonfly>, ["~> 0.8"])
65
66
  s.add_runtime_dependency(%q<addressable>, ["~> 2.2"])
66
67
  s.add_runtime_dependency(%q<haml>, ["~> 3.0.25"])
67
68
  s.add_runtime_dependency(%q<httparty>, ["~> 0.7.3"])
@@ -77,7 +78,7 @@ Gem::Specification.new do |s|
77
78
  else
78
79
  s.add_dependency(%q<sinatra>, ["~> 1.2.1"])
79
80
  s.add_dependency(%q<rack-cache>, [">= 0"])
80
- s.add_dependency(%q<dragonfly>, ["~> 0.8.2"])
81
+ s.add_dependency(%q<dragonfly>, ["~> 0.8"])
81
82
  s.add_dependency(%q<addressable>, ["~> 2.2"])
82
83
  s.add_dependency(%q<haml>, ["~> 3.0.25"])
83
84
  s.add_dependency(%q<httparty>, ["~> 0.7.3"])
@@ -94,7 +95,7 @@ Gem::Specification.new do |s|
94
95
  else
95
96
  s.add_dependency(%q<sinatra>, ["~> 1.2.1"])
96
97
  s.add_dependency(%q<rack-cache>, [">= 0"])
97
- s.add_dependency(%q<dragonfly>, ["~> 0.8.2"])
98
+ s.add_dependency(%q<dragonfly>, ["~> 0.8"])
98
99
  s.add_dependency(%q<addressable>, ["~> 2.2"])
99
100
  s.add_dependency(%q<haml>, ["~> 3.0.25"])
100
101
  s.add_dependency(%q<httparty>, ["~> 0.7.3"])
@@ -30,7 +30,7 @@ describe Magickly::App do
30
30
  last_response.should be_ok
31
31
 
32
32
  # check that the returned file is identical to the original
33
- last_response.body.should eq IO.read(@image_path)
33
+ compare_binary(last_response.body, IO.read(@image_path))
34
34
  end
35
35
 
36
36
  it "retrieves an image at a relative URI" do
@@ -42,7 +42,7 @@ describe Magickly::App do
42
42
  last_response.should be_ok
43
43
 
44
44
  # check that the returned file is identical to the original
45
- last_response.body.should eq IO.read(@image_path)
45
+ compare_binary(last_response.body, IO.read(@image_path))
46
46
  end
47
47
 
48
48
  it "resizes an image" do
data/spec/spec_helper.rb CHANGED
@@ -17,3 +17,14 @@ RSpec.configure do |config|
17
17
 
18
18
  end
19
19
 
20
+ def compare_binary(one, two)
21
+ if String.instance_methods.include?(:encoding)
22
+ # Ruby 1.9
23
+ unless one.encoding == two.encoding
24
+ one = one.force_encoding("UTF-8")
25
+ two = two.force_encoding("UTF-8")
26
+ end
27
+ end
28
+
29
+ one.should eq two
30
+ end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magickly
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
4
  prerelease:
6
- segments:
7
- - 1
8
- - 1
9
- - 0
10
- version: 1.1.0
5
+ version: 1.1.1
11
6
  platform: ruby
12
7
  authors:
13
8
  - Aidan Feldman
@@ -15,233 +10,174 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-04-26 00:00:00 Z
13
+ date: 2011-04-28 00:00:00 -04:00
14
+ default_executable: magickly
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
17
+ name: sinatra
21
18
  requirement: &id001 !ruby/object:Gem::Requirement
22
19
  none: false
23
20
  requirements:
24
21
  - - ~>
25
22
  - !ruby/object:Gem::Version
26
- hash: 29
27
- segments:
28
- - 1
29
- - 2
30
- - 1
31
23
  version: 1.2.1
32
- version_requirements: *id001
33
- name: sinatra
34
- prerelease: false
35
24
  type: :runtime
25
+ prerelease: false
26
+ version_requirements: *id001
36
27
  - !ruby/object:Gem::Dependency
28
+ name: rack-cache
37
29
  requirement: &id002 !ruby/object:Gem::Requirement
38
30
  none: false
39
31
  requirements:
40
32
  - - ">="
41
33
  - !ruby/object:Gem::Version
42
- hash: 3
43
- segments:
44
- - 0
45
34
  version: "0"
46
- version_requirements: *id002
47
- name: rack-cache
48
- prerelease: false
49
35
  type: :runtime
36
+ prerelease: false
37
+ version_requirements: *id002
50
38
  - !ruby/object:Gem::Dependency
39
+ name: dragonfly
51
40
  requirement: &id003 !ruby/object:Gem::Requirement
52
41
  none: false
53
42
  requirements:
54
43
  - - ~>
55
44
  - !ruby/object:Gem::Version
56
- hash: 59
57
- segments:
58
- - 0
59
- - 8
60
- - 2
61
- version: 0.8.2
62
- version_requirements: *id003
63
- name: dragonfly
64
- prerelease: false
45
+ version: "0.8"
65
46
  type: :runtime
47
+ prerelease: false
48
+ version_requirements: *id003
66
49
  - !ruby/object:Gem::Dependency
50
+ name: addressable
67
51
  requirement: &id004 !ruby/object:Gem::Requirement
68
52
  none: false
69
53
  requirements:
70
54
  - - ~>
71
55
  - !ruby/object:Gem::Version
72
- hash: 7
73
- segments:
74
- - 2
75
- - 2
76
56
  version: "2.2"
77
- version_requirements: *id004
78
- name: addressable
79
- prerelease: false
80
57
  type: :runtime
58
+ prerelease: false
59
+ version_requirements: *id004
81
60
  - !ruby/object:Gem::Dependency
61
+ name: haml
82
62
  requirement: &id005 !ruby/object:Gem::Requirement
83
63
  none: false
84
64
  requirements:
85
65
  - - ~>
86
66
  - !ruby/object:Gem::Version
87
- hash: 53
88
- segments:
89
- - 3
90
- - 0
91
- - 25
92
67
  version: 3.0.25
93
- version_requirements: *id005
94
- name: haml
95
- prerelease: false
96
68
  type: :runtime
69
+ prerelease: false
70
+ version_requirements: *id005
97
71
  - !ruby/object:Gem::Dependency
72
+ name: httparty
98
73
  requirement: &id006 !ruby/object:Gem::Requirement
99
74
  none: false
100
75
  requirements:
101
76
  - - ~>
102
77
  - !ruby/object:Gem::Version
103
- hash: 5
104
- segments:
105
- - 0
106
- - 7
107
- - 3
108
78
  version: 0.7.3
109
- version_requirements: *id006
110
- name: httparty
111
- prerelease: false
112
79
  type: :runtime
80
+ prerelease: false
81
+ version_requirements: *id006
113
82
  - !ruby/object:Gem::Dependency
83
+ name: activesupport
114
84
  requirement: &id007 !ruby/object:Gem::Requirement
115
85
  none: false
116
86
  requirements:
117
87
  - - ">="
118
88
  - !ruby/object:Gem::Version
119
- hash: 15
120
- segments:
121
- - 2
122
- - 0
123
- - 0
124
89
  version: 2.0.0
125
- version_requirements: *id007
126
- name: activesupport
127
- prerelease: false
128
90
  type: :runtime
91
+ prerelease: false
92
+ version_requirements: *id007
129
93
  - !ruby/object:Gem::Dependency
94
+ name: jeweler
130
95
  requirement: &id008 !ruby/object:Gem::Requirement
131
96
  none: false
132
97
  requirements:
133
98
  - - ~>
134
99
  - !ruby/object:Gem::Version
135
- hash: 5
136
- segments:
137
- - 1
138
- - 5
139
100
  version: "1.5"
140
- version_requirements: *id008
141
- name: jeweler
142
- prerelease: false
143
101
  type: :development
102
+ prerelease: false
103
+ version_requirements: *id008
144
104
  - !ruby/object:Gem::Dependency
105
+ name: rcov
145
106
  requirement: &id009 !ruby/object:Gem::Requirement
146
107
  none: false
147
108
  requirements:
148
109
  - - ">="
149
110
  - !ruby/object:Gem::Version
150
- hash: 3
151
- segments:
152
- - 0
153
111
  version: "0"
154
- version_requirements: *id009
155
- name: rcov
156
- prerelease: false
157
112
  type: :development
113
+ prerelease: false
114
+ version_requirements: *id009
158
115
  - !ruby/object:Gem::Dependency
116
+ name: rack-test
159
117
  requirement: &id010 !ruby/object:Gem::Requirement
160
118
  none: false
161
119
  requirements:
162
120
  - - ">="
163
121
  - !ruby/object:Gem::Version
164
- hash: 3
165
- segments:
166
- - 0
167
122
  version: "0"
168
- version_requirements: *id010
169
- name: rack-test
170
- prerelease: false
171
123
  type: :development
124
+ prerelease: false
125
+ version_requirements: *id010
172
126
  - !ruby/object:Gem::Dependency
127
+ name: rspec
173
128
  requirement: &id011 !ruby/object:Gem::Requirement
174
129
  none: false
175
130
  requirements:
176
131
  - - ~>
177
132
  - !ruby/object:Gem::Version
178
- hash: 11
179
- segments:
180
- - 2
181
- - 4
182
133
  version: "2.4"
183
- version_requirements: *id011
184
- name: rspec
185
- prerelease: false
186
134
  type: :development
135
+ prerelease: false
136
+ version_requirements: *id011
187
137
  - !ruby/object:Gem::Dependency
138
+ name: webmock
188
139
  requirement: &id012 !ruby/object:Gem::Requirement
189
140
  none: false
190
141
  requirements:
191
142
  - - ~>
192
143
  - !ruby/object:Gem::Version
193
- hash: 3
194
- segments:
195
- - 1
196
- - 6
197
144
  version: "1.6"
198
- version_requirements: *id012
199
- name: webmock
200
- prerelease: false
201
145
  type: :development
146
+ prerelease: false
147
+ version_requirements: *id012
202
148
  - !ruby/object:Gem::Dependency
149
+ name: imagesize
203
150
  requirement: &id013 !ruby/object:Gem::Requirement
204
151
  none: false
205
152
  requirements:
206
153
  - - ~>
207
154
  - !ruby/object:Gem::Version
208
- hash: 9
209
- segments:
210
- - 0
211
- - 1
212
155
  version: "0.1"
213
- version_requirements: *id013
214
- name: imagesize
215
- prerelease: false
216
156
  type: :development
157
+ prerelease: false
158
+ version_requirements: *id013
217
159
  - !ruby/object:Gem::Dependency
160
+ name: ruby-debug19
218
161
  requirement: &id014 !ruby/object:Gem::Requirement
219
162
  none: false
220
163
  requirements:
221
164
  - - ">="
222
165
  - !ruby/object:Gem::Version
223
- hash: 3
224
- segments:
225
- - 0
226
166
  version: "0"
227
- version_requirements: *id014
228
- name: ruby-debug19
229
- prerelease: false
230
167
  type: :development
168
+ prerelease: false
169
+ version_requirements: *id014
231
170
  - !ruby/object:Gem::Dependency
171
+ name: ruby-debug
232
172
  requirement: &id015 !ruby/object:Gem::Requirement
233
173
  none: false
234
174
  requirements:
235
175
  - - ">="
236
176
  - !ruby/object:Gem::Version
237
- hash: 3
238
- segments:
239
- - 0
240
177
  version: "0"
241
- version_requirements: *id015
242
- name: ruby-debug
243
- prerelease: false
244
178
  type: :development
179
+ prerelease: false
180
+ version_requirements: *id015
245
181
  description: A service for image manipulation - built as an extensible wrapper of Imagemagick which handles caching, c/o the Dragonfly gem.
246
182
  email: aidan.feldman@gmail.com
247
183
  executables:
@@ -276,6 +212,7 @@ files:
276
212
  - spec/support/imagemagick.png
277
213
  - spec/unit/magickly_spec.rb
278
214
  - spec/unit/remote_data_store_spec.rb
215
+ has_rdoc: true
279
216
  homepage: http://github.com/afeld/magickly
280
217
  licenses:
281
218
  - MIT
@@ -289,7 +226,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
289
226
  requirements:
290
227
  - - ">="
291
228
  - !ruby/object:Gem::Version
292
- hash: 3
229
+ hash: -1672346397376944796
293
230
  segments:
294
231
  - 0
295
232
  version: "0"
@@ -298,14 +235,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
235
  requirements:
299
236
  - - ">="
300
237
  - !ruby/object:Gem::Version
301
- hash: 3
302
- segments:
303
- - 0
304
238
  version: "0"
305
239
  requirements: []
306
240
 
307
241
  rubyforge_project:
308
- rubygems_version: 1.7.2
242
+ rubygems_version: 1.6.2
309
243
  signing_key:
310
244
  specification_version: 3
311
245
  summary: image manipulation as a (plugin-able) service