watch-me-now 1.1.1 → 1.1.4
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/README.markdown +1 -1
- data/VERSION +1 -1
- data/bin/watch-me-now +2 -68
- data/lib/watch-me-now.rb +65 -0
- data/watch-me-now.gemspec +1 -1
- metadata +1 -1
data/README.markdown
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.1.
|
|
1
|
+
1.1.4
|
data/bin/watch-me-now
CHANGED
|
@@ -1,69 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
-
#
|
|
3
|
-
|
|
4
|
-
# --------------------------------------------------
|
|
5
|
-
|
|
6
|
-
if __FILE__ == $0
|
|
7
|
-
exec("watchr #{__FILE__}")
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def test_folder
|
|
11
|
-
@test_folder ||= %w[spec specs examples test].detect { |p| File.directory?(p) }
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def test_suffix
|
|
15
|
-
case test_folder
|
|
16
|
-
when "spec", "specs" then "spec"
|
|
17
|
-
when "examples" then "example"
|
|
18
|
-
when "test" then "test"
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def all_test_files
|
|
23
|
-
Dir["#{test_folder}/**/*_#{test_suffix}.rb"]
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def run_test_matching(thing_to_match)
|
|
27
|
-
matches = all_test_files.grep /#{thing_to_match}/i
|
|
28
|
-
if matches.empty?
|
|
29
|
-
puts "Sorry, thanks for playing, but there were no matches for #{thing_to_match}"
|
|
30
|
-
else
|
|
31
|
-
run matches.join(' ')
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def run(files_to_run)
|
|
36
|
-
cmd = "ruby -I#{test_folder} #{files_to_run}"
|
|
37
|
-
puts cmd
|
|
38
|
-
system("ruby -I#{test_folder} #{files_to_run}")
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def run_all_tests
|
|
42
|
-
run(all_test_files.join(' '))
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
# --------------------------------------------------
|
|
47
|
-
# Watchr Rules
|
|
48
|
-
# --------------------------------------------------
|
|
49
|
-
watch("^lib/(.*)\.rb") { |m| run_test_matching(m[1]) }
|
|
50
|
-
watch("^#{test_folder}/(.*)_#{test_suffix}\.rb") { |m| run_test_matching(m[1]) }
|
|
51
|
-
watch("^#{test_folder}/(.*)\.rb") { |m| run_test_matching(m[1]) }
|
|
52
|
-
watch("^#{test_folder}/#{test_suffix}_helper\.rb") { run_all_tests }
|
|
53
|
-
|
|
54
|
-
watch('^features/(.*)') { system "cucumber --tags @fit features/other/" }
|
|
55
|
-
|
|
56
|
-
# --------------------------------------------------
|
|
57
|
-
# Signal Handling
|
|
58
|
-
# --------------------------------------------------
|
|
59
|
-
Signal.trap 'INT' do
|
|
60
|
-
if @sent_an_int then
|
|
61
|
-
puts " A second INT? Ok, I get the message. Shutting down now."
|
|
62
|
-
exit
|
|
63
|
-
else
|
|
64
|
-
puts " Did you just send me an INT? Ugh. I'll quit for real if you do it again."
|
|
65
|
-
@sent_an_int = true
|
|
66
|
-
Kernel.sleep 1.5
|
|
67
|
-
run_all_tests
|
|
68
|
-
end
|
|
69
|
-
end
|
|
2
|
+
# This doesnt work - use 'watchr watch-me-now.rb'
|
|
3
|
+
watchr watch-me-now.rb
|
data/lib/watch-me-now.rb
CHANGED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# --------------------------------------------------
|
|
2
|
+
# Convenience Methods
|
|
3
|
+
# --------------------------------------------------
|
|
4
|
+
def test_folder
|
|
5
|
+
@test_folder ||= %w[spec specs examples test].detect { |p| File.directory?(p) }
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def test_suffix
|
|
9
|
+
case test_folder
|
|
10
|
+
when "spec", "specs" then "spec"
|
|
11
|
+
when "examples" then "example"
|
|
12
|
+
when "test" then "test"
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def all_test_files
|
|
17
|
+
Dir["#{test_folder}/**/*_#{test_suffix}.rb"]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def run_test_matching(thing_to_match)
|
|
21
|
+
matches = all_test_files.grep /#{thing_to_match}/i
|
|
22
|
+
if matches.empty?
|
|
23
|
+
puts "Sorry, thanks for playing, but there were no matches for #{thing_to_match}"
|
|
24
|
+
else
|
|
25
|
+
run matches.join(' ')
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def run(files_to_run)
|
|
30
|
+
cmd = "ruby -I#{test_folder} #{files_to_run}"
|
|
31
|
+
puts cmd
|
|
32
|
+
system("ruby -I#{test_folder} #{files_to_run}")
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def run_all_tests
|
|
36
|
+
run(all_test_files.join(' '))
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# --------------------------------------------------
|
|
41
|
+
# Watchr Rules
|
|
42
|
+
# --------------------------------------------------
|
|
43
|
+
watch("^lib/(.*)\.rb") { |m| run_test_matching(m[1]) }
|
|
44
|
+
watch("^#{test_folder}/(.*)_#{test_suffix}\.rb") { |m| run_test_matching(m[1]) }
|
|
45
|
+
watch("^#{test_folder}/(.*)\.rb") { |m| run_test_matching(m[1]) }
|
|
46
|
+
watch("^#{test_folder}/#{test_suffix}_helper\.rb") { run_all_tests }
|
|
47
|
+
|
|
48
|
+
watch('^features/(.*)') { system "cucumber --tags @fit features/other/" }
|
|
49
|
+
|
|
50
|
+
# --------------------------------------------------
|
|
51
|
+
# Signal Handling
|
|
52
|
+
# --------------------------------------------------
|
|
53
|
+
Signal.trap 'INT' do
|
|
54
|
+
if @sent_an_int then
|
|
55
|
+
puts " A second INT? Ok, I get the message. Shutting down now."
|
|
56
|
+
exit
|
|
57
|
+
else
|
|
58
|
+
puts " Did you just send me an INT? Ugh. I'll quit for real if you do it again."
|
|
59
|
+
@sent_an_int = true
|
|
60
|
+
Kernel.sleep 1.5
|
|
61
|
+
run_all_tests
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
puts "watch-me-now loaded and watching..."
|
data/watch-me-now.gemspec
CHANGED