Class: XcodeInstall::Xcode

Inherits:
Object
  • Object
show all
Defined in:
lib/xcode/install.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#dateModifiedObject (readonly)

Returns the value of attribute dateModified.



228
229
230
# File 'lib/xcode/install.rb', line 228

def dateModified
  @dateModified
end

#nameObject (readonly)

Returns the value of attribute name.



229
230
231
# File 'lib/xcode/install.rb', line 229

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



230
231
232
# File 'lib/xcode/install.rb', line 230

def path
  @path
end

#urlObject (readonly)

Returns the value of attribute url.



231
232
233
# File 'lib/xcode/install.rb', line 231

def url
  @url
end

#versionObject (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