Sha256: 3c9be674e21a30f1d23dd65a70b0a99b1e8932ae6546a5dd6079c1bd7c2c2f5b

Contents?: true

Size: 1.61 KB

Versions: 10

Compression:

Stored size: 1.61 KB

Contents

module BinInstall
  module Brew
    module Package
      def self.install(package)
        system("brew install #{package}")
      end

      def self.install!(package)
        BinInstall.system!("brew install #{package}")
      end

      def self.uninstall(package)
        system("brew uninstall #{package}")
      end

      def self.uninstall!(package)
        BinInstall.system!("brew uninstall #{package}")
      end

      def self.upgrade(package)
        if latest_version?(package)
          puts "#{package} is already the latest version. Skipping #{package} install.".blue
        else
          system("brew upgrade #{package}")
        end
      end

      def self.upgrade!(package)
        if latest_version?(package)
          puts "#{package} is already the latest version. Skipping #{package} install.".blue
        else
          BinInstall.system!("brew upgrade #{package}")
        end
      end

      def self.install_or_upgrade(package)
        if installed?(package)
          upgrade(package)
        else
          install(package)
        end
      end

      def self.install_or_upgrade!(package)
        if installed?(package)
          upgrade!(package)
        else
          install!(package)
        end
      end

      def self.link(package)
        system("brew link #{package} --force")
      end

      def self.link!(package)
        BinInstall.system!("brew link #{package} --force")
      end

      def self.installed?(package)
        system("brew list --versions #{package}")
      end

      def self.latest_version?(package)
        system("brew outdated #{package}")
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
bin_install-0.0.33 lib/bin_install/brew/package.rb
bin_install-0.0.32 lib/bin_install/brew/package.rb
bin_install-0.0.31 lib/bin_install/brew/package.rb
bin_install-0.0.30 lib/bin_install/brew/package.rb
bin_install-0.0.29 lib/bin_install/brew/package.rb
bin_install-0.0.28 lib/bin_install/brew/package.rb
bin_install-0.0.27 lib/bin_install/brew/package.rb
bin_install-0.0.26 lib/bin_install/brew/package.rb
bin_install-0.0.25 lib/bin_install/brew/package.rb
bin_install-0.0.24 lib/bin_install/brew/package.rb