#!/usr/bin/env ruby require 'fileutils' require 'open3' module Repave class Bootstrap def run_task stdout, stderr, status = Open3.capture3("xcode-select -p") unless status.success? puts "XCode Command Line Tools not installed. Installing now to install git." puts ">> Rerun bootstrap after this completes." system "xcode-select --install" return end puts "XCode Command Line Tools installed. Continuing." puts "Making the ~/workspace directory for code projects." workspace = File.expand_path(File.join("~","workspace")) FileUtils.mkdir_p workspace Dir.chdir workspace do puts "Cloning the repave repository" system "git clone https://github.com/infews/workstation_repave.git" end puts "Name this Mac by putting a name in the file ~/.system_name" puts "" puts "You may now run:" puts " cd ~/workspace/workstation_repave && bin/repave" puts "...to repave this Mac." end end end Repave::Bootstrap.new.run_task