File: watchr.rb

package info (click to toggle)
ruby-fog-local 0.8.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 212 kB
  • sloc: ruby: 709; makefile: 2
file content (22 lines) | stat: -rw-r--r-- 455 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
ENV['FOG_MOCK'] ||= 'true'
ENV['AUTOTEST'] = 'true'
ENV['WATCHR']   = '1'

def file2shindo(file)
  result = file.sub('lib/fog/', 'tests/').gsub(/\.rb$/, '_tests.rb')
end

def run_shindo_test(file)
  if File.exist? file
    system("shindont #{file}")
  else
    puts "FIXME: No test #{file} [#{Time.now}]"
  end
end

watch( 'tests/.*_tests\.rb' ) do |md|
  run_shindo_test(md[0])
end
watch( 'lib/.*\.rb' ) do |md|
  run_shindo_test(file2shindo(md[0]))
end