delayed_paperclip 2.7.0 → 2.7.1

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: 39e783ff8099e58b8da9162334e1d129f0103030
4
- data.tar.gz: 07f048dfc6d2f630972d05e1884da1877885b3d5
3
+ metadata.gz: 3da45f87f8ee8a55f4b3c7c6ba763f6a2680f651
4
+ data.tar.gz: 56d4c5b2724facc8e70682b93a3c2196911e673f
5
5
  SHA512:
6
- metadata.gz: 0e54b03d471c7f99d997bc61e0dba8b3cb3ad198ade0876d411152c5fe7324ce08fe121b4883da69f5dc29b8a6cbf985009e24c4142966d175bc609d1021a6f5
7
- data.tar.gz: a87ba2994e205635505b28859c58147ab7af689b3ec146421b4f6a224e903b689a313cfb443d8ebc188b8279d852dd0aa035b2a6d4bcde8157a6a7e57ccc548d
6
+ metadata.gz: 9408a28957b8007e2503a93927ad61995bf39c61a40d3e384f774e19494b035633d716f2849c3dd9eab281da2d05565cf300ad877005be16623c53c24b82ee7e
7
+ data.tar.gz: 5c4ba36bca41329090a6e0ffbc92888c36243768d7a30ced5e5062534e478502bf1cccb40859e7b649e8ad3987c7ed8df1551c9fd5d26a444f5f86016c35122b
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.add_development_dependency 'delayed_job'
20
20
  s.add_development_dependency 'delayed_job_active_record'
21
21
  s.add_development_dependency 'resque'
22
- s.add_development_dependency 'sidekiq'
22
+ s.add_development_dependency 'sidekiq', '< 3.0'
23
23
  s.add_development_dependency 'appraisal'
24
24
  s.add_development_dependency 'rake'
25
25
  s.add_development_dependency 'bundler'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- delayed_paperclip (2.7.0)
4
+ delayed_paperclip (2.7.1)
5
5
  paperclip (>= 3.3)
6
6
 
7
7
  GEM
@@ -44,9 +44,9 @@ GEM
44
44
  timers (~> 1.1.0)
45
45
  climate_control (0.0.3)
46
46
  activesupport (>= 3.0)
47
- cocaine (0.5.3)
47
+ cocaine (0.5.4)
48
48
  climate_control (>= 0.0.3, < 1.0)
49
- connection_pool (1.2.0)
49
+ connection_pool (2.0.0)
50
50
  delayed_job (4.0.0)
51
51
  activesupport (>= 3.0, < 4.1)
52
52
  delayed_job_active_record (4.0.0)
@@ -61,13 +61,13 @@ GEM
61
61
  i18n (>= 0.4.0)
62
62
  mime-types (~> 1.16)
63
63
  treetop (~> 1.4.8)
64
- metaclass (0.0.3)
64
+ metaclass (0.0.4)
65
65
  mime-types (1.25.1)
66
66
  mocha (1.0.0)
67
67
  metaclass (~> 0.0.1)
68
68
  mono_logger (1.1.0)
69
69
  multi_json (1.8.4)
70
- paperclip (4.1.0)
70
+ paperclip (4.1.1)
71
71
  activemodel (>= 3.0.0)
72
72
  activesupport (>= 3.0.0)
73
73
  cocaine (~> 0.5.3)
@@ -105,21 +105,21 @@ GEM
105
105
  redis (3.0.7)
106
106
  redis-namespace (1.4.1)
107
107
  redis (~> 3.0.4)
108
- resque (1.25.1)
108
+ resque (1.25.2)
109
109
  mono_logger (~> 1.0)
110
110
  multi_json (~> 1.0)
111
- redis-namespace (~> 1.2)
111
+ redis-namespace (~> 1.3)
112
112
  sinatra (>= 0.9.2)
113
113
  vegas (~> 0.1.2)
114
114
  rspec (2.14.1)
115
115
  rspec-core (~> 2.14.0)
116
116
  rspec-expectations (~> 2.14.0)
117
117
  rspec-mocks (~> 2.14.0)
118
- rspec-core (2.14.7)
118
+ rspec-core (2.14.8)
119
119
  rspec-expectations (2.14.5)
120
120
  diff-lcs (>= 1.1.3, < 2.0)
