Sha256: 64fbb02dd2e1c070e3d1ab504d13b42afe56ad8060c9416e0c7e13332d3b7e7c

Contents?: true

Size: 1.62 KB

Versions: 2

Compression:

Stored size: 1.62 KB

Contents

#!/usr/bin/env ruby
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("-r", "--rc CONFIG", String, "Path to config file. (Defaults to ~/.autotest or current_dir/.autotest)") do |opt|
    options[:rc] = opt
  end
  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

#run the correct Autotest variant fitting to the local structure
$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/../lib")

require 'autotest'
Autotest.options.merge!(options)
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
  puts "style: #{style.map {|s| s.capitalize}.join}"
  target = Autotest.const_get(style.map {|s| s.capitalize}.join)
end
target.run

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
autotest-4.2.6 bin/autotest
autotest-4.2.5 bin/autotest