Class: XcodeInstall::Xcode
- Inherits:
-
Object
- Object
- XcodeInstall::Xcode
- Defined in:
- lib/xcode/install.rb
Overview
A version of Xcode we fetched from the Apple Developer Portal we can download & install.
Sample object: <XcodeInstall::Xcode:0x007fa1d451c390
@date_modified=2015,
@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")>,
Instance Attribute Summary collapse
-
#date_modified ⇒ Object
readonly
Returns the value of attribute date_modified.
-
#installed ⇒ Object
(also: #installed?)
Accessor since it’s set by the ‘Installer`.
-
#name ⇒ Object
readonly
The name might include extra information like “for Lion” or “beta 2”.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#release_notes_url ⇒ Object
readonly
Returns the value of attribute release_notes_url.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(json, url = nil, release_notes_url = nil) ⇒ Xcode
constructor
A new instance of Xcode.
- #to_s ⇒ Object
Constructor Details
#initialize(json, url = nil, release_notes_url = nil) ⇒ Xcode
Returns a new instance of Xcode.
700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 |
# File 'lib/xcode/install.rb', line 700 def initialize(json, url = nil, release_notes_url = nil) if url.nil? @date_modified = json['dateModified'].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 |
Instance Attribute Details
#date_modified ⇒ Object (readonly)
Returns the value of attribute date_modified.
686 687 688 |
# File 'lib/xcode/install.rb', line 686 def date_modified @date_modified end |
#installed ⇒ Object Also known as: installed?
Accessor since it’s set by the ‘Installer`
696 697 698 |
# File 'lib/xcode/install.rb', line 696 def installed @installed end |
#name ⇒ Object (readonly)
The name might include extra information like “for Lion” or “beta 2”
689 690 691 |
# File 'lib/xcode/install.rb', line 689 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
690 691 692 |
# File 'lib/xcode/install.rb', line 690 def path @path end |
#release_notes_url ⇒ Object (readonly)
Returns the value of attribute release_notes_url.
693 694 695 |
# File 'lib/xcode/install.rb', line 693 def release_notes_url @release_notes_url end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
691 692 693 |
# File 'lib/xcode/install.rb', line 691 def url @url end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
692 693 694 |
# File 'lib/xcode/install.rb', line 692 def version @version end |
Class Method Details
.new_prerelease(version, url, release_notes_path) ⇒ Object
732 733 734 735 736 |
# File 'lib/xcode/install.rb', line 732 def self.new_prerelease(version, url, release_notes_path) new('name' => version, 'files' => [{ 'remotePath' => url.split('=').last }], 'release_notes_path' => release_notes_path) end |
Instance Method Details
#==(other) ⇒ Object
727 728 729 730 |
# File 'lib/xcode/install.rb', line 727 def ==(other) date_modified == other.date_modified && name == other.name && path == other.path && \ url == other.url && version == other.version end |
#to_s ⇒ Object
723 724 725 |
# File 'lib/xcode/install.rb', line 723 def to_s "Xcode #{version} -- #{url}" end |