From dd3caa116146ea9c2350d3d877098140f4ab834c Mon Sep 17 00:00:00 2001 From: Godwin Date: Sun, 6 Jul 2014 20:02:15 -0600 Subject: [PATCH] A small fix --- app/uploaders/avatar_uploader.rb | 34 ++++++++++++++++---------------- app/uploaders/poster_uploader.rb | 34 ++++++++++++++++---------------- config/unicorn.rb | 1 + lib/tasks/regenerate.rake | 4 ++-- 4 files changed, 37 insertions(+), 36 deletions(-) create mode 100644 config/unicorn.rb diff --git a/app/uploaders/avatar_uploader.rb b/app/uploaders/avatar_uploader.rb index a2ad53f..6a78847 100644 --- a/app/uploaders/avatar_uploader.rb +++ b/app/uploaders/avatar_uploader.rb @@ -79,22 +79,22 @@ class AvatarUploader < CarrierWave::Uploader::Base # super(*versions) #end - def manipulate! - cache_stored_file! if !cached? - image = ::MiniMagick::Image.open(current_path) - - begin - image.format(@format.to_s.downcase) if @format - image = yield(image) - image.write(current_path) - image.run_command("identify", '"' + current_path + '"') - ensure - image.destroy! - end - rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e - default = I18n.translate(:"errors.messages.mini_magick_processing_error", :e => e, :locale => :en) - message = I18n.translate(:"errors.messages.mini_magick_processing_error", :e => e, :default => default) - raise CarrierWave::ProcessingError, message - end +# def manipulate! +# cache_stored_file! if !cached? +# image = ::MiniMagick::Image.open(current_path) +# +# begin +# image.format(@format.to_s.downcase) if @format +# image = yield(image) +# image.write(current_path) +# image.run_command("identify", '"' + current_path + '"') +# ensure +# image.destroy! +# end +# rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e +# default = I18n.translate(:"errors.messages.mini_magick_processing_error", :e => e, :locale => :en) +# message = I18n.translate(:"errors.messages.mini_magick_processing_error", :e => e, :default => default) +# raise CarrierWave::ProcessingError, message +# end end diff --git a/app/uploaders/poster_uploader.rb b/app/uploaders/poster_uploader.rb index 518e00d..8d309ef 100644 --- a/app/uploaders/poster_uploader.rb +++ b/app/uploaders/poster_uploader.rb @@ -39,22 +39,22 @@ class PosterUploader < CarrierWave::Uploader::Base image['width'] > image['height'] end - def manipulate! - cache_stored_file! if !cached? - image = ::MiniMagick::Image.open(current_path) - - begin - image.format(@format.to_s.downcase) if @format - image = yield(image) - image.write(current_path) - image.run_command("identify", '"' + current_path + '"') - ensure - image.destroy! - end - rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e - default = I18n.translate(:"errors.messages.mini_magick_processing_error", :e => e, :locale => :en) - message = I18n.translate(:"errors.messages.mini_magick_processing_error", :e => e, :default => default) - raise CarrierWave::ProcessingError, message - end +# def manipulate! +# cache_stored_file! if !cached? +# image = ::MiniMagick::Image.open(current_path) +# +# begin +# image.format(@format.to_s.downcase) if @format +# image = yield(image) +# image.write(current_path) +# image.run_command("identify", '"' + current_path + '"') +# ensure +# image.destroy! +# end +# rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e +# default = I18n.translate(:"errors.messages.mini_magick_processing_error", :e => e, :locale => :en) +# message = I18n.translate(:"errors.messages.mini_magick_processing_error", :e => e, :default => default) +# raise CarrierWave::ProcessingError, message +# end end diff --git a/config/unicorn.rb b/config/unicorn.rb new file mode 100644 index 0000000..83b2c10 --- /dev/null +++ b/config/unicorn.rb @@ -0,0 +1 @@ +rails_env = ENV['RAILS_ENV'] || 'production' diff --git a/lib/tasks/regenerate.rake b/lib/tasks/regenerate.rake index 5be8282..2add483 100644 --- a/lib/tasks/regenerate.rake +++ b/lib/tasks/regenerate.rake @@ -15,7 +15,7 @@ namespace :regenerate do end task organization_covers: :environment do - #Organization.all.each {|m| m.cover.recreate_versions!} - puts Rails.configuration.database_configuration[Rails.env].to_json.to_s + Organization.all.each {|m| m.cover.recreate_versions!} + #puts Rails.configuration.database_configuration[Rails.env].to_json.to_s end end