Permalink
Browse files

run only existing paths

  • Loading branch information...
Michal Taszycki
Michal Taszycki committed Oct 15, 2011
1 parent 7fc5b49 commit 9888e2fd331fc20b20697dc8237ddb4ae0abbcc6
Showing with 12 additions and 5 deletions.
  1. +5 −3 lib/guard/jessie.rb
  2. +1 −0 lib/guard/jessie/runner.rb
  3. +6 −2 spec/lib/guard/jessie_spec.rb
View
@@ -11,9 +11,11 @@ def run_all
end
def run_on_change paths
- paths_string = paths.map {|path| "#{path}" }.join(' ')
- puts "Running #{paths_string}"
- Runner.run paths
+ paths = paths.select {|path| File.exists?(path) }
+ if paths.any?
+ puts "Running #{paths.join(' ')}"
+ Runner.run paths
+ end
end
end
end
@@ -15,6 +15,7 @@ def self.jessie_command(paths)
cmd_parts.join(" ")
end
+
end
end
end
@@ -9,11 +9,15 @@ module Guard
subject.run_all
end
end
+
describe "#run_on_change" do
- it "runs changed files" do
- Jessie::Runner.should_receive(:run).with(paths)
+ it "runs all existing paths" do
+ File.stub(:exists?) { true }
+ File.stub(:exists?).with(paths[1]) { false }
+ Jessie::Runner.should_receive(:run).with(paths - [paths[1]])
subject.run_on_change paths
end
end
+
end
end

0 comments on commit 9888e2f

Please sign in to comment.