dragonfly 1.3.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/History.md +16 -0
  4. data/README.md +5 -1
  5. data/dev/test.ru +1 -1
  6. data/dragonfly.gemspec +2 -1
  7. data/lib/dragonfly/content.rb +17 -18
  8. data/lib/dragonfly/image_magick/commands.rb +35 -0
  9. data/lib/dragonfly/image_magick/generators/plain.rb +13 -7
  10. data/lib/dragonfly/image_magick/generators/plasma.rb +10 -6
  11. data/lib/dragonfly/image_magick/generators/text.rb +67 -58
  12. data/lib/dragonfly/image_magick/plugin.rb +26 -25
  13. data/lib/dragonfly/image_magick/processors/encode.rb +16 -5
  14. data/lib/dragonfly/image_magick/processors/thumb.rb +37 -31
  15. data/lib/dragonfly/middleware.rb +2 -1
  16. data/lib/dragonfly/param_validators.rb +37 -0
  17. data/lib/dragonfly/response.rb +11 -11
  18. data/lib/dragonfly/routed_endpoint.rb +1 -1
  19. data/lib/dragonfly/server.rb +7 -7
  20. data/lib/dragonfly/version.rb +1 -1
  21. data/spec/dragonfly/app_spec.rb +1 -1
  22. data/spec/dragonfly/configurable_spec.rb +4 -4
  23. data/spec/dragonfly/content_spec.rb +1 -1
  24. data/spec/dragonfly/file_data_store_spec.rb +2 -2
  25. data/spec/dragonfly/image_magick/commands_spec.rb +98 -0
  26. data/spec/dragonfly/image_magick/generators/plain_spec.rb +39 -13
  27. data/spec/dragonfly/image_magick/generators/plasma_spec.rb +28 -9
  28. data/spec/dragonfly/image_magick/generators/text_spec.rb +51 -20
  29. data/spec/dragonfly/image_magick/plugin_spec.rb +45 -28
  30. data/spec/dragonfly/image_magick/processors/encode_spec.rb +30 -0
  31. data/spec/dragonfly/image_magick/processors/thumb_spec.rb +46 -45
  32. data/spec/dragonfly/job/fetch_url_spec.rb +1 -1
  33. data/spec/dragonfly/job_endpoint_spec.rb +26 -26
  34. data/spec/dragonfly/middleware_spec.rb +15 -6
  35. data/spec/dragonfly/model/active_record_spec.rb +2 -2
  36. data/spec/dragonfly/model/model_spec.rb +1 -1
  37. data/spec/dragonfly/param_validators_spec.rb +89 -0
  38. data/spec/dragonfly/server_spec.rb +4 -4
  39. data/spec/dragonfly/temp_object_spec.rb +5 -5
  40. data/spec/functional/shell_commands_spec.rb +6 -9
  41. data/spec/functional/to_response_spec.rb +2 -2
  42. data/spec/functional/urls_spec.rb +1 -1
  43. data/spec/spec_helper.rb +18 -14
  44. data/spec/support/image_matchers.rb +1 -1
  45. metadata +27 -12
  46. data/lib/dragonfly/image_magick/generators/convert.rb +0 -19
  47. data/lib/dragonfly/image_magick/processors/convert.rb +0 -33
  48. data/spec/dragonfly/image_magick/generators/convert_spec.rb +0 -19
  49. data/spec/dragonfly/image_magick/processors/convert_spec.rb +0 -88
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
  require 'rack'
3
3
 
4
4
  def dummy_rack_app
5
- lambda{|env| [200, {"Content-Type" => "text/html"}, ["dummy_rack_app body"]] }
5
+ lambda{|env| [200, {"content-type" => "text/html"}, ["dummy_rack_app body"]] }
6
6
  end
7
7
 
8
8
  describe Dragonfly::Middleware do
@@ -19,9 +19,18 @@ describe Dragonfly::Middleware do
19
19
  end
20
20
  end
21
21
 
