Class: XcodeInstall::InstalledXcode

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ InstalledXcode

Returns a new instance of InstalledXcode.



247
248
249
250
# File 'lib/xcode/install.rb', line 247

def initialize(path)
  @path = Pathname.new(path)
  @version = get_version(path)
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



244
245
246
# File 'lib/xcode/install.rb', line 244

def path
  @path
end

#versionObject (readonly)

Returns the value of attribute version.



245
246
247
# File 'lib/xcode/install.rb', line 245

def version
  @version
end

Instance Method Details

#get_version(xcode_path) ⇒ Object



254
255
256
257
# File 'lib/xcode/install.rb', line 254

def get_version(xcode_path)
  output = `DEVELOPER_DIR='' "#{xcode_path}/Contents/Developer/usr/bin/xcodebuild" -version`
  output.split("\n").first.split(' ')[1]
end