#!/usr/bin/env ruby

require 'fileutils'
include FileUtils

unless RUBY_PLATFORM.include? 'darwin'
  puts `sudo apt-get install vim-nox`
end

puts `curl https://raw.github.com/carlhuda/janus/master/bootstrap.sh -o - | sh`
puts `curl https://raw.github.com/gist/966563/9004d4b1df713d2440c80ff302e2106a85b8290c/.vimrc.local > ~/.vimrc.local`
puts `git clone git@github.com:posterous/dotfiles.git ~/bin`

DOT_FILES = {
  'irbrc' 						=> '.irbrc', 
  'zshrc' 						=> '.zshrc', 
  'dotfiles/bashrc' 	=> '.bashrc', 
  'dotfiles/autotest' => '.autotest'
}

DOT_FILES.map do |source, sym|
  file_path = "#{ENV['HOME']}/#{sym}"
  if File.exists? file_path
    puts "#{file_path} exits. Moving to #{file_path}.bk"
    FileUtils.rm("#{file_path}", :force => true)
    FileUtils.rm("#{file_path}.bk", :force => true)
  end
  FileUtils.ln_s("#{ENV['HOME']}/bin/#{source}", "#{ENV['HOME']}/#{sym}")
end

`chsh -s /bin/zsh`

unless RUBY_PLATFORM.include? 'darwin'
  puts `gem install --no-rdoc --no-ri map_by_method what_methods net-http-spy awesome_print looksee wirble sketches interactive_editor`
end