22
- it "should pass through if the app returns X-Cascade: pass" do
22
+ it "should pass through if the app returns x-cascade: pass" do
23
23
  Dragonfly.app.should_receive(:call).and_return(
24
- [404, {"Content-Type" => 'text/plain', 'X-Cascade' => 'pass'}, ['Not found']]
24
+ [404, {"content-type" => 'text/plain', 'x-cascade' => 'pass'}, ['Not found']]
25
+ )
26
+ response = make_request(@stack, '/media/hello.png?howare=you')
27
+ response.body.should == 'dummy_rack_app body'
28
+ response.status.should == 200
29
+ end
30
+
31
+ it "should still pass through using deprecated uppercase X-Cascade: pass" do
32
+ Dragonfly.app.should_receive(:call).and_return(
33
+ [404, {"content-type" => 'text/plain', 'X-Cascade' => 'pass'}, ['Not found']]
25
34
  )
26
35
  response = make_request(@stack, '/media/hello.png?howare=you')
27
36
  response.body.should == 'dummy_rack_app body'
@@ -30,7 +39,7 @@ describe Dragonfly::Middleware do
30
39
 
31
40
  it "should return a 404 if the app returns a 404" do
32
41
  Dragonfly.app.should_receive(:call).and_return(
33
- [404, {"Content-Type" => 'text/plain'}, ['Not found']]
42
+ [404, {"content-type" => 'text/plain'}, ['Not found']]
34
43
  )
35
44
  response = make_request(@stack, '/media/hello.png?howare=you')
36
45
  response.status.should == 404
@@ -38,7 +47,7 @@ describe Dragonfly::Middleware do
38
47
 
39
48
  it "should return as per the dragonfly app if the app returns a 200" do
40
49
  Dragonfly.app.should_receive(:call).and_return(
41
- [200, {"Content-Type" => 'text/plain'}, ['ABCD']]
50
+ [200, {"content-type" => 'text/plain'}, ['ABCD']]
42
51
  )
43
52
  response = make_request(@stack, '/media/hello.png?howare=you')
44
53
  response.status.should == 200
@@ -57,7 +66,7 @@ describe Dragonfly::Middleware do
57
66
  it "should use the specified dragonfly app" do
58
67
  Dragonfly.app.should_not_receive(:call)
59
68
  Dragonfly.app(:images).should_receive(:call).and_return([
60
- 200, {"Content-Type" => 'text/plain'}, ['booboo']
69
+ 200, {"content-type" => 'text/plain'}, ['booboo']
61
70
  ])
62
71
  response = make_request(@stack, '/media/hello.png?howare=you')
63
72
  response.body.should == 'booboo'
@@ -9,7 +9,7 @@ unless RUBY_PLATFORM == "java"
9
9
  let! :dragonfly_app do test_app(:test_ar) end
10
10
 
11
11
  before :all do
12
- @connection = ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
12
+ ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
13
13
 
14
14
  ActiveRecord::Migration.verbose = false
15
15
 
@@ -27,7 +27,7 @@ unless RUBY_PLATFORM == "java"
27
27
 
28
28
  after :all do
29
29
  Photo.destroy_all
30
- ActiveRecord::Base.remove_connection(@connection)
30
+ ActiveRecord::Base.remove_connection()
31
31
  end
32
32
 
33
33
  describe "destroying" do
@@ -367,7 +367,7 @@ describe "models" do
367
367
  describe "remote_url" do
368
368
  it "should give the remote url if the uid is set" do
369
369
  @item.preview_image_uid = 'some/uid'
370
- @app.should_receive(:remote_url_for).with('some/uid', :some => 'param').and_return('http://egg.nog')
370
+ @app.should_receive(:remote_url_for).with('some/uid', {:some => 'param'}).and_return('http://egg.nog')
371
371
  @item.preview_image.remote_url(:some => 'param').should == 'http://egg.nog'
372
372
  end
373
373
  it "should return nil if the content is not yet saved" do
