Sha256: a0a7b7c666b00fd74d2a096ef6264e025914e0b0227de6c49c518951d5dc7098

Contents?: true

Size: 893 Bytes

Versions: 10

Compression:

Stored size: 893 Bytes

Contents

def run(cmd)
  puts(cmd)
  output = ""
  IO.popen(cmd) do |com|
    com.each_char do |c|
      print c
      output << c
      $stdout.flush
    end
  end
end

def run_test_file(file)
  run %Q(ruby -I"lib:test" -rubygems #{file})
end

def run_all_tests
  run "rake test"
end

def related_test_files(path)
  Dir['test/**/*.rb'].select { |file| file =~ /test_#{File.basename(path)}/ }
end

# watch('.*\.rb') { system('clear'); run_all_tests }
watch('test/helper\.rb')  { system('clear'); run_all_tests }
watch('test/.*test_.*\.rb') { |m| system('clear'); run_test_file(m[0]) }
watch('lib/.*')             { |m| related_test_files(m[0]).each { |file| run_test_file(file) } }

watch('examples/.*\.rb') { |m| system('clear'); run "bundle exec ruby #{m[0]}" }

# Ctrl-\
Signal.trap('QUIT') do
  puts " --- Running all tests ---\n\n"
  run_all_tests
end

# Ctrl-C
Signal.trap('INT') { abort("\n") }

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
plucky-0.8.0 specs.watchr
plucky-0.7.0 specs.watchr
plucky-0.6.6 specs.watchr
plucky-0.6.5 specs.watchr
plucky-0.6.4 specs.watchr
plucky-0.6.3 specs.watchr
plucky-0.6.2 specs.watchr
plucky-0.6.1 specs.watchr
plucky-0.6.0 specs.watchr
plucky-0.5.2 specs.watchr