Sha256: 8e450a1a30502d509023be7af318c739a521861e59836c75687b38d813fc90e0
Contents?: true
Size: 1.02 KB
Versions: 5
Compression:
Stored size: 1.02 KB
Contents
def growl(title, msg, img) %x{growlnotify -m #{ msg.inspect} -t #{title.inspect} --image ~/.watchr/#{img}.png} end def form_growl_message(str) msg = str.split("\n").last if msg =~ /(\d)\sfailure/ img = $1.to_i > 0 ? 'fail' : 'pass' end growl 'Results', msg, img end def run(cmd) puts cmd output = "" IO.popen(cmd) do |com| com.each_char do |c| print c output << c $stdout.flush end end form_growl_message output end def run_all run('bundle exec rake') end def run_spec(path) path.gsub!('lib/', 'spec/') path.gsub!('_spec', '') file_name = File.basename(path, '.rb') path.gsub!(file_name, file_name + "_spec") if File.exists?(path) system('clear') run(%Q(bundle exec spec #{path})) end end watch('spec/helper\.rb') { run_all } watch('lib/.*\.rb') { |m| run_spec(m[0]) } watch('spec/.*_spec\.rb') { |m| run_spec(m[0]) } # Ctrl-\ Signal.trap('QUIT') do puts " --- Running all tests ---\n\n" run_all end # Ctrl-C Signal.trap('INT') { abort("\n") }
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
toystore-0.6.3 | specs.watchr |
toystore-0.6.2 | specs.watchr |
toystore-0.6.1 | specs.watchr |
toystore-0.6 | specs.watchr |
toystore-0.5 | specs.watchr |