Permalink
Browse files

support following at least one symlink

  • Loading branch information...
1 parent c6917a5 commit 14590b4a2ff5ce1163e91b3d3e4f2ba8f38445e6 @jtolds jtolds committed Dec 13, 2011
Showing with 6 additions and 28 deletions.
  1. +1 −1 lib/guard/coffeescript.rb
  2. +2 −20 lib/guard/coffeescript/inspector.rb
  3. +3 −7 spec/guard/coffeescript/inspector_spec.rb
@@ -58,7 +58,7 @@ def start
# @raise [:task_has_failed] when stop has failed
#
def run_all
- run_on_change(Watcher.match_files(self, Dir.glob(File.join('**', '*.coffee'))))
+ run_on_change(Watcher.match_files(self, Dir.glob('**{,/*/**}/*.coffee')))
end
# Gets called when watched paths and files have changes.
@@ -16,9 +16,7 @@ class << self
def clean(paths)
paths.uniq!
paths.compact!
- paths = paths.select { |p| coffee_file?(p) }
- clear_coffee_files_list
- paths
+ paths.select { |p| coffee_file?(p) }
end
private
@@ -29,23 +27,7 @@ def clean(paths)
# @return [Boolean] when the file valid
#
def coffee_file?(path)
- coffee_files.include?(path)
- end
-
- # Scans the project and keeps a list of all
- # CoffeeScript files.
- #
- # @see #clear_coffee_files_list
- # @return [Array<String>] the valid files
- #
- def coffee_files
- @coffee_files ||= Dir.glob('**/*.coffee')
- end
-
- # Clears the list of CoffeeScript files in this project.
- #
- def clear_coffee_files_list
- @coffee_files = nil
+ path =~ /.coffee$/ && File.exists?(path)
end
end
@@ -2,7 +2,7 @@
describe Guard::CoffeeScript::Inspector do
before do
- Dir.stub(:glob).and_return 'a.coffee'
+ File.should_receive(:exists?).with("a.coffee").and_return true
end
let(:inspector) { Guard::CoffeeScript::Inspector }
@@ -17,12 +17,8 @@
end
it 'removes non-coffee files' do
- inspector.clean(['a.coffee', 'b.txt']).should == ['a.coffee']
- end
-
- it 'frees up the list of coffee script files' do
- inspector.should_receive(:clear_coffee_files_list)
- inspector.clean(['a.coffee'])
+ File.should_receive(:exists?).with("doesntexist.coffee").and_return false
+ inspector.clean(['a.coffee', 'b.txt', 'doesntexist.coffee']).should == ['a.coffee']
end
end

0 comments on commit 14590b4

Please sign in to comment.