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
-
#initialize(json) ⇒ Xcode
constructor
A new instance of Xcode.
Constructor Details
#initialize(json) ⇒ Xcode
Returns a new instance of Xcode.
234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/xcode/install.rb', line 234 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.
228 229 230 |
# File 'lib/xcode/install.rb', line 228 def dateModified @dateModified end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
229 230 231 |
# File 'lib/xcode/install.rb', line 229 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
230 231 232 |
# File 'lib/xcode/install.rb', line 230 def path @path end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
231 232 233 |
# File 'lib/xcode/install.rb', line 231 def url @url end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
232 233 234 |
# File 'lib/xcode/install.rb', line 232 def version @version end |
Class Method Details
.new_prelease(version, url) ⇒ Object
247 248 249 250 251 |
# File 'lib/xcode/install.rb', line 247 def self.new_prelease(version, url) self.new({'name' => version, 'dateModified' => Time.now.to_i, 'files' => [{'remotePath' => url.split('=').last}]}) end |