class Mixlib::Install::Product

Constants

DSL_PROPERTIES

Public Class Methods

new(key, &block) click to toggle source
# File lib/mixlib/install/product.rb, line 24
def initialize(key, &block)
  @product_key = key
  instance_eval(&block)
end

Public Instance Methods

default_value_for(prop) click to toggle source

Return the default values for DSL properties

# File lib/mixlib/install/product.rb, line 79
def default_value_for(prop)
  case prop
  when :install_path
    "/opt/#{package_name}"
  when :omnibus_project
    package_name
  when :downloads_product_page_url
    "#{Mixlib::Install::Dist::DOWNLOADS_PAGE}/#{product_key}"
  when :github_repo
    "#{Mixlib::Install::Dist::GITHUB_ORG}/#{product_key}"
  else
    nil
  end
end
known_omnibus_projects() click to toggle source

Return all known omnibus project names for a product

# File lib/mixlib/install/product.rb, line 97
def known_omnibus_projects
  # iterate through min/max versions for all product names
  # and collect the name for both versions
  projects = %w{ 0.0.0 1000.1000.1000 }.collect do |v|
    @version = v
    omnibus_project
  end
  # remove duplicates and return multiple known names or return the single
  # project name
  projects.uniq || projects
end
version(value = nil) click to toggle source

Sets or retrieves the version for the product. This is used later when we are reading the value of a property if a Proc is specified

# File lib/mixlib/install/product.rb, line 113
def version(value = nil)
  if value.nil?
    @version
  else
    @version = value
  end
end
version_for(version_string) click to toggle source

Helper method to convert versions from String to Mixlib::Version

@param [String] version_string

value to be set in String form

@return [Mixlib::Version]

# File lib/mixlib/install/product.rb, line 128
def version_for(version_string)
  Mixlib::Versioning.parse(version_string)
end