class XcodeInstall::Xcode
A version of Xcode
we fetched from the Apple Developer Portal we can download & install.
Sample object: <XcodeInstall::Xcode:0x007fa1d451c390
@date_modified=1573661580, @name="6.4", @path="/Developer_Tools/Xcode_6.4/Xcode_6.4.dmg", @url= "https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_6.4/Xcode_6.4.dmg", @version=Gem::Version.new("6.4")>,
Attributes
date_modified[R]
installed[RW]
Accessor since it’s set by the ‘Installer`
installed?[RW]
Accessor since it’s set by the ‘Installer`
name[R]
The name might include extra information like “for Lion” or “beta 2”
path[R]
release_notes_url[R]
url[R]
version[R]
Public Class Methods
new(json, url = nil, release_notes_url = nil)
click to toggle source
# File lib/xcode/install.rb, line 777 def initialize(json, url = nil, release_notes_url = nil) if url.nil? @date_modified = DateTime.strptime(json['dateModified'], '%m/%d/%y %H:%M').strftime('%s').to_i @name = json['name'].gsub(/^Xcode /, '') @path = json['files'].first['remotePath'] url_prefix = 'https://developer.apple.com/devcenter/download.action?path=' @url = "#{url_prefix}#{@path}" @release_notes_url = "#{url_prefix}#{json['release_notes_path']}" if json['release_notes_path'] else @name = json @path = url.split('/').last url_prefix = 'https://developer.apple.com/' @url = "#{url_prefix}#{url}" @release_notes_url = "#{url_prefix}#{release_notes_url}" end begin @version = Gem::Version.new(@name.split(' ')[0]) rescue @version = Installer::MINIMUM_VERSION end end
new_prerelease(version, url, release_notes_path)
click to toggle source
# File lib/xcode/install.rb, line 809 def self.new_prerelease(version, url, release_notes_path) new('name' => version, 'dateModified' => '01/01/70 00:00', 'files' => [{ 'remotePath' => url.split('=').last }], 'release_notes_path' => release_notes_path) end
Public Instance Methods
==(other)
click to toggle source
# File lib/xcode/install.rb, line 804 def ==(other) date_modified == other.date_modified && name == other.name && path == other.path && \ url == other.url && version == other.version end
to_s()
click to toggle source
# File lib/xcode/install.rb, line 800 def to_s "Xcode #{version} -- #{url}" end