@@ -0,0 +1,89 @@
1
+ require "spec_helper"
2
+ require "dragonfly/param_validators"
3
+
4
+ describe Dragonfly::ParamValidators do
5
+ include Dragonfly::ParamValidators
6
+
7
+ describe "validate!" do
8
+ it "does nothing if the parameter meets the condition" do
9
+ validate!("thing") { |t| t === "thing" }
10
+ end
11
+
12
+ it "raises if the parameter doesn't meet the condition" do
13
+ expect {
14
+ validate!("thing") { |t| t === "ting" }
15
+ }.to raise_error(Dragonfly::ParamValidators::InvalidParameter)
16
+ end
17
+
18
+ it "does nothing if the parameter is nil" do
19
+ validate!(nil) { |t| t === "thing" }
20
+ end
21
+ end
22
+
23
+ describe "validate_all!" do
24
+ it "allows passing an array of parameters to validate" do
25
+ validate_all!(["a", "b"]) { |p| /\w/ === p }
26
+ expect {
27
+ validate_all!(["a", " "]) { |p| /\w/ === p }
28
+ }.to raise_error(Dragonfly::ParamValidators::InvalidParameter)
29
+ end
30
+ end
31
+
32
+ describe "validate_all_keys!" do
33
+ it "allows passing an array of parameters to validate" do
34
+ obj = { "a" => "A", "b" => "B" }
35
+ validate_all_keys!(obj, ["a", "b"]) { |p| /\w/ === p }
36
+ expect {
37
+ validate_all_keys!(obj, ["a", "b"]) { |p| /[a-z]/ === p }
38
+ }.to raise_error(Dragonfly::ParamValidators::InvalidParameter)
39
+ end
40
+ end
41
+
42
+ describe "is_number" do
43
+ [3, 3.14, "3", "3.2"].each do |val|
44
+ it "validates #{val.inspect}" do
45
+ validate!(val, &is_number)
46
+ end
47
+ end
48
+
49
+ ["", "3 2", "hello4", {}, []].each do |val|
50
+ it "validates #{val.inspect}" do
51
+ expect {
52
+ validate!(val, &is_number)
53
+ }.to raise_error(Dragonfly::ParamValidators::InvalidParameter)
54
+ end
55
+ end
56
+ end
57
+
58
+ describe "is_word" do
59
+ ["hello", "helLo", "HELLO"].each do |val|
60
+ it "validates #{val.inspect}" do
61
+ validate!(val, &is_word)
62
+ end
63
+ end
64
+
65
+ ["", "hel%$lo", "hel lo", "hel-lo", {}, []].each do |val|
66
+ it "validates #{val.inspect}" do
67
+ expect {
68
+ validate!(val, &is_word)
69
+ }.to raise_error(Dragonfly::ParamValidators::InvalidParameter)
70
+ end
71
+ end
72
+ end
73
+
74
+ describe "is_words" do
75
+ ["hello there", "Hi", " What is Up "].each do |val|
76
+ it "validates #{val.inspect}" do
77
+ validate!(val, &is_words)
78
+ end
79
+ end
80
+
81
+ ["", "hel%$lo", "What's up", "hel-lo", {}, []].each do |val|
82
+ it "validates #{val.inspect}" do
83
+ expect {
84
+ validate!(val, &is_words)
85
+ }.to raise_error(Dragonfly::ParamValidators::InvalidParameter)
86
+ end
87
+ end
88
+ end
89
+ end
@@ -81,7 +81,7 @@ describe Dragonfly::Server do
81
81
  response.status.should == 404
82
82
  response.body.should == 'Not found'
83
83
  response.content_type.should == 'text/plain'
84
- response.headers['X-Cascade'].should == 'pass'
84
+ response.headers['x-cascade'].should == 'pass'
85
85
  end
86
86
  end
87
87
 
@@ -90,7 +90,7 @@ describe Dragonfly::Server do
90
90
  response.status.should == 404
91
91
  response.body.should == 'Not found'
92
92
  response.content_type.should == 'text/plain'
93
- response.headers['X-Cascade'].should be_nil
93
+ response.headers['x-cascade'].should be_nil
94
94
  end
95
95
 
96
96
  it "should return a 404 when the url isn't known at all" do
