install

in lib/puppet/provider/package/brewcask.rb [105:126]


  def install
    begin
      Puppet.debug "Looking for #{install_name} package..."
      execute([command(:brew), :info, '--cask', install_name], :failonfail => true)
    rescue Puppet::ExecutionFailure
      raise Puppet::Error, "Could not find package: #{install_name}"
    end

    begin
      Puppet.debug "Package found, installing..."
      output = execute([command(:brew), :install, '--cask', install_name, *install_options], :failonfail => true)

      if output =~ /sha256 checksum/
        Puppet.debug "Fixing checksum error..."
        mismatched = output.match(/Already downloaded: (.*)/).captures
        fix_checksum(mismatched)
      end
    rescue Puppet::ExecutionFailure => detail
      raise Puppet::Error, "Could not install package: #{detail}"
    end
  end