Class: Locomotive::Steam::Initializers::Dragonfly
- Inherits:
-
Object
- Object
- Locomotive::Steam::Initializers::Dragonfly
- Defined in:
- lib/locomotive/steam/initializers/dragonfly.rb
Instance Method Summary collapse
Instance Method Details
#find_imagemagick_commands ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/locomotive/steam/initializers/dragonfly.rb', line 32 def find_imagemagick_commands convert = ENV['IMAGE_MAGICK_CONVERT'] || `which convert`.strip.presence || '/usr/local/bin/convert' identify = ENV['IMAGE_MAGICK_IDENTIFY'] || `which identify`.strip.presence || '/usr/local/bin/identify' if File.exists?(convert) { convert_command: convert, identify_command: identify } else missing_image_magick nil end end |
#missing_image_magick ⇒ Object
44 45 46 47 48 49 |
# File 'lib/locomotive/steam/initializers/dragonfly.rb', line 44 def missing_image_magick Locomotive::Common::Logger.warn <<-EOF [Dragonfly] !disabled! [Dragonfly] If you want to take full benefits of all the features in Locomotive Steam, we recommend you to install ImageMagick. Check out the documentation here: http://doc.locomotivecms.com. EOF end |
#run ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/locomotive/steam/initializers/dragonfly.rb', line 7 def run require 'dragonfly' # need to be called outside of the configure method imagemagick_commands = find_imagemagick_commands ::Dragonfly.app(:steam).configure do if imagemagick_commands plugin :imagemagick, imagemagick_commands end verify_urls true secret Locomotive::Steam.configuration.image_resizer_secret url_format '/steam/dynamic/:job/:sha/:basename.:ext' fetch_file_whitelist /public/ fetch_url_whitelist /.+/ end ::Dragonfly.logger = Locomotive::Common::Logger end |