@@ -98,7 +98,7 @@ describe Dragonfly::Server do
98
98
  response.status.should == 404
99
99
  response.body.should == 'Not found'
100
100
  response.content_type.should == 'text/plain'
101
- response.headers['X-Cascade'].should == 'pass'
101
+ response.headers['x-cascade'].should == 'pass'
102
102
  end
103
103
 
104
104
  it "should return a 404 when the url is a well-encoded but bad array" do
@@ -107,7 +107,7 @@ describe Dragonfly::Server do
107
107
  response.status.should == 404
108
108
  response.body.should == 'Not found'
109
109
  response.content_type.should == 'text/plain'
110
- response.headers['X-Cascade'].should be_nil
110
+ response.headers['x-cascade'].should be_nil
111
111
  end
112
112
 
113
113
  it "should return a 403 Forbidden when someone uses fetch_url" do
@@ -111,14 +111,14 @@ describe Dragonfly::TempObject do
111
111
  describe "to_file" do
112
112
  before(:each) do
113
113
  @filename = 'tmp/eggnog.txt'
114
- FileUtils.rm_f(@filename) if File.exists?(@filename)
114
+ FileUtils.rm_f(@filename) if File.exist?(@filename)
115
115
  end
116
116
  after(:each) do
117
- FileUtils.rm_f(@filename) if File.exists?(@filename)
117
+ FileUtils.rm_f(@filename) if File.exist?(@filename)
118
118
  end
119
119
  it "should write to a file" do
120
120
  @temp_object.to_file(@filename)
121
- File.exists?(@filename).should be_truthy
121
+ File.exist?(@filename).should be_truthy
122
122
  end
123
123
  it "should write the correct data to the file" do
124
124
  @temp_object.to_file(@filename)
@@ -140,12 +140,12 @@ describe Dragonfly::TempObject do
140
140
  it "should create intermediate subdirs" do
141
141
  filename = 'tmp/gog/mcgee'
142
142
  @temp_object.to_file(filename)
143
- File.exists?(filename).should be_truthy
143
+ File.exist?(filename).should be_truthy
144
144
  FileUtils.rm_rf('tmp/gog')
145
145
  end
146
146
  it "should allow not creating intermediate subdirs" do
147
147
  filename = 'tmp/gog/mcgee'
148
- expect{ @temp_object.to_file(filename, :mkdirs => false) }.to raise_error()
148
+ expect{ @temp_object.to_file(filename, :mkdirs => false) }.to raise_error(/No such file or directory/)
149
149
  end
150
150
  end
151
151
 
@@ -1,33 +1,30 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe "using the shell" do
4
-
5
4
  let (:app) { test_app }
6
5
 
7
6
  describe "shell injection" do
8
7
  it "should not allow it!" do
9
8
  app.configure_with(:imagemagick)
10
9
  begin
11
- app.generate(:plain, 10, 10, 'white').convert("-resize 5x5 ; touch tmp/stuff").apply
10
+ app.generate(:plain, 10, 10, "white; touch tmp/stuff").apply
12
11
  rescue Dragonfly::Shell::CommandFailed
13
12
  end
14
- File.exist?('tmp/stuff').should be_falsey
13
+ File.exist?("tmp/stuff").should be_falsey
15
14
  end
16
15
  end
17
16
 
18
17
  describe "env variables with imagemagick" do
19
18
  it "allows configuring the convert path" do
20
- app.configure_with(:imagemagick, :convert_command => '/bin/convert')
19
+ app.configure_with(:imagemagick, :convert_command => "/bin/convert")
21
20
  app.shell.should_receive(:run).with(%r[/bin/convert], hash_including)
22
- app.create("").thumb('30x30').apply
21
+ app.create("").thumb("30x30").apply
23
22
  end
24
23
 
25
24
  it "allows configuring the identify path" do
26
- app.configure_with(:imagemagick, :identify_command => '/bin/identify')
25
+ app.configure_with(:imagemagick, :identify_command => "/bin/identify")
27
26
  app.shell.should_receive(:run).with(%r[/bin/identify], hash_including).and_return("JPG 1 1")
