Created
March 24, 2011 14:26
-
-
Save remi/885145 to your computer and use it in GitHub Desktop.
Running this file update /Applications/Chromium.app to the latest Chromium build.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "open-uri" | |
if ARGV.first | |
build_id = ARGV.first | |
else | |
build_id = open("http://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/LAST_CHANGE") { |data| data.read } | |
end | |
build_url = "http://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/#{build_id}/chrome-mac.zip" | |
local_file_path = "/tmp/chromium-#{build_id}.zip" | |
extract_path = "/tmp" | |
puts "The requested Chromium build is #{build_id}." | |
puts "-----------------------------------------" | |
unless File.exists?(local_file_path) | |
puts "Fetching build archive" | |
Kernel.system "wget --verbose #{build_url} -O #{local_file_path}" or exit | |
else | |
puts "Using #{local_file_path} in cache." | |
end | |
puts "Unzipping archive to #{extract_path}" | |
Kernel.system "unzip -x #{local_file_path} -d #{extract_path}" or exit | |
puts "Replacing Chromium.app" | |
Kernel.system "rm -fr /Applications/Chromium.app" or exit | |
Kernel.system "mv #{extract_path}/chrome-mac/Chromium.app /Applications/Chromium.app" or exit | |
puts "Removing temporary files" | |
Kernel.system "rm -rf #{extract_path}/chrome-mac" | |
puts "/Applications/Chromium.app is now the Chromium build ##{build_id}!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment