aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJanko Marohnić <janko.marohnic@gmail.com>2018-04-22 23:40:42 +0200
committerJanko Marohnić <janko.marohnic@gmail.com>2018-04-22 23:40:42 +0200
commitf01e2498905ec057e6c8872d15f8dea18d4cbde8 (patch)
tree1bea7946fd93571a3e12841409179571b05495ce
parentca1296858788780dcb5497e86f66b56170cca279 (diff)
downloadrails-f01e2498905ec057e6c8872d15f8dea18d4cbde8.tar.gz
rails-f01e2498905ec057e6c8872d15f8dea18d4cbde8.tar.bz2
rails-f01e2498905ec057e6c8872d15f8dea18d4cbde8.zip
Rename ActiveStorage.processor to .variant_processor
-rw-r--r--activestorage/app/models/active_storage/variant.rb4
-rw-r--r--activestorage/app/models/active_storage/variation.rb4
-rw-r--r--activestorage/lib/active_storage.rb2
-rw-r--r--activestorage/lib/active_storage/engine.rb12
-rw-r--r--activestorage/test/models/variant_test.rb8
-rw-r--r--guides/source/active_storage_overview.md2
-rw-r--r--guides/source/configuring.md2
7 files changed, 17 insertions, 17 deletions
diff --git a/activestorage/app/models/active_storage/variant.rb b/activestorage/app/models/active_storage/variant.rb
index 1cae2078f0..450ce3677f 100644
--- a/activestorage/app/models/active_storage/variant.rb
+++ b/activestorage/app/models/active_storage/variant.rb
@@ -13,10 +13,10 @@ require "active_storage/downloading"
# {libvips}[http://jcupitt.github.io/libvips/] processor operated by the {ruby-vips}[https://github.com/jcupitt/ruby-vips]
# gem).
#
-# Rails.application.config.active_storage.processor
+# Rails.application.config.active_storage.variant_processor
# # => :mini_magick
#
-# Rails.application.config.active_storage.processor = :vips
+# Rails.application.config.active_storage.variant_processor = :vips
# # => :vips
#
# Note that to create a variant it's necessary to download the entire blob file from the service and load it
diff --git a/activestorage/app/models/active_storage/variation.rb b/activestorage/app/models/active_storage/variation.rb
index 3bdbc5bacb..259bbc743e 100644
--- a/activestorage/app/models/active_storage/variation.rb
+++ b/activestorage/app/models/active_storage/variation.rb
@@ -103,10 +103,10 @@ class ActiveStorage::Variation
image.tempfile.tap(&:open)
end
- # Returns the ImageProcessing processor class specified by `ActiveStorage.processor`.
+ # Returns the ImageProcessing processor class specified by `ActiveStorage.variant_processor`.
def processor
require "image_processing"
- ImageProcessing.const_get(ActiveStorage.processor.to_s.camelize) if ActiveStorage.processor
+ ImageProcessing.const_get(ActiveStorage.variant_processor.to_s.camelize) if ActiveStorage.variant_processor
rescue LoadError
ActiveSupport::Deprecation.warn("Using mini_magick gem directly is deprecated and will be removed in Rails 6.1. Please add `gem 'image_processing', '~> 1.2'` to your Gemfile.")
end
diff --git a/activestorage/lib/active_storage.rb b/activestorage/lib/active_storage.rb
index 817948e675..e1deee1d82 100644
--- a/activestorage/lib/active_storage.rb
+++ b/activestorage/lib/active_storage.rb
@@ -45,7 +45,7 @@ module ActiveStorage
mattr_accessor :queue
mattr_accessor :previewers, default: []
mattr_accessor :analyzers, default: []
- mattr_accessor :processor, default: :mini_magick
+ mattr_accessor :variant_processor, default: :mini_magick
mattr_accessor :paths, default: {}
mattr_accessor :variable_content_types, default: []
mattr_accessor :content_types_to_serve_as_binary, default: []
diff --git a/activestorage/lib/active_storage/engine.rb b/activestorage/lib/active_storage/engine.rb
index 02719e4173..99588cdd4b 100644
--- a/activestorage/lib/active_storage/engine.rb
+++ b/activestorage/lib/active_storage/engine.rb
@@ -43,12 +43,12 @@ module ActiveStorage
initializer "active_storage.configs" do
config.after_initialize do |app|
- ActiveStorage.logger = app.config.active_storage.logger || Rails.logger
- ActiveStorage.queue = app.config.active_storage.queue
- ActiveStorage.processor = app.config.active_storage.processor || :mini_magick
- ActiveStorage.previewers = app.config.active_storage.previewers || []
- ActiveStorage.analyzers = app.config.active_storage.analyzers || []
- ActiveStorage.paths = app.config.active_storage.paths || {}
+ ActiveStorage.logger = app.config.active_storage.logger || Rails.logger
+ ActiveStorage.queue = app.config.active_storage.queue
+ ActiveStorage.variant_processor = app.config.active_storage.variant_processor || :mini_magick
+ ActiveStorage.previewers = app.config.active_storage.previewers || []
+ ActiveStorage.analyzers = app.config.active_storage.analyzers || []
+ ActiveStorage.paths = app.config.active_storage.paths || {}
ActiveStorage.variable_content_types = app.config.active_storage.variable_content_types || []
ActiveStorage.content_types_to_serve_as_binary = app.config.active_storage.content_types_to_serve_as_binary || []
diff --git a/activestorage/test/models/variant_test.rb b/activestorage/test/models/variant_test.rb
index 1af315b664..f6b6579d7d 100644
--- a/activestorage/test/models/variant_test.rb
+++ b/activestorage/test/models/variant_test.rb
@@ -27,7 +27,7 @@ class ActiveStorage::VariantTest < ActiveSupport::TestCase
test "center-weighted crop of JPEG blob" do
begin
- ActiveStorage.processor = nil
+ ActiveStorage.variant_processor = nil
blob = create_file_blob(filename: "racecar.jpg")
variant = ActiveSupport::Deprecation.silence do
blob.variant(combine_options: {
@@ -42,7 +42,7 @@ class ActiveStorage::VariantTest < ActiveSupport::TestCase
assert_equal 100, image.width
assert_equal 100, image.height
ensure
- ActiveStorage.processor = :mini_magick
+ ActiveStorage.variant_processor = :mini_magick
end
end
@@ -90,7 +90,7 @@ class ActiveStorage::VariantTest < ActiveSupport::TestCase
test "works for vips processor" do
begin
- ActiveStorage.processor = :vips
+ ActiveStorage.variant_processor = :vips
blob = create_file_blob(filename: "racecar.jpg")
variant = blob.variant(thumbnail_image: 100).processed
@@ -100,7 +100,7 @@ class ActiveStorage::VariantTest < ActiveSupport::TestCase
rescue LoadError
# libvips not installed
ensure
- ActiveStorage.processor = :mini_magick
+ ActiveStorage.variant_processor = :mini_magick
end
end
end
diff --git a/guides/source/active_storage_overview.md b/guides/source/active_storage_overview.md
index f56db61538..c3fb5356d4 100644
--- a/guides/source/active_storage_overview.md
+++ b/guides/source/active_storage_overview.md
@@ -361,7 +361,7 @@ To switch to the Vips processor, you would add the following to
```ruby
# Use Vips for processing variants.
-config.active_storage.processor = :vips
+config.active_storage.variant_processor = :vips
```
Previewing Files
diff --git a/guides/source/configuring.md b/guides/source/configuring.md
index ec950b89cd..c98e9b719c 100644
--- a/guides/source/configuring.md
+++ b/guides/source/configuring.md
@@ -778,7 +778,7 @@ normal Rails server.
`config.active_storage` provides the following configuration options:
-* `config.active_storage.processor` accepts a symbol `:mini_magick` or `:vips`, specifying whether variant transformations will be performed with MiniMagick or ruby-vips. The default is `:mini_magick`.
+* `config.active_storage.variant_processor` accepts a symbol `:mini_magick` or `:vips`, specifying whether variant transformations will be performed with MiniMagick or ruby-vips. The default is `:mini_magick`.
* `config.active_storage.analyzers` accepts an array of classes indicating the analyzers available for Active Storage blobs. The default is `[ActiveStorage::Analyzer::ImageAnalyzer, ActiveStorage::Analyzer::VideoAnalyzer]`. The former can extract width and height of an image blob; the latter can extract width, height, duration, angle, and aspect ratio of a video blob.