Class: Specwrk::Watcher
- Inherits:
-
Object
- Object
- Specwrk::Watcher
- Defined in:
- lib/specwrk/watcher.rb
Defined Under Namespace
Classes: Config
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(dir, queue, watchfile = "Specwrk.watchfile.rb") ⇒ Watcher
constructor
A new instance of Watcher.
- #push(paths) ⇒ Object
- #start ⇒ Object
Constructor Details
Class Method Details
.watch(dir, queue, watchfile) ⇒ Object
48 49 50 51 52 |
# File 'lib/specwrk/watcher.rb', line 48 def self.watch(dir, queue, watchfile) instance = new(dir, queue, watchfile) instance.start end |
Instance Method Details
#push(paths) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/specwrk/watcher.rb', line 64 def push(paths) paths.each do |path| relative_path = Pathname.new(path).relative_path_from(Pathname.new(dir)).to_s spec_files = config.spec_files_for(relative_path) spec_files.each do |spec_file_path| queue.push(spec_file_path) if File.exist?(spec_file_path) end end end |
#start ⇒ Object
60 61 62 |
# File 'lib/specwrk/watcher.rb', line 60 def start listener.start end |