lib/xcode/install.rb in xcode-install-2.4.2 vs lib/xcode/install.rb in xcode-install-2.4.4
- old
+ new
@@ -291,11 +291,16 @@
`open #{xcode.release_notes_url}` unless xcode.nil? || xcode.release_notes_url.nil?
end
def list_annotated(xcodes_list)
installed = installed_versions.map(&:version)
- xcodes_list.map { |x| installed.include?(x) ? "#{x} (installed)" : x }.join("\n")
+ xcodes_list.map do |x|
+ xcode_version = x.split(' ').first # exclude "beta N", "for Lion".
+ xcode_version << '.0' unless xcode_version.include?('.')
+
+ installed.include?(xcode_version) ? "#{x} (installed)" : x
+ end.join("\n")
end
def list
list_annotated(list_versions.sort_by(&:to_f))
end
@@ -587,11 +592,11 @@
def version
@version ||= fetch_version
end
def bundle_version
- @bundle_version ||= Gem::Version.new(plist_entry(':DTXcode').to_i.to_s.split(//).join('.'))
+ @bundle_version ||= Gem::Version.new(bundle_version_string)
end
def uuid
@uuid ||= plist_entry(':DVTPlugInCompatibilityUUID')
end
@@ -649,9 +654,18 @@
return '0.0' if output.nil? || output.empty? # ¯\_(ツ)_/¯
output.split("\n").first.split(' ')[1]
end
:private
+
+ def bundle_version_string
+ digits = plist_entry(':DTXcode').to_i.to_s
+ if digits.length < 3
+ digits.split(//).join('.')
+ else
+ "#{digits[0..-3]}.#{digits[-2]}.#{digits[-1]}"
+ end
+ end
def plist_entry(keypath)
`/usr/libexec/PlistBuddy -c "Print :#{keypath}" "#{path}/Contents/Info.plist"`.chomp
end
end