Sha256: b56894c6c3d8f266dc04768fbe87ebffb1de85fa12f61523028f4b2ba16d42ec

Contents?: true

Size: 862 Bytes

Versions: 3

Compression:

Stored size: 862 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
    end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
specinfra-2.0.0.beta40 lib/specinfra/command/darwin/base/package.rb
specinfra-2.0.0.beta39 lib/specinfra/command/darwin/base/package.rb
specinfra-2.0.0.beta38 lib/specinfra/command/darwin/base/package.rb