lib/xcode/install.rb in xcode-install-2.0.0 vs lib/xcode/install.rb in xcode-install-2.0.1
- old
+ new
@@ -70,18 +70,18 @@
Gem::Version.new(a.version) <=> Gem::Version.new(b.version)
end
end
def install_dmg(dmg_path, suffix = '', switch = true, clean = true)
+ archive_util = '/System/Library/CoreServices/Applications/Archive Utility.app/Contents/MacOS/Archive Utility'
prompt = "Please authenticate for Xcode installation.\nPassword: "
+ xcode_beta_path = dmg_path.dirname + 'Xcode-beta.app'
xcode_path = "/Applications/Xcode#{suffix}.app"
if dmg_path.extname == '.xip'
- `xar -x -f #{dmg_path} --exclude 'Metadata'`
- `sudo -p "#{prompt}" ditto -x Content /Applications`
- `sudo -p "#{prompt}" mv /Applications/Xcode-beta.app "#{xcode_path}"`
- FileUtils.rm_f('Content')
+ `'#{archive_util}' #{dmg_path}`
+ `sudo -p "#{prompt}" mv "#{xcode_beta_path}" "#{xcode_path}"`
else
mount_dir = mount(dmg_path)
source = Dir.glob(File.join(mount_dir, 'Xcode*.app')).first
if source.nil?
@@ -278,10 +278,10 @@
end
end
links = links.map { |pre| Xcode.new_prerelease(pre[1].strip.gsub(/.*Xcode /, ''), pre[0], pre[2]) }
if links.count == 0
- version = body.scan(/Xcode.* beta/).last.sub(/<.*?>/, '').gsub(/.*Xcode /, '')
+ version = body.scan(%r{Xcode.* beta.*<\/p>}).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