Class: XcodeInstall::Xcode
- Inherits:
-
Object
- Object
- XcodeInstall::Xcode
- Defined in:
- lib/xcode/install.rb
Instance Attribute Summary collapse
-
#date_modified ⇒ Object
readonly
Returns the value of attribute date_modified.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#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.
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 |
# File 'lib/xcode/install.rb', line 492 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.
485 486 487 |
# File 'lib/xcode/install.rb', line 485 def date_modified @date_modified end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
486 487 488 |
# File 'lib/xcode/install.rb', line 486 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
487 488 489 |
# File 'lib/xcode/install.rb', line 487 def path @path end |
#release_notes_url ⇒ Object (readonly)
Returns the value of attribute release_notes_url.
490 491 492 |
# File 'lib/xcode/install.rb', line 490 def release_notes_url @release_notes_url end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
488 489 490 |
# File 'lib/xcode/install.rb', line 488 def url @url end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
489 490 491 |
# File 'lib/xcode/install.rb', line 489 def version @version end |
Class Method Details
.new_prerelease(version, url, release_notes_path) ⇒ Object
524 525 526 527 528 |
# File 'lib/xcode/install.rb', line 524 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
519 520 521 522 |
# File 'lib/xcode/install.rb', line 519 def ==(other) date_modified == other.date_modified && name == other.name && path == other.path && \ url == other.url && version == other.version end |
#to_s ⇒ Object
515 516 517 |
# File 'lib/xcode/install.rb', line 515 def to_s "Xcode #{version} -- #{url}" end |