Commit c9205f4f by Jon Yurek

Ok, so spawn doesn't work exactly right yet.

parent 701abb01
......@@ -60,7 +60,8 @@ module Paperclip
:whiny_thumbnails => true,
:image_magick_path => nil,
:command_path => nil,
:log => true
:log => true,
:swallow_stderr => true
}
end
......@@ -84,7 +85,9 @@ module Paperclip
# expected_outcodes, a PaperclipCommandLineError will be raised. Generally
# a code of 0 is expected, but a list of codes may be passed if necessary.
def run cmd, params = "", expected_outcodes = 0
output = `#{%Q[#{path_for_command(cmd)} #{params} 2>#{bit_bucket}].gsub(/\s+/, " ")}`
command = %Q<#{%Q[#{path_for_command(cmd)} #{params}].gsub(/\s+/, " ")}>
command = "#{command} 2>#{bit_bucket}" if Paperclip.options[:swallow_stderr]
output = `#{command}`
unless [expected_outcodes].flatten.include?($?.exitstatus)
raise PaperclipCommandLineError, "Error while running #{cmd}"
end
......
......@@ -353,11 +353,11 @@ module Paperclip
# When processing, if the spawn plugin is installed, processing can be done in
# a background fork or thread if desired.
def background(&blk)
if instance.respond_to?(:spawn) && @background
instance.spawn(&blk)
else
# if instance.respond_to?(:spawn) && @background
# instance.spawn(&blk)
# else
blk.call
end
# end
end
def callback which #:nodoc:
......
......@@ -232,19 +232,19 @@ class AttachmentTest < Test::Unit::TestCase
end
end
context "When spawn is defined on the instance" do
setup do
Dummy.any_instance.stubs(:spawn)
rebuild_model :styles => {:foo => true}
@dummy = Dummy.new
@file = StringIO.new("12345")
end
should "not call spawn on the instance when assigned a file" do
@dummy.expects(:spawn)
@dummy.avatar = @file
end
end
# context "When spawn is defined on the instance" do
# setup do
# Dummy.any_instance.stubs(:spawn)
# rebuild_model :styles => {:foo => true}
# @dummy = Dummy.new
# @file = StringIO.new("12345")
# end
# should "not call spawn on the instance when assigned a file" do
# @dummy.expects(:spawn)
# @dummy.avatar = @file
# end
# end
context "An attachment with no processors defined" do
setup do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment