Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install Active Storage by default on new stores #3938

Merged
merged 1 commit into from
Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions core/lib/generators/solidus/install/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class InstallGenerator < Rails::Generators::Base
class_option :migrate, type: :boolean, default: true, banner: 'Run Solidus migrations'
class_option :seed, type: :boolean, default: true, banner: 'Load seed data (migrations must be run)'
class_option :sample, type: :boolean, default: true, banner: 'Load sample data (migrations must be run)'
class_option :active_storage, type: :boolean, default: true, banner: 'Install ActiveStorage as image attachments handler for products and taxons'
class_option :auto_accept, type: :boolean
class_option :user_class, type: :string
class_option :admin_email, type: :string
Expand Down Expand Up @@ -51,6 +52,16 @@ def add_files
template 'config/initializers/spree.rb.tt', 'config/initializers/spree.rb'
end

def install_file_attachment
if options[:active_storage]
say "Installing Active Storage", :green
rake 'active_storage:install'
else
say "Installing Paperclip", :green
gsub_file 'config/initializers/spree.rb', "ActiveStorageAttachment", "PaperclipAttachment"
end
end

def additional_tweaks
return unless File.exist? 'public/robots.txt'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Spree.config do |config|
# any inventory changes.
# config.inventory_cache_threshold = 3

# Enable Paperclip adapter for attachments on images and taxons
config.image_attachment_module = 'Spree::Image::PaperclipAttachment'
config.taxon_attachment_module = 'Spree::Taxon::PaperclipAttachment'
# Configure adapter for attachments on products and taxons (use ActiveStorageAttachment or PaperclipAttachment)
config.image_attachment_module = 'Spree::Image::ActiveStorageAttachment'
config.taxon_attachment_module = 'Spree::Taxon::ActiveStorageAttachment'

# Defaults
# Permission Sets:
Expand Down