Sha256: 880e9dd479441ddde0275a8d15c3994411158c522ea0e19ef18912e6b5e7fe9c

Contents?: true

Size: 893 Bytes

Versions: 7

Compression:

Stored size: 893 Bytes

Contents

class Specinfra::Command::Darwin::Base::Package < Specinfra::Command::Base::Package
  class << self
    def check_is_installed(package, version=nil)
      escaped_package = escape(package)
      if version
        cmd = "/usr/local/bin/brew info #{escaped_package} | grep -E '^\/usr\/local\/Cellar\/#{escaped_package}\/#{escape(version)}'"
      else
        cmd = "/usr/local/bin/brew list -1 | grep -E '^#{escaped_package}$'"
      end
      cmd
    end

    alias :check_is_installed_by_homebrew :check_is_installed

    def check_is_installed_by_pkgutil(package, version=nil)
      cmd = "pkgutil --pkg-info #{package}"
      cmd = "#{cmd} | grep '^version: #{escape(version)}'" if version
      cmd
    end

    def install(package, version=nil, option='')
      # Homebrew doesn't support to install specific version.
      cmd = "brew install #{option} '#{package}'"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
specinfra-2.3.0 lib/specinfra/command/darwin/base/package.rb
specinfra-2.2.4 lib/specinfra/command/darwin/base/package.rb
specinfra-2.2.3 lib/specinfra/command/darwin/base/package.rb
specinfra-2.2.2 lib/specinfra/command/darwin/base/package.rb
specinfra-2.2.1 lib/specinfra/command/darwin/base/package.rb
specinfra-2.2.0 lib/specinfra/command/darwin/base/package.rb
specinfra-2.1.1 lib/specinfra/command/darwin/base/package.rb