Skip to content

Instantly share code, notes, and snippets.

@thbar
Last active December 15, 2015 10:28
Show Gist options
  • Save thbar/5245443 to your computer and use it in GitHub Desktop.
Save thbar/5245443 to your computer and use it in GitHub Desktop.
How to automatically restart the simulator in RubyMotion when code is updated (beta version!)
require 'childprocess'
guard 'shell' do
watch %r{^app/(.+)\.rb$} do |m|
`killall rake`
# Why this:
# - spawn a child process to avoid locking Guard
# - make sure that the child process has stdout and stdin otherwise it crashes
# - bonus point: get REPL access in the simulator!
process = ChildProcess.build('rake')
process.io.inherit!
process.start
end
end
gem install guard
gem install guard-shell
gem install rb-fsevent
gem install childprocess
guard -i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment