guard/guard-process

support for filename

Closed this issue · 2 comments

actually isn't possible to pass a reference to single files processed.

should be possible to implements something like:

 guard 'process', :name => 'EndlessRunner', :command => 'processor :filename' do
    watch('*.js')
  end

where :filename is any file that match the file js watched.

Im trying to refactoring the code for implementi this, but for now the class Process is thinked for processing a group of files toghever instead of single file of the group matched.

Newer versions of guard have additional callbacks (not just run_on_change, also run_on_removals, etc.). I have not tried this myself, however according to the documentation all the callbacks should receive a list of affected paths when they are called. You can use this to make your idea work. I suggest the following syntax in the Guardfile:

guard 'process', name: 'MyProcessor', command: 'processor: %{filename}' do
  watch('*.js')
end

guard 'process', name: 'MyProcessor', command: 'processor: %{filenames}' do
  watch('*.js')
end

Since there hasn't been any activity on this issue for many months I'm going to go ahead and close it now. If you are still planning on implementing this I'd certainly be interested in seeing the results, feel free to open a new issue or a pull request when you do!