121
- rspec-mocks (2.14.5)
122
- sidekiq (2.17.6)
121
+ rspec-mocks (2.14.6)
122
+ sidekiq (2.17.7)
123
123
  celluloid (>= 0.15.2)
124
124
  connection_pool (>= 1.0.0)
125
125
  json
@@ -133,7 +133,7 @@ GEM
133
133
  hike (~> 1.2)
134
134
  rack (~> 1.0)
135
135
  tilt (~> 1.1, != 1.3.0)
136
- sqlite3 (1.3.8)
136
+ sqlite3 (1.3.9)
137
137
  thor (0.14.6)
138
138
  tilt (1.4.1)
139
139
  timers (1.1.0)
@@ -159,5 +159,5 @@ DEPENDENCIES
159
159
  rake
160
160
  resque
161
161
  rspec
162
- sidekiq
162
+ sidekiq (< 3.0)
163
163
  sqlite3
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- delayed_paperclip (2.7.0)
4
+ delayed_paperclip (2.7.1)
5
5
  paperclip (>= 3.3)
6
6
 
7
7
  GEM
@@ -43,9 +43,9 @@ GEM
43
43
  timers (~> 1.1.0)
44
44
  climate_control (0.0.3)
45
45
  activesupport (>= 3.0)
46
- cocaine (0.5.3)
46
+ cocaine (0.5.4)
47
47
  climate_control (>= 0.0.3, < 1.0)
48
- connection_pool (1.2.0)
48
+ connection_pool (2.0.0)
49
49
  delayed_job (4.0.0)
50
50
  activesupport (>= 3.0, < 4.1)
51
51
  delayed_job_active_record (4.0.0)
@@ -60,13 +60,13 @@ GEM
60
60
  mail (2.5.4)
61
61
  mime-types (~> 1.16)
62
62
  treetop (~> 1.4.8)
63
- metaclass (0.0.3)
63
+ metaclass (0.0.4)
64
64
  mime-types (1.25.1)
65
65
  mocha (1.0.0)
66
66
  metaclass (~> 0.0.1)
67
67
  mono_logger (1.1.0)
68
68
  multi_json (1.8.4)
69
- paperclip (4.1.0)
69
+ paperclip (4.1.1)
70
70
  activemodel (>= 3.0.0)
71
71
  activesupport (>= 3.0.0)
72
72
  cocaine (~> 0.5.3)
@@ -102,21 +102,21 @@ GEM
102
102
  redis (3.0.7)
103
103
  redis-namespace (1.4.1)
104
104
  redis (~> 3.0.4)
105
- resque (1.25.1)
105
+ resque (1.25.2)
106
106
  mono_logger (~> 1.0)
107
107
  multi_json (~> 1.0)
108
- redis-namespace (~> 1.2)
108
+ redis-namespace (~> 1.3)
109
109
  sinatra (>= 0.9.2)
110
110
  vegas (~> 0.1.2)
111
111
  rspec (2.14.1)
112
112
  rspec-core (~> 2.14.0)
113
113
  rspec-expectations (~> 2.14.0)
114
114
  rspec-mocks (~> 2.14.0)
115
- rspec-core (2.14.7)
115
+ rspec-core (2.14.8)
116
116
  rspec-expectations (2.14.5)
117
117
  diff-lcs (>= 1.1.3, < 2.0)
118
- rspec-mocks (2.14.5)
119
- sidekiq (2.17.6)
118
+ rspec-mocks (2.14.6)
119
+ sidekiq (2.17.7)
120
120
  celluloid (>= 0.15.2)
121
121
  connection_pool (>= 1.0.0)
122
122
  json
@@ -131,7 +131,7 @@ GEM
131
131
  multi_json (~> 1.0)
132
132
  rack (~> 1.0)
133
133
  tilt (~> 1.1, != 1.3.0)
134
- sqlite3 (1.3.8)
134
+ sqlite3 (1.3.9)
135
135
  thor (0.18.1)
136
136
  tilt (1.4.1)
137
137
  timers (1.1.0)
@@ -157,5 +157,5 @@ DEPENDENCIES
157
157
  rake
158
158
  resque
159
159
  rspec
160
- sidekiq
160
+ sidekiq (< 3.0)
161
161
  sqlite3
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- delayed_paperclip (2.7.0)
4
+ delayed_paperclip (2.7.1)
5
5
  paperclip (>= 3.3)
