From e0a7e0fec760ba12c8067a37e10c96f1f05876e2 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Wed, 24 Jun 2026 04:13:16 +0200 Subject: Stage 1 complete: Rails 2.3.5 to Rails 3.2.22.5 upgrade - Converted plugins to gems (Gemfile) - Updated config structure (application.rb, boot.rb, environment.rb) - Converted routes to Rails 3 DSL - Converted named_scope to scope throughout models - Converted find(:all, :conditions) to where() chains - Fixed has_many :order to use ordering scope - Updated session store and secret token configuration - Fixed exception_notification middleware configuration - Patched Ruby 2.4 / Rails 3.2 incompatibilities: - Integer/Float duration arithmetic (ActiveSupport) - Arel visit_Integer for PostgreSQL adapter - create_database String/Integer coercion - ActionController consider_all_requests_local - Migrated taggings schema for acts-as-taggable-on - Replaced dynamic_form gem with custom form_error_messages helper - Fixed Rails 3 block helper syntax (form_for, form_tag, fields_for) - Fixed admin layout yield - Updated test suite for Rails 3 APIs --- .../plugins/paperclip/tasks/paperclip_tasks.rake | 79 ---------------------- 1 file changed, 79 deletions(-) delete mode 100644 vendor/plugins/paperclip/tasks/paperclip_tasks.rake (limited to 'vendor/plugins/paperclip/tasks') diff --git a/vendor/plugins/paperclip/tasks/paperclip_tasks.rake b/vendor/plugins/paperclip/tasks/paperclip_tasks.rake deleted file mode 100644 index 23e4c11a..00000000 --- a/vendor/plugins/paperclip/tasks/paperclip_tasks.rake +++ /dev/null @@ -1,79 +0,0 @@ -def obtain_class - class_name = ENV['CLASS'] || ENV['class'] - raise "Must specify CLASS" unless class_name - @klass = Object.const_get(class_name) -end - -def obtain_attachments - name = ENV['ATTACHMENT'] || ENV['attachment'] - raise "Class #{@klass.name} has no attachments specified" unless @klass.respond_to?(:attachment_definitions) - if !name.blank? && @klass.attachment_definitions.keys.include?(name) - [ name ] - else - @klass.attachment_definitions.keys - end -end - -def for_all_attachments - klass = obtain_class - names = obtain_attachments - ids = klass.connection.select_values(klass.send(:construct_finder_sql, :select => 'id')) - - ids.each do |id| - instance = klass.find(id) - names.each do |name| - result = if instance.send("#{ name }?") - yield(instance, name) - else - true - end - print result ? "." : "x"; $stdout.flush - end - end - puts " Done." -end - -namespace :paperclip do - desc "Refreshes both metadata and thumbnails." - task :refresh => ["paperclip:refresh:metadata", "paperclip:refresh:thumbnails"] - - namespace :refresh do - desc "Regenerates thumbnails for a given CLASS (and optional ATTACHMENT)." - task :thumbnails => :environment do - errors = [] - for_all_attachments do |instance, name| - result = instance.send(name).reprocess! - errors << [instance.id, instance.errors] unless instance.errors.blank? - result - end - errors.each{|e| puts "#{e.first}: #{e.last.full_messages.inspect}" } - end - - desc "Regenerates content_type/size metadata for a given CLASS (and optional ATTACHMENT)." - task :metadata => :environment do - for_all_attachments do |instance, name| - if file = instance.send(name).to_file - instance.send("#{name}_file_name=", instance.send("#{name}_file_name").strip) - instance.send("#{name}_content_type=", file.content_type.strip) - instance.send("#{name}_file_size=", file.size) if instance.respond_to?("#{name}_file_size") - instance.save(false) - else - true - end - end - end - end - - desc "Cleans out invalid attachments. Useful after you've added new validations." - task :clean => :environment do - for_all_attachments do |instance, name| - instance.send(name).send(:validate) - if instance.send(name).valid? - true - else - instance.send("#{name}=", nil) - instance.save - end - end - end -end -- cgit v1.3