Sha256: ddab1e1dcb5782c694d6889bd0563a4c42b63720c55e3c8620d1f35aaa6919bb

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

module ActiveScripts
  module Packages
    class Imagemagick < ActiveScripts::Packages::Base

      # INFO: ActiveScripts::Packages::Imagemagick contains code that
      #   execute the ImageMagick package.

      private

      def install
        if package_installed?(includes: "imagemagick")
          notify_package_exists!
        else
          case $operating_system
          when :macosx, :linux
            begin
              Timeout::timeout(600) do
                execute_command!("brew install imagemagick")
              end
            rescue Timeout::Error => e
              ##
            ensure
              say_ok("   Installation complete!")
            end
          else
            notify_package_unavailable!
          end
        end
      end

      def upgrade
        if package_installed?(includes: "imagemagick")
          case $operating_system
          when :macosx, :linux
            output = execute_command!("brew upgrade imagemagick")
            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: "imagemagick")
          case $operating_system
          when :macosx, :linux
            execute_command!("brew remove imagemagick")
            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/imagemagick.rb