lib/xcode/install.rb in xcode-install-2.4.4 vs lib/xcode/install.rb in xcode-install-2.5.0
- old
+ new
@@ -93,11 +93,11 @@
$stdout.flush
end
# Call back the block for other processes that might be interested
matched = progress_content.match(/^\s*(\d+)/)
- next unless matched.length == 2
+ next unless matched && matched.length == 2
percent = matched[1].to_i
progress_block.call(percent) if progress_block
end
# as we're not making use of the block-based syntax
@@ -275,11 +275,11 @@
def install_version(version, switch = true, clean = true, install = true, progress = true, url = nil, show_release_notes = true, progress_block = nil)
dmg_path = get_dmg(version, progress, url, progress_block)
fail Informative, "Failed to download Xcode #{version}." if dmg_path.nil?
if install
- install_dmg(dmg_path, "-#{version.to_s.split(' ')[0]}", switch, clean)
+ install_dmg(dmg_path, "-#{version.to_s.split(' ').join('.')}", switch, clean)
else
puts "Downloaded Xcode #{version} to '#{dmg_path}'"
end
open_release_notes_url(version) if show_release_notes && !url
@@ -386,10 +386,10 @@
end
def installed
result = `mdfind "kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'" 2>/dev/null`.split("\n")
if result.empty?
- result = `find /Applications -name '*.app' -type d -maxdepth 1 -exec sh -c \
+ result = `find /Applications -maxdepth 1 -name '*.app' -type d -exec sh -c \
'if [ "$(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" \
"{}/Contents/Info.plist" 2>/dev/null)" == "com.apple.dt.Xcode" ]; then echo "{}"; fi' ';'`.split("\n")
end
result
end