6
6
 
7
7
  GEM
@@ -41,9 +41,9 @@ GEM
41
41
  timers (~> 1.1.0)
42
42
  climate_control (0.0.3)
43
43
  activesupport (>= 3.0)
44
- cocaine (0.5.3)
44
+ cocaine (0.5.4)
45
45
  climate_control (>= 0.0.3, < 1.0)
46
- connection_pool (1.2.0)
46
+ connection_pool (2.0.0)
47
47
  delayed_job (4.0.0)
48
48
  activesupport (>= 3.0, < 4.1)
49
49
  delayed_job_active_record (4.0.0)
@@ -57,14 +57,14 @@ GEM
57
57
  mail (2.5.4)
58
58
  mime-types (~> 1.16)
59
59
  treetop (~> 1.4.8)
60
- metaclass (0.0.3)
60
+ metaclass (0.0.4)
61
61
  mime-types (1.25.1)
62
62
  minitest (4.7.5)
63
63
  mocha (1.0.0)
64
64
  metaclass (~> 0.0.1)
65
65
  mono_logger (1.1.0)
66
66
  multi_json (1.8.4)
67
- paperclip (4.1.0)
67
+ paperclip (4.1.1)
68
68
  activemodel (>= 3.0.0)
69
69
  activesupport (>= 3.0.0)
70
70
  cocaine (~> 0.5.3)
@@ -92,21 +92,21 @@ GEM
92
92
  redis (3.0.7)
93
93
  redis-namespace (1.4.1)
94
94
  redis (~> 3.0.4)
95
- resque (1.25.1)
95
+ resque (1.25.2)
96
96
  mono_logger (~> 1.0)
97
97
  multi_json (~> 1.0)
98
- redis-namespace (~> 1.2)
98
+ redis-namespace (~> 1.3)
99
99
  sinatra (>= 0.9.2)
100
100
  vegas (~> 0.1.2)
101
101
  rspec (2.14.1)
102
102
  rspec-core (~> 2.14.0)
103
103
  rspec-expectations (~> 2.14.0)
104
104
  rspec-mocks (~> 2.14.0)
105
- rspec-core (2.14.7)
105
+ rspec-core (2.14.8)
106
106
  rspec-expectations (2.14.5)
107
107
  diff-lcs (>= 1.1.3, < 2.0)
108
- rspec-mocks (2.14.5)
109
- sidekiq (2.17.6)
108
+ rspec-mocks (2.14.6)
109
+ sidekiq (2.17.7)
110
110
  celluloid (>= 0.15.2)
111
111
  connection_pool (>= 1.0.0)
112
112
  json
@@ -125,7 +125,7 @@ GEM
125
125
  actionpack (>= 3.0)
126
126
  activesupport (>= 3.0)
127
127
  sprockets (~> 2.8)
128
- sqlite3 (1.3.8)
128
+ sqlite3 (1.3.9)
129
129
  thor (0.18.1)
130
130
  thread_safe (0.1.3)
131
131
  atomic
@@ -153,5 +153,5 @@ DEPENDENCIES
153
153
  rake
154
154
  resque
155
155
  rspec
156
- sidekiq
156
+ sidekiq (< 3.0)
157
157
  sqlite3
@@ -7,7 +7,6 @@ module DelayedPaperclip
7
7
  base.alias_method_chain :post_processing, :delay
8
8
  base.alias_method_chain :post_processing=, :delay
9
9
  base.alias_method_chain :save, :prepare_enqueueing
10
- base.alias_method_chain :after_flush_writes, :processing
11
10
  end
12
11
 
13
12
  module InstanceMethods
@@ -57,6 +56,7 @@ module DelayedPaperclip
57
56
  self.post_processing = true
58
57
  reprocess!(*delayed_options[:only_process])
59
58
  self.job_is_processing = false
59
+ update_processing_column
60
60
  end
61
61
 
62
62
  def processing_image_url
@@ -65,18 +65,6 @@ module DelayedPaperclip
65
65
  processing_image_url
66
66
  end
67
67
 
68
- # Updates _processing column to false
69
- def after_flush_writes_with_processing(*args)
70
- after_flush_writes_without_processing(*args)
71
- # update_column is available in rails 3.1 instead we can do this to update the attribute without callbacks
72
-
73
- # instance.update_column("#{name}_processing", false) if instance.respond_to?(:"#{name}_processing?")
74
- if instance.respond_to?(:"#{name}_processing?")
75
- instance.send("#{name}_processing=", false)
76
- instance.class.where(instance.class.primary_key => instance.id).update_all({ "#{name}_processing" => false })
77
- end
78
- end
79
-
80
68
  def save_with_prepare_enqueueing
81
69
  was_dirty = @dirty
82
70
 
@@ -92,6 +80,15 @@ module DelayedPaperclip
92
80
  reprocess!(*style_args)
93
81
  end
94
82
 
83
+ private
84
+
85
+ def update_processing_column
86
+ if instance.respond_to?(:"#{name}_processing?")
87
+ instance.send("#{name}_processing=", false)
88
+ instance.class.where(instance.class.primary_key => instance.id).update_all({ "#{name}_processing" => false })
89
+ end
90
+ end
91
+
95
92
  end
96
93
  end
97
94
  end
@@ -18,9 +18,13 @@ module DelayedPaperclip
18
18
  ), options)
19
19
  end
20
20
 
21
+ # This method is a mess
21
22
  def most_appropriate_url_with_processed(style = nil)
22
23
  if @attachment.original_filename.nil? || delayed_default_url?(style)
23
- if @attachment.delayed_options.nil? || @attachment.processing_image_url.nil? || !@attachment.processing?
24
+ if @attachment.delayed_options.nil? ||
25
+ @attachment.processing_image_url.nil? ||
26
+ !@attachment.processing?
27
+
24
28
  default_url
25
29
  else
26
30
  @attachment.processing_image_url
@@ -44,18 +48,10 @@ module DelayedPaperclip
44
48
  return false if not @attachment.delayed_options.try(:[], :url_with_processing)
45
49
  return false if not processing?(style)
46
50
  true
47
-
48
- # OLD CRAZY CONDITIONAL
49
- # TODO: Delete
50
- # !(
51
- # @attachment.job_is_processing ||
52
- # @attachment.dirty? ||
53
- # !@attachment.delayed_options.try(:[], :url_with_processing) ||
54
- # !(@attachment.instance.respond_to?(:"#{@attachment.name}_processing?") && @attachment.processing?)
55
- # )
56
51
  end
57
52
 
58
53
  private
54
+
59
55
  def processing?(style)
60
56
  return true if @attachment.processing?
61
57
 
@@ -1,3 +1,3 @@
1
1
  module DelayedPaperclip
2
- VERSION = "2.7.0"
2
+ VERSION = "2.7.1"
3
3
  end
@@ -166,21 +166,14 @@ describe DelayedPaperclip::Attachment do
166
166
  end
167
167
  end
168
168
 
169
- describe "#after_flush_writes_with_processing" do
169
+ describe "#update_processing_column" do
170
170
  it "updates the column to false" do
171
171
  dummy.update_attribute(:image_processing, true)
172
172
 
173
- dummy.image.after_flush_writes_with_processing
173
+ dummy.image.send(:update_processing_column)
174
174
 
175
175
  dummy.image_processing.should be_false
176
176
  end
177
-
178
- it "still flushes temp files" do
179
- dummy.image = File.open("#{ROOT}/spec/fixtures/12k.png")
180
- paths = dummy.image.queued_for_write.values.map(&:path)
181
- dummy.image.after_flush_writes_with_processing
182
- paths.none?{ |path| File.exists?(path) }.should be_true
183
- end
184
177
  end
185
178
 
186
179
  describe "#save_with_prepare_enqueueing" do
@@ -55,12 +55,8 @@ describe DelayedPaperclip::InstanceMethods do
55
55
  end
56
56
 
57
57
  describe "#prepare_enqueueing_for" do
58
-
59
58
  it "updates processing column to true" do
60
- pending
61
- # TODO: Why would it be writing the attribute here as well as in mark_enqueue_delayed_processing
62
59
  dummy.image_processing.should be_false
63
- dummy.expects(:write_attribute).with("image_processing", true)
64
60
  dummy.prepare_enqueueing_for("image")
65
61
  dummy.image_processing.should be_true
66
62
  end
@@ -83,7 +83,7 @@ describe DelayedPaperclip::UrlGenerator do
83
83
 
84
84
  context "with processing_image_url" do
85
85
  before :each do
