class Mixlib::Install::ProductMatrix

Public Class Methods

new(&block) click to toggle source
# File lib/mixlib/install/product.rb, line 137
def initialize(&block)
  @product_map = {}
  instance_eval(&block)
end

Public Instance Methods

lookup(key, version = :latest) click to toggle source

Looks up a product and sets version on it to be used later by the Product.

@param [String] key

Lookup key of the product.

@param [String] version

Version to be set for the product. By default version is set to :latest

@return [Product]

# File lib/mixlib/install/product.rb, line 168
def lookup(key, version = :latest)
  # return nil unless the product exists
  return nil unless @product_map.key?(key)

  product = @product_map[key]
  # We set the lookup version for the product to a very high number in
  # order to mimic :latest so that one does not need to handle this
  # symbol explicitly when constructing logic based on version numbers.
  version = "1000.1000.1000" if version.to_sym == :latest
  product.version(version)
  product
end
product(key, &block) click to toggle source

The only DSL method of this class. It creates a Product with given ‘key` and stores it.

# File lib/mixlib/install/product.rb, line 146
def product(key, &block)
  @product_map[key] = Product.new(key, &block)
end
products() click to toggle source

Fetches the keys of available products.

@return Array of keys

# File lib/mixlib/install/product.rb, line 154
def products
  @product_map.keys
end
products_available_on_downloads_site() click to toggle source

Looks up all products that are available on downloads.chef.io

@return Hash{String => Product}

:key => product_key
:value => Mixlib::Install::Product instance
# File lib/mixlib/install/product.rb, line 187
def products_available_on_downloads_site
  @product_map.reject do |product_key, product|
    product.downloads_product_page_url == :not_available
  end
end