Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove all the deprecated method
We've deprecate these method for a while, it's time to remove it.
  • Loading branch information
sikachu committed Mar 2, 2012
1 parent 5dba614 commit defd425
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 71 deletions.
17 changes: 2 additions & 15 deletions lib/paperclip.rb
Expand Up @@ -58,7 +58,6 @@ class << self
# * command_path: Defines the path at which to find the command line
# programs if they are not visible to Rails the system's search path. Defaults to
# nil, which uses the first executable found in the user's search path.
# * image_magick_path: Deprecated alias of command_path.
def options
@options ||= {
:whiny => true,
Expand Down Expand Up @@ -93,10 +92,7 @@ def interpolates key, &block
# :swallow_stderr -> Set to true if you don't care what happens on STDERR.
#
def run(cmd, arguments = "", local_options = {})
if options[:image_magick_path]
Paperclip.log("[DEPRECATION] :image_magick_path is deprecated and will be removed. Use :command_path instead")
end
command_path = options[:command_path] || options[:image_magick_path]
command_path = options[:command_path]
Cocaine::CommandLine.path = ( Cocaine::CommandLine.path ? [Cocaine::CommandLine.path, command_path ].flatten : command_path )
local_options = local_options.merge(:logger => logger) if logging? && (options[:log_command] || local_options[:log_command])
Cocaine::CommandLine.new(cmd, arguments, local_options).run
Expand Down Expand Up @@ -272,8 +268,7 @@ module ClassMethods
# Defaults to +false+.#
# * +whiny+: Will raise an error if Paperclip cannot post_process an uploaded file due
# to a command line error. This will override the global setting for this attachment.
# Defaults to true. This option used to be called :whiny_thumbanils, but this is
# deprecated.
# Defaults to true.
# * +convert_options+: When creating thumbnails, use this free-form options
# array to pass in various convert command options. Typical options are "-strip" to
# remove all Exif data from the image (save space for thumbnails and avatars) or
Expand Down Expand Up @@ -384,14 +379,6 @@ def validates_attachment_size name, options = {}
:allow_nil => true
end

# Adds errors if thumbnail creation fails. The same as specifying :whiny_thumbnails => true.
def validates_attachment_thumbnails name, options = {}
warn('[DEPRECATION] validates_attachment_thumbnail is deprecated. ' +
'This validation is on by default and will be removed from future versions. ' +
'If you wish to turn it off, supply :whiny => false in your definition.')
attachment_definitions[name][:whiny_thumbnails] = true
end

# Places ActiveRecord-style validations on the presence of a file.
# Options:
# * +if+: A lambda or name of an instance method. Validation will only
Expand Down
12 changes: 0 additions & 12 deletions lib/paperclip/attachment.rb
Expand Up @@ -302,18 +302,6 @@ def generate_fingerprint(source)
end
end

# Paths and URLs can have a number of variables interpolated into them
# to vary the storage location based on name, id, style, class, etc.
# This method is a deprecated access into supplying and retrieving these
# interpolations. Future access should use either Paperclip.interpolates
# or extend the Paperclip::Interpolations module directly.
def self.interpolations
warn('[DEPRECATION] Paperclip::Attachment.interpolations is deprecated ' +
'and will be removed from future versions. ' +
'Use Paperclip.interpolates instead')
Paperclip::Interpolations
end

# This method really shouldn't be called that often. It's expected use is
# in the paperclip:refresh rake task and that's it. It will regenerate all
# thumbnails forcefully, by reobtaining the original file and going through
Expand Down
44 changes: 0 additions & 44 deletions test/integration_test.rb
Expand Up @@ -223,48 +223,6 @@ class IntegrationTest < Test::Unit::TestCase
end
end

context "A model with no attachment validation" do
setup do
rebuild_model :styles => { :large => "300x300>",
:medium => "100x100",
:thumb => ["32x32#", :gif] },
:default_style => :medium,
:url => "/:attachment/:class/:style/:id/:basename.:extension",
:path => ":rails_root/tmp/:attachment/:class/:style/:id/:basename.:extension"
@dummy = Dummy.new
end

should "have its definition return false when asked about whiny_thumbnails" do
assert ! Dummy.attachment_definitions[:avatar][:whiny_thumbnails]
end

context "when validates_attachment_thumbnails is called" do
setup do
Dummy.validates_attachment_thumbnails :avatar
end

should "have its definition return true when asked about whiny_thumbnails" do
assert_equal true, Dummy.attachment_definitions[:avatar][:whiny_thumbnails]
end
end

context "redefined to have attachment validations" do
setup do
rebuild_model :styles => { :large => "300x300>",
:medium => "100x100",
:thumb => ["32x32#", :gif] },
:whiny_thumbnails => true,
:default_style => :medium,
:url => "/:attachment/:class/:style/:id/:basename.:extension",
:path => ":rails_root/tmp/:attachment/:class/:style/:id/:basename.:extension"
end

should "have its definition return true when asked about whiny_thumbnails" do
assert_equal true, Dummy.attachment_definitions[:avatar][:whiny_thumbnails]
end
end
end

context "A model with no convert_options setting" do
setup do
rebuild_model :styles => { :large => "300x300>",
Expand Down Expand Up @@ -334,7 +292,6 @@ class IntegrationTest < Test::Unit::TestCase
rebuild_model :styles => { :large => "300x300>",
:medium => "100x100",
:thumb => ["32x32#", :gif] },
:whiny_thumbnails => true,
:default_style => :medium,
:url => "/:attachment/:class/:style/:id/:basename.:extension",
:path => ":rails_root/tmp/:attachment/:class/:style/:id/:basename.:extension"
Expand Down Expand Up @@ -520,7 +477,6 @@ def s3_headers_for attachment, style
:medium => "100x100",
:thumb => ["32x32#", :gif] },
:storage => :s3,
:whiny_thumbnails => true,
:s3_credentials => File.new(File.join(File.dirname(__FILE__), "s3.yml")),
:default_style => :medium,
:bucket => ENV['S3_TEST_BUCKET'],
Expand Down

0 comments on commit defd425

Please sign in to comment.