Update all gems, packages, fetch all code, etc.
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 | |
STDOUT.sync = true | |
STDERR.sync = true | |
def run(cmd, *ok_statuses) | |
puts "\n=========> #{cmd}" | |
system(cmd) | |
unless ([0] + ok_statuses).include?($?) | |
puts "Exit status: #{$?}" | |
exit $? | |
end | |
end | |
run('rvm get latest') | |
run('rvm all do gem update --system', 256) | |
run('rvm all do gem update') | |
# packages = `pip freeze`.lines.map { |line| line.split('==')[0] } | |
# run("pip install --upgrade #{packages.join(' ')}") | |
run('brew update') | |
home = File.expand_path('~') | |
%w(Code Documents Sites).each do |root| | |
dir = "#{home}/#{root}/" | |
Dir["#{dir}*"].each do |path| | |
if File.directory?(path) && File.directory?("#{path}/.git") | |
run("cd #{path} && git fetch --all --prune && git submodule update --init && git gc --auto") | |
if File.directory?("#{path}/.git/hgcheckout") | |
run("cd #{path} && git hg fetch", 255) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment