public
Fork of defunkt/sake-tasks
Description: Your own personal sake tasks, ripe for sharing.
Homepage:
Clone URL: git://github.com/drnic/sake-tasks.git
sake-tasks / git / manpages / install.sake
100644 22 lines (21 sloc) 0.893 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
namespace :git do
 
  namespace :manpages do
    desc "Install man pages for current git version"
    task :install do
      # process comes from http://subtlegradient.com/articles/2008/02/21/install_git_leopard
      unless git_version = `git --version`.scan(/[\d.]+/)[0]
        puts "Git not installed or 'git --version' not returning format 'git version A.B.C.D'"
        exit
      end
      puts "Installing manpages for git #{git_version}"
      require "fileutils"
      FileUtils.mkdir_p "/usr/local/share/man"
      FileUtils.chdir '/tmp' do
        puts "Downloading and unpacking manpages in #{`pwd`}"
        `curl -O "http://kernel.org/pub/software/scm/git/git-manpages-#{git_version}.tar.bz2"`
        puts `sudo tar xjv -C /usr/local/share/man -f git-manpages-#{git_version}.tar.bz2`
      end
      puts "Test your git manpages by trying the command: man git"
    end
  end
end