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.
-
#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) ⇒ Xcode
constructor
A new instance of Xcode.
- #to_s ⇒ Object
Constructor Details
#initialize(json) ⇒ Xcode
Returns a new instance of Xcode.
273 274 275 276 277 278 279 280 281 282 283 284 |
# File 'lib/xcode/install.rb', line 273 def initialize(json) @date_modified = json['dateModified'].to_i @name = json['name'].gsub(/^Xcode /, '') @path = json['files'].first['remotePath'] @url = "https://developer.apple.com/devcenter/download.action?path=#{@path}" 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.
267 268 269 |
# File 'lib/xcode/install.rb', line 267 def date_modified @date_modified end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
268 269 270 |
# File 'lib/xcode/install.rb', line 268 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
269 270 271 |
# File 'lib/xcode/install.rb', line 269 def path @path end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
270 271 272 |
# File 'lib/xcode/install.rb', line 270 def url @url end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
271 272 273 |
# File 'lib/xcode/install.rb', line 271 def version @version end |
Class Method Details
.new_prelease(version, url) ⇒ Object
295 296 297 298 299 |
# File 'lib/xcode/install.rb', line 295 def self.new_prelease(version, url) new('name' => version, 'dateModified' => Time.now.to_i, 'files' => [{ 'remotePath' => url.split('=').last }]) end |
Instance Method Details
#==(other) ⇒ Object
290 291 292 293 |
# File 'lib/xcode/install.rb', line 290 def ==(other) date_modified == other.date_modified && name == other.name && path == other.path && \ url == other.url && version == other.version end |
#to_s ⇒ Object
286 287 288 |
# File 'lib/xcode/install.rb', line 286 def to_s "Xcode #{version} -- #{url}" end |