Sha256: ce4053d75d696ce6586ecdd95aea5465ce3d65100c1de015223c42100deb850b

Contents?: true

Size: 1.44 KB

Versions: 1

Compression:

Stored size: 1.44 KB

Contents

module ActiveScripts
  module Packages
    class Optipng < ActiveScripts::Packages::Base

      # INFO: ActiveScripts::Packages::Optipng contains code that
      #   execute the OptiPNG package.

      private

      def install
        if package_installed?(includes: "optipng")
          notify_package_exists!
        else
          case $operating_system
          when :macosx, :linux
            execute_command!("brew install optipng")
            say_ok("   Installation complete!")
          else
            notify_package_unavailable!
          end
        end
      end

      def upgrade
        if package_installed?(includes: "optipng")
          case $operating_system
          when :macosx, :linux
            output = execute_command!("brew upgrade optipng")
            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: "optipng")
          case $operating_system
          when :macosx, :linux
            execute_command!("brew remove optipng")
            say_ok("   Uninstallation complete!")
          else
            notify_package_unavailable!
          end
        else
          notify_package_missing!
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_scripts-0.1.0 lib/active_scripts/packages/optipng.rb