Sha256: b383ca3f26be18caff70d4e0314ec0b02f88f7f91b22d8ea3bbbe9e4790f4f35

Contents?: true

Size: 1.47 KB

Versions: 1

Compression:

Stored size: 1.47 KB

Contents

require 'rubygems'
require 'optparse'

options = {}
OptionParser.new do |opts|
  opts.banner = <<BANNER
Continuouse testing for your ruby app.

Usage:
    autotest [options]
BANNER
  opts.on("-f", "--fast-start","Do not run full tests at start") { options[:no_full_after_start] = true }
  opts.on("-c", "--no-full-after-failed","Do not run full tests after failed test passed") { options[:no_full_after_failed] = true }
  opts.on("-v", "--verbose","Be verbose. Prints files that autotest doesn't know how to map to tests") { options[:verbose] = true }
  opts.on("-q", "--quiet","Be quiet.") { options[:quiet] = true }
  opts.on("-h", "--help","Show this.") { puts opts;exit }
end.parse!

#TODO remove this ? what does it do ?
class Dir
  class << self
    alias :old_index :[]
    def [](*args)
      $-w, old_warn = false, $-w
      old_index(*args)
    ensure
      $-w = old_warn
    end
  end
end

#TODO pass options instead of globals
$v    = options[:verbose]
$f    = options[:no_full_after_start]
$c    = options[:no_full_after_failed]
$q    = options[:quiet]

#run the correct Autotest variant fitting to the local structure
require 'autotest'
target = Autotest
style = Autotest.autodiscover
unless style.empty? then
  mod = "autotest/#{style.join("_")}"
  puts "loading #{mod}" unless options[:quiet]
  begin
    require mod
  rescue LoadError
    abort "Autotest style #{mod} doesn't seem to exist. Aborting."
  end
  target = Autotest.const_get(style.map {|s| s.capitalize}.join)
end
target.run

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
grosser-autotest-4.0.3 bin/autotest