Class: XcodeInstall::Xcode
- Inherits:
-
Object
- Object
- XcodeInstall::Xcode
- Defined in:
- lib/xcode/install.rb
Instance Attribute Summary collapse
-
#dateModified ⇒ Object
readonly
Returns the value of attribute dateModified.
-
#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
- #==(o) ⇒ Object
-
#initialize(json) ⇒ Xcode
constructor
A new instance of Xcode.
- #to_s ⇒ Object
Constructor Details
#initialize(json) ⇒ Xcode
Returns a new instance of Xcode.
255 256 257 258 259 260 261 262 263 264 265 266 |
# File 'lib/xcode/install.rb', line 255 def initialize(json) @dateModified = 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
#dateModified ⇒ Object (readonly)
Returns the value of attribute dateModified.
249 250 251 |
# File 'lib/xcode/install.rb', line 249 def dateModified @dateModified end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
250 251 252 |
# File 'lib/xcode/install.rb', line 250 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
251 252 253 |
# File 'lib/xcode/install.rb', line 251 def path @path end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
252 253 254 |
# File 'lib/xcode/install.rb', line 252 def url @url end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
253 254 255 |
# File 'lib/xcode/install.rb', line 253 def version @version end |
Class Method Details
.new_prelease(version, url) ⇒ Object
277 278 279 280 281 |
# File 'lib/xcode/install.rb', line 277 def self.new_prelease(version, url) self.new({'name' => version, 'dateModified' => Time.now.to_i, 'files' => [{'remotePath' => url.split('=').last}]}) end |
Instance Method Details
#==(o) ⇒ Object
272 273 274 275 |
# File 'lib/xcode/install.rb', line 272 def ==(o) dateModified == o.dateModified && name == o.name && path == o.path && \ url == o.url && version == o.version end |
#to_s ⇒ Object
268 269 270 |
# File 'lib/xcode/install.rb', line 268 def to_s "Xcode #{version} -- #{url}" end |