Sha256: 797d2536901b2a8a5eef0b22285f39fb08db5df4094a904ae8cd81c8301decaa

Contents?: true

Size: 1.63 KB

Versions: 1

Compression:

Stored size: 1.63 KB

Contents

#!/usr/bin/env ruby
require 'rubygems'
require 'optparse'

options = {}
OptionParser.new do |opts|
  opts.banner = <<BANNER
Continuous 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!

# remove warnings from Dir.[]
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.expand_path("#{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 => e
    abort "Error loading Autotest style #{mod} (#{e.to_s}). 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

1 entries across 1 versions & 1 rubygems

Version Path
autotest-4.4.0 bin/autotest