Ensure image_processing is installed with Trix
Currently if the Gemfile does not contain a commented out line for image_processing, or the line uses single, not double quotes, image_processing will not be installed and Trix will not be able to correctly handle image attachments. This ensures image_processing _is_ installed in those circumstances.
This commit is contained in:
parent
608c1bfe17
commit
259b08b088
@ -62,7 +62,12 @@ def create_actiontext_files
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user