Merge pull request #51285 from tsvallender/ensure_image_processing_installed_trix

Ensure image_processing is installed with Trix
This commit is contained in:
Rafael Mendonça França 2024-05-02 18:06:07 -03:00 committed by GitHub
commit 113ca9e3d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

View File

@ -62,7 +62,12 @@ module ActionText
def enable_image_processing_gem
if (gemfile_path = Pathname(destination_root).join("Gemfile")).exist?
say "Ensure image_processing gem has been enabled so image uploads will work (remember to bundle!)"
uncomment_lines gemfile_path, /gem "image_processing"/
image_processing_regex = /gem ["']image_processing["']/
if File.readlines(gemfile_path).grep(image_processing_regex).any?
uncomment_lines gemfile_path, image_processing_regex
else
run "bundle add --skip-install image_processing"
end
end
end