86
- attachment.stubs(:processing_image_url).returns "/processing/image.jpg"\
86
+ attachment.stubs(:processing_image_url).returns "/processing/image.jpg"
87
87
  end
88
88
 
89
89
  context "and is processing" do
Binary file
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Base Delayed Paperclip Integration" do
4
+ before :all do
5
+ DelayedPaperclip.options[:background_job_class] = DelayedPaperclip::Jobs::Resque
6
+ Resque.remove_queue(:paperclip)
7
+ end
8
+
9
+ let(:dummy) { Dummy.create }
10
+
11
+ before :each do
12
+ reset_dummy(paperclip: { default_url: "/../../fixtures/missing.png" })
13
+ end
14
+
15
+ describe "double save" do
16
+ before :each do
17
+ dummy.image_processing.should be_false
18
+ dummy.image = File.open("#{ROOT}/spec/fixtures/12k.png")
19
+ dummy.save!
20
+ end
21
+
22
+ it "processing column remains true" do
23
+ dummy.image_processing.should be_true
24
+ dummy.save!
25
+ dummy.image_processing.should be_true
26
+ end
27
+ end
28
+
29
+ end
@@ -46,6 +46,7 @@ Dir["./spec/integration/examples/*.rb"].sort.each {|f| require f}
46
46
  def reset_dummy(options = {})
47
47
  options[:with_processed] = true unless options.key?(:with_processed)
48
48
  options[:processed_column] = options[:with_processed] unless options.has_key?(:processed_column)
49
+
49
50
  build_dummy_table(options.delete(:processed_column))
50
51
  reset_class("Dummy", options)
51
52
  end
@@ -76,8 +77,7 @@ def reset_class(class_name, options)
76
77
  klass.class_eval do
77
78
  include Paperclip::Glue
78
79
 
79
- has_attached_file :image, options[:paperclip]
80
- options.delete(:paperclip)
80
+ has_attached_file :image, options.delete(:paperclip)
81
81
 
82
82
  validates_attachment :image, :content_type => { :content_type => "image/png" }
83
83
 
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.7.0
4
+ version: 2.7.1
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: 2014-02-19 00:00:00.000000000 Z
14
+ date: 2014-03-28 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: paperclip
@@ -115,16 +115,16 @@ dependencies:
115
115
  name: sidekiq
116
116
  requirement: !ruby/object:Gem::Requirement
117
117
  requirements:
118
- - - '>='
118
+ - - <
119
119
  - !ruby/object:Gem::Version
120
- version: '0'
120
+ version: '3.0'
121
121
  type: :development
122
122
  prerelease: false
123
123
  version_requirements: !ruby/object:Gem::Requirement
124
124
  requirements:
125
- - - '>='
125
+ - - <
126
126
  - !ruby/object:Gem::Version
127
- version: '0'
127
+ version: '3.0'
128
128
  - !ruby/object:Gem::Dependency
129
129
  name: appraisal
130
130
  requirement: !ruby/object:Gem::Requirement
@@ -226,6 +226,8 @@ files:
226
226
  - spec/delayed_paperclip/url_generator_spec.rb
227
227
  - spec/delayed_paperclip_spec.rb
228
228
  - spec/fixtures/12k.png
229
+ - spec/fixtures/missing.png
230
+ - spec/integration/base_delayed_paperclip_spec.rb
229
231
  - spec/integration/delayed_job_spec.rb
230
232
  - spec/integration/examples/base.rb
231
233
  - spec/integration/resque_spec.rb
@@ -257,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
257
259
  version: '0'
258
260
  requirements: []
259
261
  rubyforge_project:
260
- rubygems_version: 2.1.11
262
+ rubygems_version: 2.2.2
261
263
  signing_key:
262
264
  specification_version: 4
263
265
  summary: Process your Paperclip attachments in the background.
@@ -268,6 +270,8 @@ test_files:
268
270
  - spec/delayed_paperclip/url_generator_spec.rb
269
271
  - spec/delayed_paperclip_spec.rb
270
272
  - spec/fixtures/12k.png
273
+ - spec/fixtures/missing.png
274
+ - spec/integration/base_delayed_paperclip_spec.rb
271
275
  - spec/integration/delayed_job_spec.rb
272
276
  - spec/integration/examples/base.rb
273
277
  - spec/integration/resque_spec.rb