module ActiveScripts module Packages class Jpegoptim < ActiveScripts::Packages::Base # INFO: ActiveScripts::Packages::Jpegoptim contains code that # execute the jpegoptim package. private def install if package_installed?(includes: "jpegoptim") notify_package_exists! else case $operating_system when :macosx, :linux execute_command!("brew install jpegoptim") say_ok(" Installation complete!") else notify_package_unavailable! end end end def upgrade if package_installed?(includes: "jpegoptim") case $operating_system when :macosx, :linux output = execute_command!("brew upgrade jpegoptim") say_warning(" [!] #{output.squish}") unless option_dry_run? || package_output?(output, includes: "Error:") say_ok(" Upgrade complete!") else notify_package_unavailable! end else notify_package_missing! end end def uninstall if package_installed?(includes: "jpegoptim") case $operating_system when :macosx, :linux execute_command!("brew remove jpegoptim") say_ok(" Uninstallation complete!") else notify_package_unavailable! end else notify_package_missing! end end end end end