Class: XcodeInstaller::XcodeVersions::ReleaseManager

Inherits:
Object
  • Object
show all
Defined in:
lib/xcode-installer/xcode-versions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeReleaseManager

Returns a new instance of ReleaseManager.



14
15
16
17
18
19
# File 'lib/xcode-installer/xcode-versions.rb', line 14

def initialize
  super
  # cnf = YAML::load_file(File.join(File.dirname(File.expand_path(__FILE__)), 'config.yml'))
  @data = YAML::load_file(File.join(File.dirname(File.expand_path(__FILE__)), 'xcode-versions.yml'))
  # puts data
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



12
13
14
# File 'lib/xcode-installer/xcode-versions.rb', line 12

def data
  @data
end

Instance Method Details

#get_all(interface_type) ⇒ Object



21
22
23
24
25
# File 'lib/xcode-installer/xcode-versions.rb', line 21

def get_all(interface_type)
  interface_type ||= 'gui'
  list = data[interface_type]
  return list
end

#get_release(version, include_beta, interface_type) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/xcode-installer/xcode-versions.rb', line 27

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
  list.each { |release|
    if release['version'] == version
      return release
    end
  }
end