Created
August 21, 2008 19:24
-
-
Save christianromney/6614 to your computer and use it in GitHub Desktop.
My script to upgrade Git
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 -w | |
require 'fileutils' | |
include FileUtils | |
Version = ARGV.first | |
Downloads = File.join(ENV['HOME'], "Downloads") | |
BashCompletion = File.join(ENV['HOME'], ".bash_completion", "git_bash_completion") | |
# Create src download directory, if needed | |
mkdir_p(Downloads) unless File.exists?(Downloads) | |
# Download and extract the Git source tarball and documentation | |
cd(Downloads) do | |
`wget http://kernel.org/pub/software/scm/git/git-#{Version}.tar.gz` | |
`tar xvzf git-#{Version}.tar.gz` | |
end | |
# Build and install Git | |
cd(File.join(Downloads, "git-#{Version}")) do | |
`./configure --prefix=/usr/local && make && sudo make install` | |
end | |
# Install the man pages | |
cd(Downloads) do | |
`wget http://www.kernel.org/pub/software/scm/git/git-manpages-#{Version}.tar.bz2` | |
`sudo tar xjv -C /usr/share/man -f git-manpages-#{Version}.tar.bz2` | |
`sudo periodic weekly` | |
end | |
# Update bash completion | |
cd(Downloads) do | |
`cp contrib/completion/git-completion.bash #{BashCompletion}` | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment