delayed_paperclip 2.9.2 → 2.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6cd279c1d4024765a17e736762beaf90e355ae5c
4
- data.tar.gz: abc9e943e6dbfd164e749edda10ae93847b80bd0
3
+ metadata.gz: a5ac9bcd09517a634af35fb347bdc11cf538bb20
4
+ data.tar.gz: f11ca1ba331c50817bd6a9bcd3b6197948a4ae23
5
5
  SHA512:
6
- metadata.gz: d8a46607f55622cc639ba1b94af952afa5d69bff67add0634789f681708ddd3b92b93a6f2b9b7fe8561dd7dbd9fb8d8838ff6cd239085bc7311026bfb92ea601
7
- data.tar.gz: d9fcbafdcda62b4ebdf627f8a3a43ffda2397bf8e1e7fe09ff383ba0dde7b34a4499658f24d31ee90b475845670de522bb2a2623633b582dd30218c4a7c79382
6
+ metadata.gz: 3d297de920ba09991941b8a0d3c172c0a36cdc3a89542797eb9341ef757da42cf11a7f2176e985f74d13d93ae8aa2ce8b38ce3749833d789a8784e7c5a64a30f
7
+ data.tar.gz: f8eb0f2c138883e8a948b6523d29ed18fb7c045b9d0e81020fc004e5e6b9c9b7fb4958e925abfd672c210a1fbd9a7309a49239856165657e25e311e88363255b
data/.travis.yml CHANGED
@@ -3,9 +3,9 @@ cache: bundler
3
3
  sudo: false
4
4
 
5
5
  rvm:
6
- - 2.3.0
7
- - 2.2
8
- - 2.1
6
+ - 2.3.1
7
+ - 2.2.5
8
+ - 2.1.10
9
9
  - 2.0
10
10
 
11
11
  gemfile:
@@ -13,6 +13,15 @@ gemfile:
13
13
  - gemfiles/4.0.gemfile
14
14
  - gemfiles/4.1.gemfile
15
15
  - gemfiles/4.2.gemfile
16
+ - gemfiles/5.0.gemfile
17
+
18
+ # Rails 5.0 requires Ruby >= 2.2
19
+ matrix:
20
+ exclude:
21
+ - rvm: 2.1.10
22
+ gemfile: gemfiles/5.0.gemfile
23
+ - rvm: 2.0
24
+ gemfile: gemfiles/5.0.gemfile
16
25
 
17
26
  script: "bundle exec rake clean spec"
18
27
 
data/Appraisals CHANGED
@@ -13,3 +13,7 @@ end
13
13
  appraise "4.2" do
14
14
  gem "rails", "~> 4.2.0"
15
15
  end
16
+
17
+ appraise "5.0" do
18
+ gem "rails", "~> 5.0.0.beta3"
19
+ end
data/README.md CHANGED
@@ -83,6 +83,8 @@ end
83
83
 
84
84
  ### Resque
85
85
 
