Sha256: eebd8802fa2f45653199b97317ae9c0f3a3151e5d58bd0cd07c8be6062f97a68
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
HH = '#' * 22 unless defined?(HH) H = '#' * 5 unless defined?(H) def usage puts <<-EOS Ctrl-\\ or ctrl-4 Running all tests Ctrl-C Exit EOS end def run(cmd) puts "#{HH} #{Time.now} #{HH}" puts "#{H} #{cmd}" system "/usr/bin/time --format '#{HH} Elapsed time %E' #{cmd}" end def run_it(type, file) case type when 'test'; run %(bundle exec ruby -I test #{file}) # when 'spec'; run %(rspec -X #{file}) else; puts "#{H} unknown type: #{type}, file: #{file}" end end def run_all_tests puts "\n#{HH} Running all tests #{HH}\n" %w[test spec].each { |dir| run "bundle exec rake #{dir}" if File.exist?(dir) } end def run_matching_files(base) base = base.split('_').first %w[test spec].each { |type| files = Dir["#{type}/**/*.rb"].select { |file| file =~ /#{base}_.*\.rb/ } run_it type, files.join(' ') unless files.empty? } end %w[test spec].each { |type| watch("#{type}/#{type}_helper\.rb") { run_all_tests } watch('lib/.*\.rb') { run_all_tests } watch("#{type}/.*/*_#{type}\.rb") { |match| run_it type, match[0] } } # Ctrl-\ or ctrl-4 Signal.trap('QUIT') { run_all_tests } # Ctrl-C Signal.trap('INT') { abort("Interrupted\n") } usage
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
act_with_flags-0.2.4 | .watchr |
formie-1.0.4 | .watchr |