Sha256: e113de1520c29d2f86997a08666c5c46fe699ed192accb0cc550b6aae0bf26c1

Contents?: true

Size: 977 Bytes

Versions: 3

Compression:

Stored size: 977 Bytes

Contents

# Run me with:
#   $ watchr specs.watchr

# --------------------------------------------------
# Rules
# --------------------------------------------------
watch( '^spec.*/.*_spec\.rb'                 )  { |m| ruby tests }
watch( '^lib/(.*)\.rb'                       )  { |m| ruby tests }
watch( '^spec/helper\.rb'               )  { ruby tests }

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

# --------------------------------------------------
# Helpers
# --------------------------------------------------
def ruby(*paths)
  run "ruby #{gem_opt} -I.:lib:spec -e'%w( #{paths.flatten.join(' ')} ).each {|p| require p }'"
end

def tests
  Dir['spec/**/*_spec.rb'] - ['spec/helper.rb']
end

def run( cmd )
  puts   cmd
  system cmd
end

def gem_opt
  defined?(Gem) ? "-rubygems" : ""
end
puts 'watching...'

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
moxy-0.0.3 specs.watchr
moxy-0.0.2 specs.watchr
moxy-0.0.1 specs.watchr