delayed_paperclip 2.4.5.2 → 2.5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.textile +3 -10
- data/lib/delayed_paperclip/attachment.rb +4 -3
- data/test/base_delayed_paperclip_test.rb +14 -13
- metadata +11 -11
data/README.textile
CHANGED
@@ -12,21 +12,14 @@ h2. Installation
|
|
12
12
|
|
13
13
|
Install the gem:
|
14
14
|
|
15
|
-
<pre><code>
|
15
|
+
<pre><code>gem install delayed_paperclip</code></pre>
|
16
16
|
|
17
|
-
|
17
|
+
Or even better, add it to your Gemfile.
|
18
18
|
|
19
|
-
<pre><code>
|
20
|
-
|
21
|
-
Or, even better, to your Gemfile:
|
22
|
-
|
23
|
-
<pre><code>source "http://gemcutter.org"
|
19
|
+
<pre><code>source "https://rubygems.org"
|
24
20
|
gem 'delayed_paperclip'
|
25
21
|
</code></pre>
|
26
22
|
|
27
|
-
Or install as a rails plugin:
|
28
|
-
|
29
|
-
<pre><code>script/plugin install git://github.com/jstorimer/delayed_paperclip.git</code></pre>
|
30
23
|
|
31
24
|
Dependencies:
|
32
25
|
* Paperclip
|
@@ -7,7 +7,7 @@ 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 :
|
10
|
+
base.alias_method_chain :after_flush_writes, :processing
|
11
11
|
end
|
12
12
|
|
13
13
|
module InstanceMethods
|
@@ -38,12 +38,13 @@ module DelayedPaperclip
|
|
38
38
|
|
39
39
|
def process_delayed!
|
40
40
|
self.job_is_processing = true
|
41
|
+
self.post_processing = true
|
41
42
|
reprocess!
|
42
43
|
self.job_is_processing = false
|
43
44
|
end
|
44
45
|
|
45
|
-
def
|
46
|
-
|
46
|
+
def after_flush_writes_with_processing(*args)
|
47
|
+
after_flush_writes_without_processing(*args)
|
47
48
|
|
48
49
|
# update_column is available in rails 3.1 instead we can do this to update the attribute without callbacks
|
49
50
|
|
@@ -15,7 +15,7 @@ module BaseDelayedPaperclipTest
|
|
15
15
|
assert File.exists?(dummy.image.path)
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
18
|
+
def test_normal_explicit_post_processing_with_delayed_paperclip
|
19
19
|
reset_dummy :with_processed => true
|
20
20
|
dummy = Dummy.new(:image => File.open("#{ROOT}/test/fixtures/12k.png"))
|
21
21
|
dummy.image.post_processing = true
|
@@ -73,38 +73,39 @@ module BaseDelayedPaperclipTest
|
|
73
73
|
def test_unprocessed_image_returns_missing_url
|
74
74
|
dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png"))
|
75
75
|
dummy.save!
|
76
|
-
assert_equal "/images/original/missing.png", dummy.image.url(:original, :timestamp =>
|
76
|
+
#assert_equal "/images/original/missing.png", dummy.image.url(:original, :timestamp => true)
|
77
|
+
dummy.image.url.starts_with?("/images/original/missing.png")
|
77
78
|
process_jobs
|
78
79
|
dummy.reload
|
79
|
-
|
80
|
+
dummy.image.url.starts_with?("/system/images/1/original/12k.png")
|
80
81
|
end
|
81
82
|
|
82
|
-
def
|
83
|
+
def test_unprocessed_image_not_returning_missing_url_if_turned_of_globally
|
83
84
|
DelayedPaperclip.options[:url_with_processing] = false
|
84
85
|
reset_dummy :with_processed => false
|
85
86
|
dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png"))
|
86
87
|
dummy.save!
|
87
|
-
|
88
|
+
dummy.image.url.starts_with?("/system/images/1/original/12k.png")
|
88
89
|
process_jobs
|
89
90
|
dummy.reload
|
90
|
-
|
91
|
+
dummy.image.url.starts_with?("/system/images/1/original/12k.png")
|
91
92
|
end
|
92
93
|
|
93
|
-
def
|
94
|
+
def test_unprocessed_image_not_returning_missing_url_if_turned_of_on_instance
|
94
95
|
reset_dummy :with_processed => false, :url_with_processing => false
|
95
96
|
dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png"))
|
96
97
|
dummy.save!
|
97
|
-
|
98
|
+
dummy.image.url.starts_with?("/system/images/1/original/12k.png")
|
98
99
|
process_jobs
|
99
100
|
dummy.reload
|
100
|
-
|
101
|
+
dummy.image.url.starts_with?("/system/images/1/original/12k.png")
|
101
102
|
end
|
102
103
|
|
103
104
|
def test_original_url_when_no_processing_column
|
104
105
|
reset_dummy :with_processed => false
|
105
106
|
dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png"))
|
106
107
|
dummy.save!
|
107
|
-
|
108
|
+
dummy.image.url.starts_with?("/system/images/1/original/12k.png")
|
108
109
|
end
|
109
110
|
|
110
111
|
def test_original_url_if_image_changed
|
@@ -112,9 +113,9 @@ module BaseDelayedPaperclipTest
|
|
112
113
|
dummy.save!
|
113
114
|
dummy.image = File.open("#{RAILS_ROOT}/test/fixtures/12k.png")
|
114
115
|
dummy.save!
|
115
|
-
|
116
|
+
dummy.image.url.starts_with?("/images/original/missing.png")
|
116
117
|
process_jobs
|
117
|
-
|
118
|
+
dummy.image.url.starts_with?("/system/images/1/original/12k.png")
|
118
119
|
end
|
119
120
|
|
120
121
|
def test_missing_url_if_image_hasnt_changed
|
@@ -144,7 +145,7 @@ module BaseDelayedPaperclipTest
|
|
144
145
|
dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png"))
|
145
146
|
dummy.save!
|
146
147
|
process_jobs
|
147
|
-
dummy.
|
148
|
+
dummy.name = "foobar123"
|
148
149
|
end
|
149
150
|
|
150
151
|
end
|
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.
|
4
|
+
version: 2.5.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-
|
14
|
+
date: 2012-11-05 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: paperclip
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: 3.3.0
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -28,7 +28,7 @@ dependencies:
|
|
28
28
|
requirements:
|
29
29
|
- - ! '>='
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
version:
|
31
|
+
version: 3.3.0
|
32
32
|
- !ruby/object:Gem::Dependency
|
33
33
|
name: mocha
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,19 +104,19 @@ files:
|
|
104
104
|
- LICENSE
|
105
105
|
- Rakefile
|
106
106
|
- init.rb
|
107
|
-
- lib/delayed_paperclip
|
107
|
+
- lib/delayed_paperclip.rb
|
108
|
+
- lib/delayed_paperclip/railtie.rb
|
109
|
+
- lib/delayed_paperclip/attachment.rb
|
108
110
|
- lib/delayed_paperclip/url_generator.rb
|
109
|
-
- lib/delayed_paperclip/jobs/delayed_job.rb
|
110
111
|
- lib/delayed_paperclip/jobs/resque.rb
|
111
|
-
- lib/delayed_paperclip/
|
112
|
-
- lib/delayed_paperclip/
|
113
|
-
- lib/delayed_paperclip.rb
|
114
|
-
- test/database.yml
|
112
|
+
- lib/delayed_paperclip/jobs/delayed_job.rb
|
113
|
+
- lib/delayed_paperclip/jobs.rb
|
115
114
|
- test/base_delayed_paperclip_test.rb
|
116
|
-
- test/resque_paperclip_test.rb
|
117
115
|
- test/test_helper.rb
|
118
116
|
- test/fixtures/12k.png
|
119
117
|
- test/delayed_paperclip_test.rb
|
118
|
+
- test/database.yml
|
119
|
+
- test/resque_paperclip_test.rb
|
120
120
|
- rails/init.rb
|
121
121
|
homepage: http://github.com/jrgifford/delayed_paperclip
|
122
122
|
licenses: []
|