shanel-autotest 4.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/bin/autotest ADDED
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ require 'optparse'
4
+
5
+ options = {}
6
+ OptionParser.new do |opts|
7
+ opts.banner = <<BANNER
8
+ Continuouse testing for your ruby app.
9
+
10
+ Usage:
11
+ autotest [options]
12
+ BANNER
13
+ opts.on("-f", "--fast-start","Do not run full tests at start") { options[:no_full_after_start] = true }
14
+ opts.on("-c", "--no-full-after-failed","Do not run full tests after failed test passed") { options[:no_full_after_failed] = true }
15
+ opts.on("-v", "--verbose","Be verbose. Prints files that autotest doesn't know how to map to tests") { options[:verbose] = true }
16
+ opts.on("-q", "--quiet","Be quiet.") { options[:quiet] = true }
17
+ opts.on("-h", "--help","Show this.") { puts opts;exit }
18
+ opts.on("-r", "--rc CONFIG", String, "Path to config file. (Defaults to ~/.autotest)") do |opt|
19
+ options[:rc] = opt
20
+ end
21
+ end.parse!
22
+
23
+ #TODO remove this ? what does it do ?
24
+ class Dir
25
+ class << self
26
+ alias :old_index :[]
27
+ def [](*args)
28
+ $-w, old_warn = false, $-w
29
+ old_index(*args)
30
+ ensure
31
+ $-w = old_warn
32
+ end
33
+ end
34
+ end
35
+
36
+ #run the correct Autotest variant fitting to the local structure
37
+ $LOAD_PATH.unshift("#{File.dirname(__FILE__)}/../lib")
38
+
39
+ require 'autotest'
40
+ Autotest.options.merge!(options)
41
+ target = Autotest
42
+ style = Autotest.autodiscover
43
+ unless style.empty? then
44
+ mod = "autotest/#{style.join("_")}"
45
+ puts "loading #{mod}" unless options[:quiet]
46
+ begin
47
+ require mod
48
+ rescue LoadError
49
+ abort "Autotest style #{mod} doesn't seem to exist. Aborting."
50
+ end
51
+ puts "style: #{style.map {|s| s.capitalize}.join}"
52
+ target = Autotest.const_get(style.map {|s| s.capitalize}.join)
53
+ end
54
+ target.run
data/bin/unit_diff ADDED
@@ -0,0 +1,36 @@
1
+ #!/usr/local/bin/ruby -ws
2
+ #
3
+ # unit_diff - a ruby unit test filter by Ryan Davis <ryand-ruby@zenspider.com>
4
+ #
5
+ # usage:
6
+ #
7
+ # test.rb | unit_diff [options]
8
+ # options:
9
+ # -b ignore whitespace differences
10
+ # -c contextual diff
11
+ # -h show usage
12
+ # -k keep temp diff files around
13
+ # -u unified diff
14
+ # -v display version
15
+
16
+ require 'unit_diff'
17
+
18
+ ############################################################
19
+
20
+ if defined? $v then
21
+ puts "#{File.basename $0} v. #{File.read( File.join(File.dirname(__FILE__),'..','VERSION') )}"
22
+ exit 0
23
+ end
24
+
25
+ if defined? $h then
26
+ File.open(__FILE__) do |f|
27
+ begin; end until f.readline =~ /usage:/
28
+ f.readline
29
+ while line = f.readline and line.sub!(/^# ?/, '')
30
+ $stderr.puts line
31
+ end
32
+ end
33
+ exit 0
34
+ end
35
+
36
+ UnitDiff.unit_diff
@@ -0,0 +1,12 @@
1
+ # -*- ruby -*-
2
+
3
+ # require 'autotest/autoupdate'
4
+ # require 'autotest/once'
5
+ # require 'autotest/rcov'
6
+ # require 'autotest/restart'
7
+ # require 'autotest/timestamp'
8
+
9
+ # Autotest::AutoUpdate.sleep_time = o
10
+ # Autotest::AutoUpdate.update_cmd = o
11
+ # Autotest::RCov.command = o
12
+ # Autotest::RCov.pattern = o
@@ -0,0 +1,26 @@
1
+ module Autotest::AutoUpdate
2
+ @@sleep_time, @@update_cmd, @@updater = 60, "svn up", nil
3
+
4
+ def self.sleep_time= o
5
+ @@sleep_time = o
6
+ end
7
+
8
+ def self.update_cmd= o
9
+ @@update_cmd = o
10
+ end
11
+
12
+ Autotest.add_hook :run_command do |at|
13
+ @@updater.kill if @@updater
14
+ end
15
+
16
+ Autotest.add_hook :ran_command do |at|
17
+ @@updater = Thread.start do
18
+ loop do
19
+ puts "# Waiting for #{@@sleep_time} seconds before updating"
20
+ sleep @@sleep_time
21
+ puts "# Running #{@@update_cmd}"
22
+ system @@update_cmd
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,9 @@
1
+ ##
2
+ # this is for autotest plugin developers only...
3
+
4
+ module Autotest::Once
5
+ Autotest.add_hook :ran_command do |at|
6
+ exit 0
7
+ end
8
+ end
9
+
@@ -0,0 +1,22 @@
1
+ module Autotest::RCov
2
+ @@command, @@pattern = "rcov", "test/*.rb"
3
+
4
+ def self.command= o
5
+ @@command = o
6
+ end
7
+
8
+ def self.pattern= o
9
+ @@pattern = o
10
+ end
11
+
12
+ Autotest.add_hook :all_good do |at|
13
+ system "rake #{@@command} PATTERN=#{@@pattern}"
14
+ end
15
+
16
+ Autotest.add_hook :initialize do |at|
17
+ at.add_exception 'coverage'
18
+ at.add_exception 'coverage.info'
19
+ false
20
+ end
21
+ end
22
+
@@ -0,0 +1,11 @@
1
+ module Autotest::Restart
2
+ Autotest.add_hook :updated do |at, *args|
3
+ if args.flatten.include? ".autotest" then
4
+ warn "Detected change to .autotest, restarting"
5
+ cmd = "autotest"
6
+ cmd << " -v" if $v
7
+
8
+ exec cmd
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ # -*- ruby -*-
2
+
3
+ module Autotest::Timestamp
4
+ Autotest.add_hook :waiting do
5
+ puts
6
+ puts "# Waiting since #{Time.now.strftime "%Y-%m-%d %H:%M:%S"}"
7
+ puts
8
+ end
9
+ end