Skip to content

Instantly share code, notes, and snippets.

@jam1401
Created February 19, 2013 23:35
Show Gist options
  • Save jam1401/4991282 to your computer and use it in GitHub Desktop.
Save jam1401/4991282 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
def wait
system! "read -p '\033[32m(Press Enter To Continue)\033[33m'"
end
def log(str)
puts "---> \033[32m#{str}\033[0m"
end
def system!(command)
system command or raise "Command failed: #{command}"
end
default_xcode_packages_dir = '/Volumes/KINGSTON'
log "Type the path that the xcode folder lives in and press enter (or leave blank to use '#{default_xcode_packages_dir}')"
xcode_packages_dir = gets.strip
xcode_packages_dir = default_xcode_packages_dir if xcode_packages_dir.empty?
log "Installing XCode 4.6..."
log "(this takes a while...)"
system! "hdiutil attach '#{xcode_packages_dir}/xcode46.dmg'"
log "Copying the XCode App(this takes a while...)"
system! "cp -R '/Volumes/XCode/XCode.app' '/Applications'"
system! "hdiutil detach '/Volumes/XCode'"
log "Installing commandline tools for XCode"
system! "hdiutil attach '#{xcode_packages_dir}/xcodetools46.dmg'"
system! "open '/Volumes/Command Line Tools (Mountain Lion)/Command Line Tools (Mountain Lion).mpkg'"
log "Complete Command line tools installation before continuing"
system! "read -p '\033[32m(Press Enter To Continue)\033[33m'"
system! "hdiutil detach '/Volumes/Command Line Tools (Mountain Lion)'"
log "Complete XCode installation before continuing"
system! "open /Applications/XCode.app"
log "Complete XCode install on screen before continuing"
log "You must also download the IOS 5.1 simulator"
log "Open Preferences window in Xcode, navigate to Downloads - Components. You can install iOS 5.1 Simulator there."
wait
log "Complete Xcode License Agreement"
system! "sudo xcodebuild -license"
log "Installing Soloist"
system! "sudo gem install soloist --no-ri --no-rdoc" # sudo needed because we're using system Ruby
log "Generating ssh key ..."
log "Please enter your email: "
email = gets.strip
system! "ssh-keygen -t rsa -C '#{email}'"
system! " cat ~/.ssh/id_rsa.pub | pbcopy"
log "Your ssh public key has been copied to your clipboard. Add it to github and press any key to continue"
wait
log "Cloning chef_tottenham_ci to /tmp for first run"
Dir.chdir('/tmp')
system!('git clone git@github.com:snapfish/chef_tottenham_ci.git --recursive')
Dir.chdir('chef_tottenham_ci')
log "Running soloist from #{Dir.pwd}"
system! "soloist"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment