rsanheim-beholder 0.5.10 → 0.5.12
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/examples/lib/beholder_example.rb +7 -0
- data/lib/beholder.rb +21 -14
- metadata +1 -1
@@ -50,6 +50,13 @@ describe Beholder do
|
|
50
50
|
|
51
51
|
end
|
52
52
|
|
53
|
+
describe "build_cmd" do
|
54
|
+
it "contructs build cmd by requiring all test files" do
|
55
|
+
beholder = Beholder.new
|
56
|
+
beholder.build_cmd(["test/foo_test.rb"]).should == %[ruby -e "%w[test/foo_test].each { |f| require f }"]
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
53
60
|
describe "blink" do
|
54
61
|
|
55
62
|
it "should forget about any interlopers" do
|
data/lib/beholder.rb
CHANGED
@@ -53,9 +53,9 @@ class Beholder
|
|
53
53
|
exit
|
54
54
|
end
|
55
55
|
|
56
|
-
def on_change(
|
57
|
-
say "#{
|
58
|
-
matches =
|
56
|
+
def on_change(paths)
|
57
|
+
say "#{paths} changed" unless paths.nil? || paths.empty?
|
58
|
+
matches = paths.map { |path| find_matches(path) }.uniq.compact
|
59
59
|
run_tests matches
|
60
60
|
end
|
61
61
|
|
@@ -64,6 +64,15 @@ class Beholder
|
|
64
64
|
all_examples.find_all { |ex| ex =~ regex }
|
65
65
|
end
|
66
66
|
|
67
|
+
def build_cmd(paths)
|
68
|
+
classes = paths.collect { |p| p.gsub(".rb", "") }
|
69
|
+
puts "\nRunning #{paths.join(', ').inspect}"
|
70
|
+
execute = %[-e "%w[#{classes}].each { |f| require f }"]
|
71
|
+
cmd = "ruby #{execute}"
|
72
|
+
say cmd
|
73
|
+
cmd
|
74
|
+
end
|
75
|
+
|
67
76
|
protected
|
68
77
|
|
69
78
|
def read_all_maps
|
@@ -153,25 +162,23 @@ class Beholder
|
|
153
162
|
end
|
154
163
|
end
|
155
164
|
|
156
|
-
puts "Unknown file: #{
|
165
|
+
puts "Unknown file: #{path}"
|
157
166
|
return []
|
158
167
|
end
|
159
168
|
|
160
|
-
def run_tests(
|
161
|
-
|
169
|
+
def run_tests(paths)
|
170
|
+
paths.flatten!
|
162
171
|
|
163
|
-
|
164
|
-
found_treasure = File.exist?(
|
165
|
-
puts "#{
|
172
|
+
paths.reject! do |path|
|
173
|
+
found_treasure = File.exist?(path)
|
174
|
+
puts "#{path} does not exist." unless found_treasure
|
166
175
|
end
|
167
176
|
|
168
|
-
return if
|
169
|
-
|
170
|
-
puts "\nRunning #{coordinates.join(', ').inspect}"
|
171
|
-
system "ruby #{coordinates.join(' ')}"
|
177
|
+
return if paths.empty?
|
178
|
+
system build_cmd(paths)
|
172
179
|
blink
|
173
180
|
end
|
174
|
-
|
181
|
+
|
175
182
|
private
|
176
183
|
def say(msg)
|
177
184
|
puts msg if verbose
|