Class: Serverspec::Type::Package

Inherits:
Base
  • Object
show all
Defined in:
lib/serverspec/type/package.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #to_s

Constructor Details

This class inherits a constructor from Serverspec::Type::Base

Instance Method Details

#installed?(provider, version) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/serverspec/type/package.rb', line 4

def installed?(provider, version)
  if provider.nil?
    backend.check_installed(@name, version)
  else
    check_method = "check_installed_by_#{provider}".to_sym

    unless backend.respond_to?(check_method) || commands.respond_to?(check_method)
      raise ArgumentError.new("`be_installed` matcher doesn't support #{provider}")
    end

    backend.send(check_method, @name, version)
  end
end