delayed_paperclip 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -1,35 +1,39 @@
1
1
  h1. Delayed::Paperclip
2
2
 
3
- Delayed_paperclip lets you process your "Paperclip":http://github.com/thoughtbot/paperclip attachments in a background task with "delayed_job":http://github.com/tobi/delayed_job.
4
-
5
- This is a fork that focuses on "Resque":http://github.com/defunkt/resque rather than Delayed::Job. Everyone says that "they are both awesome":http://github.com/blog/542-introducing-resque, but, in my case, I'm already committed to using "Vanity":http://vanity.labnotes.org/ and, I'm no expert, but "redis and Vanity":http://groups.google.com/group/vanity-talk/browse_thread/thread/db6c106581a26c46/eccff9396bdb2fe8?show_docid=eccff9396bdb2fe8&fwc=1&pli=1# look like they're likely to go hand in hand for some time.
3
+ Delayed_paperclip lets you process your "Paperclip":http://github.com/thoughtbot/paperclip attachments in a background task with "delayed_job":http://github.com/tobi/delayed_job or "Resque":http://github.com/defunkt/resque.
6
4
 
7
5
  h2. Why?
8
6
 
9
- The "original author":http://github.com/jstorimer/delayed_paperclip says:
7
+ The most common use case for Paperclip is to easily attach image files to ActiveRecord models. Most of the time these image files will have multiple styles and will need to be resized when they are created. This is usually a pretty "slow operation":http://www.jstorimer.com/ruby/2010/01/05/speep-up-your-paperclip-tests.html and should be handled in a background task.
8
+
9
+ I'm sure that everyone knows this, this gem just makes it easy to do.
10
10
 
11
- bq. The most common use case for Paperclip is to easily attach image files to ActiveRecord models. Most of the time these image files will have multiple styles and will need to be resized when they are created. This is usually a pretty "slow operation":http://www.jstorimer.com/ruby/2010/01/05/speep-up-your-paperclip-tests.html and should be handled in a background task.
11
+ h2. Installation
12
12
 
13
- bq. I'm sure that everyone knows this, this gem just makes it easy to do.
13
+ Install the gem:
14
14
 
15
- I am also concerned with the "memory usage of ImageMagick":http://magick.imagemagick.org/script/architecture.php#cache and didn't want a few bad actors to be able to take down my site just by uploading some big pictures.
15
+ <pre><code>sudo gem install delayed_paperclip</code></pre>
16
16
 
17
- h2. Installation
17
+ Add it to your environment.rb:
18
18
 
19
- Not only do I have no idea how I would enable some kind of "two gems" approach, but also I don't know what the future of this project is, necessarily. But it does work, and maybe you'll find it useful.
19
+ <pre><code>config.gem 'delayed_paperclip'</code></pre>
20
+
21
+ Or, even better, to your Gemfile:
22
+
23
+ <pre><code>source "http://gemcutter.org"
24
+ gem 'delayed_paperclip'
25
+ </code></pre>
20
26
 
21
- Install as a rails plugin:
27
+ Or install as a rails plugin:
22
28
 
23
- <pre><code>script/plugin install git://github.com/bigfleet/delayed_paperclip.git</code></pre>
29
+ <pre><code>script/plugin install git://github.com/jstorimer/delayed_paperclip.git</code></pre>
24
30
 
25
31
  Dependencies:
26
32
  * Paperclip
27
- * resque
33
+ * DJ or Resque
28
34
 
29
35
  h2. Usage
30
36
 
31
- Make sure that you have "Resque":http://github.com/defunkt/resque up and running. The jobs will be dispatched to the <code>:paperclip</code> queue, so you can correctly dispatch your worker. Configure resque and your worker exactly as you would otherwise.
32
-
33
37
  In your model:
34
38
 
35
39
  <pre><code>
@@ -42,6 +46,14 @@ In your model:
42
46
 
43
47
  Use your Paperclip attachment just like always in controllers and views.
44
48
 
49
+ h3. Resque
50
+
51
+ Make sure that you have "Resque":http://github.com/defunkt/resque up and running. The jobs will be dispatched to the <code>:paperclip</code> queue, so you can correctly dispatch your worker. Configure resque and your worker exactly as you would otherwise.
52
+
53
+ h3. DJ
54
+
55
+ Just make sure that you have DJ up and running.
56
+
45
57
  h2. What if I'm not using images?
46
58
 
47
59
  AFAIK this library should work no matter what kind of post-processing you are doing with Paperclip.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{delayed_paperclip}
8
- s.version = "0.5.0"
8
+ s.version = "0.5.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jesse Storimer"]
12
- s.date = %q{2010-02-09}
12
+ s.date = %q{2010-02-12}
13
13
  s.description = %q{Process your Paperclip attachments in the background with delayed_job.}
14
14
  s.email = %q{jesse@jstorimer.com}
15
15
  s.extra_rdoc_files = [
@@ -21,7 +21,7 @@ module Delayed
21
21
  define_method "enqueue_job_for_#{name}" do
22
22
  if self.send("#{name}_changed?")
23
23
  if delayed_job?
24
- Delayed::Job.enqueue DelayedPaperclipJob.new(read_attribute(:id), self.class.name, name.to_sym)
24
+ Delayed::Job.enqueue DelayedPaperclipJob.new(self.class.name, read_attribute(:id), name.to_sym)
25
25
  elsif resque?
26
26
  Resque.enqueue(ResquePaperclipJob, self.class.name, read_attribute(:id), name.to_sym)
27
27
  end
@@ -51,12 +51,13 @@ class DelayedPaperclipTest < Test::Unit::TestCase
51
51
  end
52
52
 
53
53
  def test_perform_job
54
+ @dummy.stubs(:image_changed?).returns(true)
54
55
  Paperclip::Attachment.any_instance.expects(:reprocess!)
55
56
 
56
57
  @dummy.save!
57
- DelayedPaperclipJob.new(@dummy.class.name, @dummy.id, :image).perform
58
+ Delayed::Job.last.payload_object.perform
58
59
  end
59
-
60
+
60
61
  def test_after_callback_is_functional
61
62
  @dummy_class.send(:define_method, :done_processing) { puts 'done' }
62
63
  @dummy_class.after_image_post_process :done_processing
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: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Storimer
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-09 00:00:00 -05:00
12
+ date: 2010-02-12 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency