Class: Convert2Ascii::CheckImageMagick
- Inherits:
-
CheckPackage
- Object
- CheckPackage
- Convert2Ascii::CheckImageMagick
- Defined in:
- lib/convert2ascii/check_package.rb
Instance Method Summary collapse
-
#initialize ⇒ CheckImageMagick
constructor
A new instance of CheckImageMagick.
- #linux_check ⇒ Object
- #macos_check ⇒ Object
Methods inherited from CheckPackage
#arch_installed?, #centos_installed?, #check, #debian_installed?, #detect_linux_distribution, #macos_installed?, #ms_check, #redhat_installed?, #unknow_check
Methods included from OS
Constructor Details
#initialize ⇒ CheckImageMagick
Returns a new instance of CheckImageMagick.
135 136 137 138 139 140 141 |
# File 'lib/convert2ascii/check_package.rb', line 135 def initialize super @name = "imagemagick" @need_error = Rainbow("[Error] `imagemagick` is need!").red @tips = Rainbow("[Tips ] For more details and install guide: https://github.com/rmagick/rmagick").green end |
Instance Method Details
#linux_check ⇒ Object
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/convert2ascii/check_package.rb', line 149 def linux_check # just Debian/Ubuntu linux_pkg = { "debian" => "libmagickwand-dev", "redhat" => "ImageMagick-devel", "arch" => "imagemagick", } linux_platform_name = detect_linux_distribution pkg_name = linux_pkg.fetch(linux_platform_name, nil) if !pkg_name raise CheckPackageError, "\n#{@need_error}\n#{@tips}\n" end __send__ "#{linux_platform_name}_installed?", pkg_name end |
#macos_check ⇒ Object
143 144 145 146 147 |
# File 'lib/convert2ascii/check_package.rb', line 143 def macos_check if !macos_installed?(@name) raise CheckPackageError, "\n#{@need_error}\n#{@tips}\n" end end |