Sha256: 960a13d1eddaf9ad3ec1e2a402acd48643e14c6f5210d79bb01b3105ef6d734f

Contents?: true

Size: 883 Bytes

Versions: 18

Compression:

Stored size: 883 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, option='')
      # Homebrew doesn't support to install specific version.
      cmd = "brew install #{option} '#{package}'"
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
specinfra-2.1.0 lib/specinfra/command/darwin/base/package.rb
specinfra-2.0.4 lib/specinfra/command/darwin/base/package.rb
specinfra-2.0.3 lib/specinfra/command/darwin/base/package.rb
specinfra-2.0.2 lib/specinfra/command/darwin/base/package.rb
specinfra-2.0.1 lib/specinfra/command/darwin/base/package.rb
specinfra-2.0.0 lib/specinfra/command/darwin/base/package.rb
specinfra-2.0.0.beta52 lib/specinfra/command/darwin/base/package.rb
specinfra-2.0.0.beta51 lib/specinfra/command/darwin/base/package.rb
specinfra-2.0.0.beta50 lib/specinfra/command/darwin/base/package.rb
specinfra-2.0.0.beta49 lib/specinfra/command/darwin/base/package.rb
specinfra-2.0.0.beta48 lib/specinfra/command/darwin/base/package.rb
specinfra-2.0.0.beta47 lib/specinfra/command/darwin/base/package.rb
specinfra-2.0.0.beta46 lib/specinfra/command/darwin/base/package.rb
specinfra-2.0.0.beta45 lib/specinfra/command/darwin/base/package.rb
specinfra-2.0.0.beta44 lib/specinfra/command/darwin/base/package.rb
specinfra-2.0.0.beta43 lib/specinfra/command/darwin/base/package.rb
specinfra-2.0.0.beta42 lib/specinfra/command/darwin/base/package.rb
specinfra-2.0.0.beta41 lib/specinfra/command/darwin/base/package.rb