lib/xcode/install.rb in xcode-install-2.0.2 vs lib/xcode/install.rb in xcode-install-2.0.3
- old
+ new
@@ -121,11 +121,15 @@
def install_version(version, switch = true, clean = true, install = true, progress = true, url = nil)
dmg_path = get_dmg(version, progress, url)
fail Informative, "Failed to download Xcode #{version}." if dmg_path.nil?
- install_dmg(dmg_path, "-#{version.split(' ')[0]}", switch, clean) if install
+ if install
+ install_dmg(dmg_path, "-#{version.split(' ')[0]}", switch, clean)
+ else
+ puts "Downloaded Xcode #{version} to '#{dmg_path}'"
+ end
open_release_notes_url(version) unless url
end
def open_release_notes_url(version)
@@ -278,10 +282,18 @@
end
end
links = links.map { |pre| Xcode.new_prerelease(pre[2].strip.gsub(/.*Xcode /, ''), pre[0], pre[3]) }
if links.count == 0
- version = body.scan(%r{Xcode.* beta.*<\/p>}).last.gsub(/<.*?>/, '').gsub(/.*Xcode /, '')
+ rg = %r{Xcode.* beta.*<\/p>}
+ scan = body.scan(rg)
+
+ if scan.count == 0
+ rg = %r{Xcode.* GM.*<\/p>}
+ scan = body.scan(rg)
+ end
+
+ version = scan.last.gsub(/<.*?>/, '').gsub(/.*Xcode /, '')
link = body.scan(%r{<button .*"(.+?.xip)".*</button>}).first.first
notes = body.scan(%r{<a.+?href="(/go/\?id=xcode-.+?)".*>(.*)</a>}).first.first
links << Xcode.new(version, link, notes)
end