86
+ Resque adapter is deprecated. Please use ActiveJob one.
87
+
86
88
  Make sure that you have [Resque](https://github.com/resque/resque) up and running. The jobs will be
87
89
  dispatched to the <code>:paperclip</code> queue, so you can correctly
88
90
  dispatch your worker. Configure resque and your workers exactly as you
@@ -90,10 +92,14 @@ would otherwise.
90
92
 
91
93
  ### DJ
92
94
 
95
+ DelayedJob adapter is deprecated. Please use ActiveJob one.
96
+
93
97
  Just make sure that you have DJ up and running.
94
98
 
95
99
  ### Sidekiq
96
100
 
101
+ Sidekiq adapter is deprecated. Please use ActiveJob one.
102
+
97
103
  Make sure that [Sidekiq](http://github.com/mperham/sidekiq) is running and listening to the
98
104
  `paperclip` queue, either by adding it to your
99
105
  `sidekiq.yml` config file under `- queues:` or by
@@ -255,7 +261,7 @@ end
255
261
  You can set queue name for background job. By default it's called "paperclip".
256
262
  You can set it by changing global default options or by:
257
263
 
258
- ```
264
+ ```ruby
259
265
  class User < ActiveRecord::Base
260
266
  has_attached_file :avatar
261
267
 
@@ -291,6 +297,43 @@ What if I’m not using images?
291
297
  This library works no matter what kind of post-processing you are doing
292
298
  with Paperclip.
293
299
 
300
+ Paperclip Post-processors are not working
301
+ -----------------------------------------
302
+
303
+ If you are using custom [post-processing processors](https://github.com/thoughtbot/paperclip#post-processing)
304
+ like this:
305
+
306
+ ```ruby
307
+ # ...
308
+
309
+ has_attached_file :avatar, styles: { thumb: '100x100>' }, processors: [:rotator]
310
+ process_in_background :avatar
311
+
312
+ def rotate!
313
+ # ...
314
+ avatar.reprocess!
315
+ # ...
316
+ end
317
+
318
+ # ...
319
+ ```
320
+
321
+ ...you may encounter an issue where your post-processors are ignored
322
+ ([more info](https://github.com/jrgifford/delayed_paperclip/issues/171)).
323
+ In order to avoid this use `reprocess_without_delay!`
324
+
325
+ ```ruby
326
+ # ...
327
+
328
+ def rotate!
329
+ # ...
330
+ avatar.reprocess_without_delay!
331
+ # ...
332
+ end
333
+
334
+ # ...
335
+ ```
336
+
294
337
  Does it work with s3?
295
338
  ---------------------
296
339
 
@@ -299,9 +342,16 @@ Yes.
299
342
  Contributing
300
343
  ------------
301
344
 
302
- Checkout out CONTRIBUTING. Run all tests with
345
+ Checkout out [CONTRIBUTING](https://github.com/jrgifford/delayed_paperclip/blob/master/CONTRIBUTING). Run specs with:
303
346
 
304
347
  ````
305
348
  # Rspec on all versions
306
- rake appraisal spec
349
+ bundle exec appraisal install
350
+ bundle exec appraisal rake
351
+
352
+ # Rspec on latest stable gems
353
+ bundle exec rake
354
+
355
+ # Rspec on specific rails version
356
+ bundle exec appraisal 5.0 rake
307
357
  ````
data/Rakefile CHANGED
@@ -1,28 +1,19 @@
1
1
  require 'bundler/setup'
2
-
3
- require 'appraisal'
4
-
5
2
  require 'rake'
6
- require 'rake/testtask'
7
-
8
- desc 'Default: run unit tests.'
9
- task default: [:clean, 'appraisal:install', :all]
3
+ require 'rspec/core/rake_task'
10
4
 
11
- desc 'Test the delayed paperclip plugin under all supported Rails versions.'
12
- task :all do |t|
13
- exec('rake appraisal test spec')
14
- end
5
+ desc 'Default: run specs'
6
+ task default: [:clean, :spec]
15
7
 
16
- desc 'Clean up files.'
8
+ desc 'Clean up files'
17
9
  task :clean do |t|
18
10
  FileUtils.rm_rf "doc"
19
11
  FileUtils.rm_rf "tmp"
20
12
  FileUtils.rm_rf "pkg"
21
13
  FileUtils.rm_rf "public"
22
- Dir.glob("paperclip-*.gem").each{|f| FileUtils.rm f }
14
+ Dir.glob("paperclip-*.gem").each { |f| FileUtils.rm f }
23
15
  end
24
16
 
25
- require 'rspec/core/rake_task'
26
17
  RSpec::Core::RakeTask.new do |t|
27
18
  t.pattern = 'spec/**/*_spec.rb'
28
19
  end
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "rails", "~> 5.0.0.beta3"
6
+
7
+ gemspec :path => "../"
@@ -1,4 +1,5 @@
1
1
  require 'delayed_job'
2
+ require 'active_support/deprecation'
2
3
 
3
4
  module DelayedPaperclip
4
5
  module Jobs
@@ -8,6 +9,11 @@ module DelayedPaperclip
8
9
  if Gem.loaded_specs['delayed_job'].version >= Gem::Version.new("2.1.0")
9
10
 
10
11
  def self.enqueue_delayed_paperclip(instance_klass, instance_id, attachment_name)
12
+ ActiveSupport::Deprecation.warn(<<-MESSAGE)
13
+ Using DelayedJob adapter for delayed_paperclip is deprecated and will be removed in version 3.0.0.
14
+ Please use ActiveJob adapter.
15
+ MESSAGE
16
+
11
17
  ::Delayed::Job.enqueue(
12
18
  :payload_object => new(instance_klass, instance_id, attachment_name),
13
19
  :priority => instance_klass.constantize.paperclip_definitions[attachment_name][:delayed][:priority].to_i,
@@ -18,6 +24,11 @@ module DelayedPaperclip
18
24
  else
19
25
 
20
26
  def self.enqueue_delayed_paperclip(instance_klass, instance_id, attachment_name)
27
+ ActiveSupport::Deprecation.warn(<<-MESSAGE)
28
+ Using DelayedJob adapter for delayed_paperclip is deprecated and will be removed in version 3.0.0.
29
+ Please use ActiveJob adapter.
30
+ MESSAGE
31
+
21
32
  ::Delayed::Job.enqueue(
22
33
  new(instance_klass, instance_id, attachment_name),
23
34
  instance_klass.constantize.paperclip_definitions[attachment_name][:delayed][:priority].to_i,
@@ -1,4 +1,5 @@
1
1
  require 'resque'
2
+ require 'active_support/deprecation'
2
3
 
3
4
  module DelayedPaperclip
4
5
  module Jobs
@@ -6,6 +7,11 @@ module DelayedPaperclip
6
7
  def self.enqueue_delayed_paperclip(instance_klass, instance_id, attachment_name)
7
8
  @queue = instance_klass.constantize.paperclip_definitions[attachment_name][:delayed][:queue]
8
9
  ::Resque.enqueue(self, instance_klass, instance_id, attachment_name)
10
+
11
+ ActiveSupport::Deprecation.warn(<<-MESSAGE)
12
+ Using Resque adapter for delayed_paperclip is deprecated and will be removed in version 3.0.0.
13
+ Please use ActiveJob adapter.
14
+ MESSAGE
9
15
  end
10
16
 
11
17
  def self.perform(instance_klass, instance_id, attachment_name)
@@ -1,4 +1,5 @@
1
1
  require 'sidekiq/worker'
2
+ require 'active_support/deprecation'
2
3
 
3
4
  module DelayedPaperclip
4
5
  module Jobs
@@ -6,6 +7,11 @@ module DelayedPaperclip
6
7
  include ::Sidekiq::Worker
7
8
 
8
9
  def self.enqueue_delayed_paperclip(instance_klass, instance_id, attachment_name)
10
+ ActiveSupport::Deprecation.warn(<<-MESSAGE)
11
+ Using Sidekiq adapter for delayed_paperclip is deprecated and will be removed in version 3.0.0.
12
+ Please use ActiveJob adapter.
13
+ MESSAGE
14
+
9
15
  queue_name = instance_klass.constantize.paperclip_definitions[attachment_name][:delayed][:queue]
10
16
  # Sidekiq >= 4.1.0
11
17
  if respond_to?(:set)
@@ -1,3 +1,3 @@
1
1
  module DelayedPaperclip
2
- VERSION = "2.9.2"
2
+ VERSION = "2.10.0"
3
3
  end
@@ -8,7 +8,7 @@ describe "ActiveJob inline" do
8
8
  ActiveJob::Base.logger = nil
9
9
  end
10
10
 
11
- let(:dummy) { Dummy.new(:image => File.open("#{ROOT}/spec/fixtures/12k.png")) }
11
+ let(:dummy) { Dummy.new(:image => File.open("#{ROOT}/fixtures/12k.png")) }
12
12
 
13
13
  describe "perform job" do
14
14
  before :each do
@@ -17,7 +17,7 @@ describe "ActiveJob inline" do
17
17
  end
18
18
 
19
19
  it "performs a job" do
20
- dummy.image = File.open("#{ROOT}/spec/fixtures/12k.png")
20
+ dummy.image = File.open("#{ROOT}/fixtures/12k.png")
21
21
  Paperclip::Attachment.any_instance.expects(:reprocess!)
22
22
  dummy.save!
23
23
  end
@@ -10,7 +10,7 @@ if defined? ActiveJob
10
10
  Resque.remove_queue(:paperclip)
11
11
  end
12
12
 
13
- let(:dummy) { Dummy.new(:image => File.open("#{ROOT}/spec/fixtures/12k.png")) }
13
+ let(:dummy) { Dummy.new(:image => File.open("#{ROOT}/fixtures/12k.png")) }
14
14
 
15
15
  describe "integration tests" do
16
16
  include_examples "base usage"
@@ -10,7 +10,7 @@ describe "ActiveJob with Sidekiq backend" do
10
10
  Sidekiq::Queues["paperclip"].clear
11
11
  end
12
12
 
13
- let(:dummy) { Dummy.new(:image => File.open("#{ROOT}/spec/fixtures/12k.png")) }
13
+ let(:dummy) { Dummy.new(:image => File.open("#{ROOT}/fixtures/12k.png")) }
14
14
 
15
15
  describe "integration tests" do
16
16
  include_examples "base usage"
@@ -15,7 +15,7 @@ describe "Base Delayed Paperclip Integration" do
15
15
  describe "double save" do
16
16
  before :each do
17
17
  dummy.image_processing.should be_falsey
18
- dummy.image = File.open("#{ROOT}/spec/fixtures/12k.png")
18
+ dummy.image = File.open("#{ROOT}/fixtures/12k.png")
19
19
  dummy.save!
20
20
  end
21
21
 
@@ -9,7 +9,7 @@ describe "Delayed Job" do
9
9
  build_delayed_jobs
10
10
  end
11
11
 
12
- let(:dummy) { Dummy.new(:image => File.open("#{ROOT}/spec/fixtures/12k.png")) }
12
+ let(:dummy) { Dummy.new(:image => File.open("#{ROOT}/fixtures/12k.png")) }
13
13
 
14
14
  describe "integration tests" do
15
15
  include_examples "base usage"
@@ -22,7 +22,16 @@ describe "Delayed Job" do
22
22
  end
23
23
 
24
24
  it "performs a job" do
25
- dummy.image = File.open("#{ROOT}/spec/fixtures/12k.png")
25
+ dummy.image = File.open("#{ROOT}/fixtures/12k.png")
26
+ Paperclip::Attachment.any_instance.expects(:reprocess!)
27
+ dummy.save!
28
+ Delayed::Job.last.payload_object.perform
29
+ end
30
+
31
+ it "is deprecated" do
32
+ ActiveSupport::Deprecation.expects(:warn)
33
+
34
+ dummy.image = File.open("#{ROOT}/fixtures/12k.png")
26
35
  Paperclip::Attachment.any_instance.expects(:reprocess!)
27
36
  dummy.save!
28
37
  Delayed::Job.last.payload_object.perform
@@ -162,7 +162,7 @@ shared_examples "base usage" do
162
162
  context "same url if same file assigned" do
163
163
  it "falls to missing while processing" do
164
164
  dummy.save!
165
- dummy.image = File.open("#{ROOT}/spec/fixtures/12k.png")
165
+ dummy.image = File.open("#{ROOT}/fixtures/12k.png")
166
166
  dummy.save!
167
167
  dummy.image.url.should start_with("/images/original/missing.png")
168
168
  process_jobs
@@ -7,7 +7,7 @@ describe "Resque" do
7
7
  Resque.remove_queue(:paperclip)
8
8
  end
9
9
 
10
- let(:dummy) { Dummy.new(:image => File.open("#{ROOT}/spec/fixtures/12k.png")) }
10
+ let(:dummy) { Dummy.new(:image => File.open("#{ROOT}/fixtures/12k.png")) }
11
11
 
12
12
  describe "integration tests" do
13
13
  include_examples "base usage"
@@ -20,7 +20,16 @@ describe "Resque" do
20
20
  end
21
21
 
22
22
  it "performs a job" do
23
- dummy.image = File.open("#{ROOT}/spec/fixtures/12k.png")
23
+ dummy.image = File.open("#{ROOT}/fixtures/12k.png")
24
+ Paperclip::Attachment.any_instance.expects(:reprocess!)
25
+ dummy.save!
26
+ DelayedPaperclip::Jobs::Resque.perform(dummy.class.name, dummy.id, :image)
27
+ end
28
+
29
+ it "is deprecated" do
30
+ ActiveSupport::Deprecation.expects(:warn)
31
+
32
+ dummy.image = File.open("#{ROOT}/fixtures/12k.png")
24
33
  Paperclip::Attachment.any_instance.expects(:reprocess!)
25
34
  dummy.save!
26
35
  DelayedPaperclip::Jobs::Resque.perform(dummy.class.name, dummy.id, :image)
@@ -8,7 +8,7 @@ describe "Sidekiq" do
8
8
  Sidekiq::Queues["paperclip"].clear
9
9
  end
10
10
 
11
- let(:dummy) { Dummy.new(:image => File.open("#{ROOT}/spec/fixtures/12k.png")) }
11
+ let(:dummy) { Dummy.new(:image => File.open("#{ROOT}/fixtures/12k.png")) }
12
12
 
13
13
  describe "integration tests" do
14
14
  include_examples "base usage"
@@ -21,7 +21,16 @@ describe "Sidekiq" do
21
21
  end
22
22
 
23
23
  it "performs a job" do
24
- dummy.image = File.open("#{ROOT}/spec/fixtures/12k.png")
24
+ dummy.image = File.open("#{ROOT}/fixtures/12k.png")
25
+ Paperclip::Attachment.any_instance.expects(:reprocess!)
26
+ dummy.save!
27
+ DelayedPaperclip::Jobs::Sidekiq.new.perform(dummy.class.name, dummy.id, :image)
28
+ end
29
+
30
+ it "is deprecated" do
31
+ ActiveSupport::Deprecation.expects(:warn)
32
+
33
+ dummy.image = File.open("#{ROOT}/fixtures/12k.png")
25
34
  Paperclip::Attachment.any_instance.expects(:reprocess!)
26
35
  dummy.save!
27
36
  DelayedPaperclip::Jobs::Sidekiq.new.perform(dummy.class.name, dummy.id, :image)
data/spec/spec_helper.rb CHANGED
@@ -2,9 +2,6 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
3
 
4
4
  require 'active_record'
5
- require 'active_record/version'
6
- require 'active_support'
7
- require 'active_support/core_ext'
8
5
  require 'rspec'
9
6
  require 'fakeredis/rspec'
10
7
  require 'mocha/api'
@@ -25,13 +22,15 @@ Paperclip::Railtie.insert
25
22
  require 'delayed_paperclip/railtie'
26
23
  DelayedPaperclip::Railtie.insert
27
24
 
28
-
29
-
30
25
  # silence deprecation warnings in rails 4.2
31
- if ActiveRecord::Base.respond_to?(:raise_in_transactional_callbacks=)
26
+ # in Rails 5 this setting is deprecated and has no effect
27
+ if ActiveRecord::Base.respond_to?(:raise_in_transactional_callbacks=) && Rails::VERSION::MAJOR < 5
32
28
  ActiveRecord::Base.raise_in_transactional_callbacks = true
33
29
  end
34
30
 
31
+ require "active_support/deprecation"
32
+ ActiveSupport::Deprecation.silenced = true
33
+
35
34
  # Connect to sqlite
36
35
  ActiveRecord::Base.establish_connection(
37
36
  "adapter" => "sqlite3",
@@ -39,10 +38,8 @@ ActiveRecord::Base.establish_connection(
39
38
  )
40
39
 
41
40
  # Path for filesystem writing
42
- ROOT = Pathname(File.expand_path(File.join(File.dirname(__FILE__), '..')))
43
-
44
- FIXTURES_DIR = File.join(File.dirname(__FILE__), "fixtures")
45
- ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
41
+ ROOT = Pathname.new(File.expand_path("../.", __FILE__))
42
+ ActiveRecord::Base.logger = Logger.new(ROOT.join("tmp/debug.log"))
46
43
  Paperclip.logger = ActiveRecord::Base.logger
47
44
 
48
45
  RSpec.configure do |config|
@@ -70,7 +67,7 @@ end
70
67
  # We're requiring the MockInterpolator object to be used
71
68
  require Gem.find_files("../spec/support/mock_interpolator").first
72
69
 
73
- Dir["./spec/integration/examples/*.rb"].sort.each {|f| require f}
70
+ Dir["./spec/integration/examples/*.rb"].sort.each { |f| require f }
74
71
 
75
72
  # Reset table and class with image_processing column or not
76
73
  def reset_dummy(options = {})
@@ -118,10 +115,9 @@ def reset_class(class_name, options)
118
115
  def reprocess
119
116
  image.reprocess!
120
117
  end
121
-
122
118
  end
123
119
 
124
- Rails.stubs(:root).returns(Pathname.new(ROOT).join('spec', 'tmp'))
120
+ Rails.stubs(:root).returns(ROOT.join("tmp"))
125
121
  klass.reset_column_information
126
122
  klass
127
123
  end
data/spec/tmp/.keep ADDED
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delayed_paperclip
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.2
4
+ version: 2.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Storimer
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-04-27 00:00:00.000000000 Z
14
+ date: 2016-05-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: paperclip
@@ -218,6 +218,7 @@ files:
218
218
  - gemfiles/4.0.gemfile
219
219
  - gemfiles/4.1.gemfile
220
220
  - gemfiles/4.2.gemfile
221
+ - gemfiles/5.0.gemfile
221
222
  - init.rb
222
223
  - lib/delayed_paperclip.rb
223
224
  - lib/delayed_paperclip/attachment.rb
@@ -246,6 +247,7 @@ files:
246
247
  - spec/integration/resque_spec.rb
247
248
  - spec/integration/sidekiq_spec.rb
248
249
  - spec/spec_helper.rb
250
+ - spec/tmp/.keep
249
251
  homepage: http://github.com/jrgifford/delayed_paperclip
250
252
  licenses: []
251
253
  metadata: {}
@@ -265,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
265
267
  version: '0'
266
268
  requirements: []
267
269
  rubyforge_project:
268
- rubygems_version: 2.6.2
270
+ rubygems_version: 2.4.5
269
271
  signing_key:
270
272
  specification_version: 4
271
273
  summary: Process your Paperclip attachments in the background.
@@ -286,3 +288,4 @@ test_files:
286
288
  - spec/integration/resque_spec.rb
287
289
  - spec/integration/sidekiq_spec.rb
288
290
  - spec/spec_helper.rb
291
+ - spec/tmp/.keep