mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Remove Paperclip
It has been replaced by Active Storage.
This commit is contained in:
@@ -441,7 +441,6 @@ Metrics/AbcSize:
|
||||
- 'lib/reporting/reports/payments/payments_report.rb'
|
||||
- 'lib/reporting/reports/sales_tax/sales_tax_report.rb'
|
||||
- 'lib/spree/core/controller_helpers/order.rb'
|
||||
- 'lib/spree/core/s3_support.rb'
|
||||
- 'lib/tasks/enterprises.rake'
|
||||
- 'spec/services/order_checkout_restart_spec.rb'
|
||||
|
||||
|
||||
1
Gemfile
1
Gemfile
@@ -86,7 +86,6 @@ gem 'bootsnap', require: false
|
||||
gem 'geocoder'
|
||||
gem 'gmaps4rails'
|
||||
gem 'mimemagic', '> 0.3.5'
|
||||
gem 'paperclip', '~> 3.4.1'
|
||||
gem 'paper_trail', '~> 12.1.0'
|
||||
gem 'rack-rewrite'
|
||||
gem 'rack-ssl', require: 'rack/ssl'
|
||||
|
||||
13
Gemfile.lock
13
Gemfile.lock
@@ -219,10 +219,7 @@ GEM
|
||||
rubyzip (>= 1.3.0, < 3)
|
||||
childprocess (4.1.0)
|
||||
chronic (0.10.2)
|
||||
climate_control (0.2.0)
|
||||
cliver (0.3.2)
|
||||
cocaine (0.5.8)
|
||||
climate_control (>= 0.0.3, < 1.0)
|
||||
coderay (1.1.3)
|
||||
coffee-rails (5.0.0)
|
||||
coffee-script (>= 2.2.0)
|
||||
@@ -392,9 +389,6 @@ GEM
|
||||
marcel (1.0.2)
|
||||
matrix (0.4.2)
|
||||
method_source (1.0.0)
|
||||
mime-types (3.3.1)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2021.0225)
|
||||
mimemagic (0.4.3)
|
||||
nokogiri (~> 1)
|
||||
rake
|
||||
@@ -427,12 +421,6 @@ GEM
|
||||
paper_trail (12.1.0)
|
||||
activerecord (>= 5.2)
|
||||
request_store (~> 1.1)
|
||||
paperclip (3.4.2)
|
||||
activemodel (>= 3.0.0)
|
||||
activerecord (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
cocaine (~> 0.5.0)
|
||||
mime-types
|
||||
parallel (1.21.0)
|
||||
paranoia (2.4.3)
|
||||
activerecord (>= 4.0, < 6.2)
|
||||
@@ -785,7 +773,6 @@ DEPENDENCIES
|
||||
order_management!
|
||||
pagy (~> 5.1)
|
||||
paper_trail (~> 12.1.0)
|
||||
paperclip (~> 3.4.1)
|
||||
paranoia (~> 2.4)
|
||||
paypal-sdk-merchant (= 1.117.2)
|
||||
pdf-reader
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
Paperclip::Attachment.default_options[:source_file_options] = {
|
||||
all: "-auto-orient"
|
||||
}
|
||||
|
||||
url_adapters = [
|
||||
"Paperclip::UriAdapter",
|
||||
"Paperclip::HttpUrlProxyAdapter",
|
||||
"Paperclip::DataUriAdapter"
|
||||
]
|
||||
|
||||
# Remove Paperclip URL adapters from registered handlers
|
||||
Paperclip.io_adapters.registered_handlers.delete_if do |_proc, adapter_class|
|
||||
url_adapters.include? adapter_class.to_s
|
||||
end
|
||||
|
||||
if Paperclip::VERSION.to_f < 3.5
|
||||
if Rails::VERSION::MAJOR > 4
|
||||
# Patches an error for missing method #silence_stream with Rails 5.0
|
||||
# Can be removed after Paperclip is upgraded to 3.5+
|
||||
module Paperclip
|
||||
class GeometryDetector
|
||||
def silence_stream(_stream, &block)
|
||||
yield
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
Rails.logger.warn "The Paperclip::GeometryDetector patch can now be removed."
|
||||
end
|
||||
|
||||
module UpdatedUrlGenerator
|
||||
def escape_url(url)
|
||||
(url.respond_to?(:escape) ? url.escape : URI::Parser.new.escape(url)).
|
||||
gsub(/(\/.+)\?(.+\.)/, '\1%3F\2')
|
||||
end
|
||||
end
|
||||
|
||||
module PaperclipImageErrors
|
||||
def mark_invalid(record, attribute, types)
|
||||
record.errors.add attribute, :invalid, **options.merge(:types => types.join(', '))
|
||||
end
|
||||
end
|
||||
|
||||
Paperclip::UrlGenerator.prepend(UpdatedUrlGenerator)
|
||||
Paperclip::Validators::AttachmentPresenceValidator.prepend(PaperclipImageErrors)
|
||||
@@ -6,7 +6,6 @@ require 'awesome_nested_set'
|
||||
require 'cancan'
|
||||
require 'pagy'
|
||||
require 'mail'
|
||||
require 'paperclip'
|
||||
require 'paranoia'
|
||||
require 'ransack'
|
||||
require 'state_machines'
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Core
|
||||
# This module exists to reduce duplication in S3 settings between
|
||||
# the Image and Taxon models in Spree
|
||||
module S3Support
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
def self.supports_s3(field)
|
||||
# Load user defined paperclip settings
|
||||
config = Spree::Config
|
||||
return unless config[:use_s3]
|
||||
|
||||
s3_creds = { access_key_id: config[:s3_access_key],
|
||||
secret_access_key: config[:s3_secret],
|
||||
bucket: config[:s3_bucket] }
|
||||
attachment_definitions[field][:storage] = :s3
|
||||
attachment_definitions[field][:s3_credentials] = s3_creds
|
||||
attachment_definitions[field][:s3_headers] = ActiveSupport::JSON.
|
||||
decode(config[:s3_headers])
|
||||
attachment_definitions[field][:bucket] = config[:s3_bucket]
|
||||
if config[:s3_protocol].present?
|
||||
attachment_definitions[field][:s3_protocol] = config[:s3_protocol].downcase
|
||||
end
|
||||
|
||||
return if config[:s3_host_alias].blank?
|
||||
|
||||
attachment_definitions[field][:s3_host_alias] = config[:s3_host_alias]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -14,7 +14,6 @@ require 'rspec/rails'
|
||||
require 'capybara'
|
||||
require 'rspec/retry'
|
||||
require 'paper_trail/frameworks/rspec'
|
||||
require "paperclip/matchers"
|
||||
require "factory_bot_rails"
|
||||
|
||||
require 'shoulda/matchers'
|
||||
@@ -126,7 +125,6 @@ RSpec.configure do |config|
|
||||
config.infer_spec_type_from_file_location!
|
||||
|
||||
config.include FactoryBot::Syntax::Methods
|
||||
config.include Paperclip::Shoulda::Matchers
|
||||
config.include JsonSpec::Helpers
|
||||
|
||||
config.include Rails.application.routes.url_helpers
|
||||
|
||||
Reference in New Issue
Block a user