class XcodeInstaller::ReleaseManager

Attributes

data[RW]

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/xcode-installer/release-manager.rb, line 7
def initialize
  super
  @data = YAML::load_file(File.join(File.dirname(File.expand_path(__FILE__)), 'xcode-versions.yml'))
end

Public Instance Methods

get_all(interface_type) click to toggle source
# File lib/xcode-installer/release-manager.rb, line 12
def get_all(interface_type)
  interface_type ||= 'gui'
  list = data[interface_type]
  return list
end
get_release(version, include_beta, interface_type) click to toggle source
# File lib/xcode-installer/release-manager.rb, line 18
def get_release(version, include_beta, interface_type)
  version ||= 'latest'
  include_beta ||= false
  interface_type ||= 'gui'

  list = data[interface_type]
  if version == 'latest' && include_beta
    version = LATEST_DP
  elsif version == 'latest'
    version = LATEST_GA
  end

  os_version = `sw_vers -productVersion`
  # Drop the patch number
  os_version = os_version.match(/\d+\.\d+/)[0]

  list.each { |release|
    if release['version'].to_s == version && release['os_version'].to_s == os_version
      return release
    end
  }
end