module SpecWatchr::Control
Public Instance Methods
abort_watchr!()
click to toggle source
# File lib/rspec-rails-watchr-emacs.rb, line 221 def abort_watchr! puts '--- Forcing abort...'.white abort("\n") end
exit_watchr()
click to toggle source
# File lib/rspec-rails-watchr-emacs.rb, line 215 def exit_watchr @exiting = true puts '--- Exiting...'.white exit end
reload!()
click to toggle source
# File lib/rspec-rails-watchr-emacs.rb, line 226 def reload! # puts ARGV.join(' ') exec('bundle exec watchr') end
reload_file_list()
click to toggle source
# File lib/rspec-rails-watchr-emacs.rb, line 231 def reload_file_list require 'shellwords' system "touch #{__FILE__.shellescape}" # puts '--- Watch\'d file list reloaded.'.green end
trap_int!()
click to toggle source
# File lib/rspec-rails-watchr-emacs.rb, line 237 def trap_int! # Ctrl-C @interrupted ||= false Signal.trap('INT') { puts ' (Interrupted with CTRL+C)'.red if @interrupted @exiting ? abort_watchr : exit_watchr else @interrupted = true # reload_file_list print '--- What to do now? (q=quit, a=all-specs, r=reload): '.yellow case STDIN.gets.chomp.strip.downcase when 'q'; @interrupted = false; exit_watchr when 'a'; @interrupted = false; rspec_all when 'r'; @interrupted = false; reload! else @interrupted = false puts '--- Bad input, ignored.'.yellow end puts '--- Waiting for changes...'.cyan end } end