28
27
  app.create("").width
29
28
  end
30
29
  end
31
-
32
30
  end
33
-
@@ -15,7 +15,7 @@ describe "getting rack response directly" do
15
15
  response.should be_a(Array)
16
16
  response.length.should == 3
17
17
  response[0].should == 200
18
- response[1]['Content-Type'].should == 'application/octet-stream'
18
+ response[1]['content-type'].should == 'application/octet-stream'
19
19
  response[2].data.should == 'bunheads'
20
20
  end
21
21
 
@@ -24,7 +24,7 @@ describe "getting rack response directly" do
24
24
  response.should be_a(Array)
25
25
  response.length.should == 3
26
26
  response[0].should == 405
27
- response[1]['Content-Type'].should == 'text/plain'
27
+ response[1]['content-type'].should == 'text/plain'
28
28
  response[2].should == ["method not allowed"]
29
29
  end
30
30
 
@@ -6,7 +6,7 @@ describe "urls" do
6
6
  Dragonfly::Response.should_receive(:new).with(
7
7
  satisfy{|job| job.to_a == array },
8
8
  instance_of(Hash)
9
- ).and_return(double('response', :to_response => [200, {'Content-Type' => 'text/plain'}, ["OK"]]))
9
+ ).and_return(double('response', :to_response => [200, {'content-type' => 'text/plain'}, ["OK"]]))
10
10
  end
11
11
 
12
12
  let (:app) {
data/spec/spec_helper.rb CHANGED
@@ -2,21 +2,27 @@ require "rubygems"
2
2
  require "bundler"
3
3
  Bundler.setup(:default, :test)
4
4
 
5
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
6
6
  $LOAD_PATH.unshift(File.dirname(__FILE__))
7
- require 'rspec'
8
- require 'dragonfly'
9
- require 'fileutils'
10
- require 'tempfile'
11
- require 'webmock/rspec'
12
- require 'pry'
7
+ require "rspec"
8
+ require "dragonfly"
9
+ require "fileutils"
10
+ require "tempfile"
11
+ require "webmock/rspec"
12
+ require "pry"
13
13
 
14
14
  # Requires supporting files with custom matchers and macros, etc,
15
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
15
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
16
16
 
17
- SAMPLES_DIR = Pathname.new(File.expand_path('../../samples', __FILE__))
17
+ SAMPLES_DIR = Pathname.new(File.expand_path("../../samples", __FILE__))
18
18
 
19
19
  RSpec.configure do |c|
20
+ c.expect_with(:rspec) do |expectations|
21
+ expectations.syntax = [:should, :expect]
22
+ end
23
+ c.mock_with(:rspec) do |mocks|
24
+ mocks.syntax = [:should, :expect]
25
+ end
20
26
  c.include ModelHelpers
21
27
  c.include RackHelpers
22
28
  end
@@ -25,8 +31,8 @@ def todo
25
31
  raise "TODO"
26
32
  end
27
33
 
28
- require 'logger'
29
- LOG_FILE = 'tmp/test.log'
34
+ require "logger"
35
+ LOG_FILE = "tmp/test.log"
30
36
  FileUtils.rm_rf(LOG_FILE)
31
37
  Dragonfly.logger = Logger.new(LOG_FILE)
32
38
 
@@ -36,7 +42,7 @@ RSpec.configure do |c|
36
42
  end
37
43
  end
38
44
 
39
- def test_app(name=nil)
45
+ def test_app(name = nil)
40
46
  app = Dragonfly::App.instance(name)
41
47
  app.datastore = Dragonfly::MemoryDataStore.new
42
48
  app.secret = "test secret"
@@ -45,8 +51,6 @@ end
45
51
 
46
52
  def test_imagemagick_app
47
53
  test_app.configure do
48
- generator :convert, Dragonfly::ImageMagick::Generators::Convert.new
49
- processor :convert, Dragonfly::ImageMagick::Processors::Convert.new
50
54
  analyser :image_properties, Dragonfly::ImageMagick::Analysers::ImageProperties.new
51
55
  end
52
56
  end
@@ -22,7 +22,7 @@ end
22
22
  match do |actual|
23
23
  value.should === image_properties(actual)[property]
24
24
  end
25
- failure_message_for_should do |actual|
25
+ failure_message do |actual|
26
26
  "expected image to have #{property} #{value.inspect}, but it had #{image_properties(actual)[property].inspect}"
27
27
  end
28
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dragonfly
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-09 00:00:00.000000000 Z
11
+ date: 2025-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -52,20 +52,34 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: ostruct
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.6.1
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.6.1
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rspec
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '2.5'
75
+ version: '3.0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '2.5'
82
+ version: '3.0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: webmock
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -158,12 +172,11 @@ files:
158
172
  - lib/dragonfly/has_filename.rb
159
173
  - lib/dragonfly/hash_with_css_style_keys.rb
160
174
  - lib/dragonfly/image_magick/analysers/image_properties.rb
161
- - lib/dragonfly/image_magick/generators/convert.rb
175
+ - lib/dragonfly/image_magick/commands.rb
162
176
  - lib/dragonfly/image_magick/generators/plain.rb
163
177
  - lib/dragonfly/image_magick/generators/plasma.rb
164
178
  - lib/dragonfly/image_magick/generators/text.rb
165
179
  - lib/dragonfly/image_magick/plugin.rb
166
- - lib/dragonfly/image_magick/processors/convert.rb
167
180
  - lib/dragonfly/image_magick/processors/encode.rb
168
181
  - lib/dragonfly/image_magick/processors/thumb.rb
169
182
  - lib/dragonfly/job.rb
@@ -182,6 +195,7 @@ files:
182
195
  - lib/dragonfly/model/class_methods.rb
183
196
  - lib/dragonfly/model/instance_methods.rb
184
197
  - lib/dragonfly/model/validations.rb
198
+ - lib/dragonfly/param_validators.rb
185
199
  - lib/dragonfly/rails/images.rb
186
200
  - lib/dragonfly/railtie.rb
187
201
  - lib/dragonfly/register.rb
@@ -220,12 +234,12 @@ files:
220
234
  - spec/dragonfly/has_filename_spec.rb
221
235
  - spec/dragonfly/hash_with_css_style_keys_spec.rb
222
236
  - spec/dragonfly/image_magick/analysers/image_properties_spec.rb
223
- - spec/dragonfly/image_magick/generators/convert_spec.rb
237
+ - spec/dragonfly/image_magick/commands_spec.rb
224
238
  - spec/dragonfly/image_magick/generators/plain_spec.rb
225
239
  - spec/dragonfly/image_magick/generators/plasma_spec.rb
226
240
  - spec/dragonfly/image_magick/generators/text_spec.rb
227
241
  - spec/dragonfly/image_magick/plugin_spec.rb
228
- - spec/dragonfly/image_magick/processors/convert_spec.rb
242
+ - spec/dragonfly/image_magick/processors/encode_spec.rb
229
243
  - spec/dragonfly/image_magick/processors/thumb_spec.rb
230
244
  - spec/dragonfly/job/fetch_file_spec.rb
231
245
  - spec/dragonfly/job/fetch_spec.rb
@@ -239,6 +253,7 @@ files:
239
253
  - spec/dragonfly/model/active_record_spec.rb
240
254
  - spec/dragonfly/model/model_spec.rb
241
255
  - spec/dragonfly/model/validations_spec.rb
256
+ - spec/dragonfly/param_validators_spec.rb
242
257
  - spec/dragonfly/register_spec.rb
243
258
  - spec/dragonfly/routed_endpoint_spec.rb
244
259
  - spec/dragonfly/serializer_spec.rb
@@ -285,8 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
285
300
  - !ruby/object:Gem::Version
286
301
  version: '0'
287
302
  requirements: []
288
- rubyforge_project:
289
- rubygems_version: 2.7.6
303
+ rubygems_version: 3.5.11
290
304
  signing_key:
291
305
  specification_version: 4
292
306
  summary: Ideal gem for handling attachments in Rails, Sinatra and Rack applications.
@@ -301,12 +315,12 @@ test_files:
301
315
  - spec/dragonfly/has_filename_spec.rb
302
316
  - spec/dragonfly/hash_with_css_style_keys_spec.rb
303
317
  - spec/dragonfly/image_magick/analysers/image_properties_spec.rb
304
- - spec/dragonfly/image_magick/generators/convert_spec.rb
318
+ - spec/dragonfly/image_magick/commands_spec.rb
305
319
  - spec/dragonfly/image_magick/generators/plain_spec.rb
306
320
  - spec/dragonfly/image_magick/generators/plasma_spec.rb
307
321
  - spec/dragonfly/image_magick/generators/text_spec.rb
308
322
  - spec/dragonfly/image_magick/plugin_spec.rb
309
- - spec/dragonfly/image_magick/processors/convert_spec.rb
323
+ - spec/dragonfly/image_magick/processors/encode_spec.rb
310
324
  - spec/dragonfly/image_magick/processors/thumb_spec.rb
311
325
  - spec/dragonfly/job/fetch_file_spec.rb
312
326
  - spec/dragonfly/job/fetch_spec.rb
@@ -320,6 +334,7 @@ test_files:
320
334
  - spec/dragonfly/model/active_record_spec.rb
321
335
  - spec/dragonfly/model/model_spec.rb
322
336
  - spec/dragonfly/model/validations_spec.rb
337
+ - spec/dragonfly/param_validators_spec.rb
323
338
  - spec/dragonfly/register_spec.rb
324
339
  - spec/dragonfly/routed_endpoint_spec.rb
325
340
  - spec/dragonfly/serializer_spec.rb
@@ -1,19 +0,0 @@
1
- module Dragonfly
2
- module ImageMagick
3
- module Generators
4
- class Convert
5
-
6
- def call(content, args, format)
7
- format = format.to_s
8
- convert_command = content.env[:convert_command] || 'convert'
9
- content.shell_generate :ext => format do |path|
10
- "#{convert_command} #{args} #{path}"
11
- end
12
- content.add_meta('format' => format)
13
- end
14
-
15
- end
16
- end
17
- end
18
- end
19
-
@@ -1,33 +0,0 @@
1
- module Dragonfly
2
- module ImageMagick
3
- module Processors
4
- class Convert
5
-
6
- def call(content, args='', opts={})
7
- convert_command = content.env[:convert_command] || 'convert'
8
- format = opts['format']
9
-
10
- input_args = opts['input_args'] if opts['input_args']
11
- delegate_string = "#{opts['delegate']}:" if opts['delegate']
12
- frame_string = "[#{opts['frame']}]" if opts['frame']
13
-
14
- content.shell_update :ext => format do |old_path, new_path|
15
- "#{convert_command} #{input_args} #{delegate_string}#{old_path}#{frame_string} #{args} #{new_path}"
16
- end
17
-
18
- if format
19
- content.meta['format'] = format.to_s
20
- content.ext = format
21
- content.meta['mime_type'] = nil # don't need it as we have ext now
22
- end
23
- end
24
-
25
- def update_url(attrs, args='', opts={})
26
- format = opts['format']
27
- attrs.ext = format if format
28
- end
29
-
30
- end
31
- end
32
- end
33
- end
@@ -1,19 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Dragonfly::ImageMagick::Generators::Convert do
4
- let (:generator) { Dragonfly::ImageMagick::Generators::Convert.new }
5
- let (:app) { test_app }
6
- let (:image) { Dragonfly::Content.new(app) }
7
-
8
- describe "calling convert" do
9
- before(:each) do
10
- generator.call(image, "-size 1x1 xc:white", 'png')
11
- end
12
- it {image.should have_width(1)}
13
- it {image.should have_height(1)}
14
- it {image.should have_format('png')}
15
- it {image.meta.should == {'format' => 'png'}}
16
- end
17
-
18
- end
19
-