simple_test_runner 0.6.0-x86-linux → 0.6.1-x86-linux
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/.gitignore +1 -0
- data/lib/simple_test_runner/version.rb +1 -1
- data/lib/simple_test_runner.rb +29 -17
- metadata +2 -2
data/.gitignore
CHANGED
data/lib/simple_test_runner.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/home/jeff/.rvm/rubies/ruby-1.9.2-p0/bin/ruby
|
2
2
|
require "rubygems"
|
3
3
|
require "bundler/setup"
|
4
|
-
require_relative 'runner_opts'
|
5
4
|
require 'rb-inotify'
|
6
|
-
|
7
5
|
require 'io/wait' # for io.ready?
|
8
6
|
|
7
|
+
require 'runner_opts'
|
8
|
+
|
9
9
|
# Bundler.require # See http://technotales.wordpress.com/2010/08/22/bundler-without-rails/
|
10
10
|
|
11
11
|
# code originally swiped shamelessly from https://github.com/ewollesen/autotest-inotify/blob/master/lib/autotest/inotify.rb
|
@@ -13,23 +13,15 @@ require 'io/wait' # for io.ready?
|
|
13
13
|
|
14
14
|
module SimpleTestRunner
|
15
15
|
|
16
|
+
# Top-level class
|
16
17
|
class TestRunner
|
17
18
|
|
19
|
+
# Initialized gets passed ARGv
|
18
20
|
def initialize args = []
|
19
21
|
@args = args
|
20
22
|
end
|
21
23
|
|
22
|
-
|
23
|
-
if File.exists? @options.config_file_name
|
24
|
-
puts "Are you sure? (y for yes)"
|
25
|
-
a = gets.strip.downcase
|
26
|
-
return unless a == "y"
|
27
|
-
end
|
28
|
-
File.open(@options.config_file_name, 'w+') do |file|
|
29
|
-
file.puts @options.to_yaml
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
24
|
+
# This is the function that runs everything.
|
33
25
|
def run
|
34
26
|
if not running_linux?
|
35
27
|
puts "Sorry. This program currently only runs in Linux."
|
@@ -71,10 +63,33 @@ module SimpleTestRunner
|
|
71
63
|
end
|
72
64
|
end
|
73
65
|
|
66
|
+
# Make a config file.
|
67
|
+
# Currently not used. I was planning on using a config file
|
68
|
+
# for directories to monitor and the command to run.
|
69
|
+
# But at the moment everything goes on the command line,
|
70
|
+
# and I think that's simpler.
|
71
|
+
# But I'm leaving the config file functions in the code,
|
72
|
+
# in case I decide to pick them up again.
|
73
|
+
def make_config_file
|
74
|
+
if File.exists? @options.config_file_name
|
75
|
+
puts "Are you sure? (y for yes)"
|
76
|
+
a = gets.strip.downcase
|
77
|
+
return unless a == "y"
|
78
|
+
end
|
79
|
+
File.open(@options.config_file_name, 'w+') do |file|
|
80
|
+
file.puts @options.to_yaml
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# Are we running on Linux?
|
85
|
+
# returns true or false
|
86
|
+
# The program currently only supports Linux.
|
74
87
|
def running_linux?
|
75
88
|
/linux/i === RbConfig::CONFIG["host_os"]
|
76
89
|
end
|
77
90
|
|
91
|
+
# Set up the INotify::Notifier object to watch for changes
|
92
|
+
# to the target dirs.
|
78
93
|
def setup_monitor
|
79
94
|
@notifier = INotify::Notifier.new
|
80
95
|
@options.parsed.dirs_to_monitor.each do |dir|
|
@@ -82,10 +97,7 @@ module SimpleTestRunner
|
|
82
97
|
end
|
83
98
|
end
|
84
99
|
|
85
|
-
|
86
|
-
flags.include?(:modify) || flags.include?(:moved_to)
|
87
|
-
end
|
88
|
-
|
100
|
+
# Run the command that was specified on the command line.
|
89
101
|
def run_command
|
90
102
|
system "#{@options.parsed.command_str}"
|
91
103
|
end
|