Module: Despeck::InstallationPostMessage
- Defined in:
- lib/despeck/installation_post_message.rb
Overview
Print notes from the installation
Class Method Summary collapse
- .build ⇒ Object
- .hr(line = '-') ⇒ Object
- .notes ⇒ Object
- .print_notes ⇒ Object
- .vips_check_passed? ⇒ Boolean
- .vips_support_pdf? ⇒ Boolean
- .vips_version_supported? ⇒ Boolean
Class Method Details
.build ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/despeck/installation_post_message.rb', line 8 def build if %w[1 true TRUE].include?( ENV.fetch('DESPECK_SKIP_INSTALL_NOTES', false) ) return end require 'vips' return print_notes unless vips_check_passed? end |
.hr(line = '-') ⇒ Object
73 74 75 |
# File 'lib/despeck/installation_post_message.rb', line 73 def hr(line = '-') (line * 50) end |
.notes ⇒ Object
54 55 56 |
# File 'lib/despeck/installation_post_message.rb', line 54 def notes @notes ||= [] end |
.print_notes ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/despeck/installation_post_message.rb', line 58 def print_notes return if notes.empty? puts <<~NOTES #{hr '='} Despeck Installation Notes : #{hr '-'} #{notes.uniq.join("\n")} To Skip this notes `export DESPECK_SKIP_INSTALL_NOTES=1` #{hr '='} NOTES = [] false end |
.vips_check_passed? ⇒ Boolean
47 48 49 50 51 52 |
# File 'lib/despeck/installation_post_message.rb', line 47 def vips_check_passed? passed = true passed = false unless vips_version_supported? passed = false unless vips_support_pdf? passed end |
.vips_support_pdf? ⇒ Boolean
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/despeck/installation_post_message.rb', line 19 def vips_support_pdf? begin Vips::Image.pdfload rescue Vips::Error => e if e. =~ /class "pdfload" not found/ notes << <<~DOC - Libvips installed without PDF support, make sure you have PDFium/poppler-glib installed before installing despeck. For more detail install instruction go to this page https://libvips.github.io/libvips/install.html DOC return false end end true end |
.vips_version_supported? ⇒ Boolean
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/despeck/installation_post_message.rb', line 36 def vips_version_supported? version_only = Vips.version_string.match(/(\d+\.\d+\.\d+)/)[0] return true if version_only > '8.6.5' notes << <<~DOC - Your libvips version is should be minimal at 8.6.5 Please rebuild/reinstall your libvips to >= 8.6.5 . DOC false end |