Words for ignore_paths method
This commit is contained in:
parent
54773af2b0
commit
d5b4c4ede7
@ -255,10 +255,13 @@ Optional:
|
||||
|
||||
* The `#watch` method allows you to define which files are supervised by this guard. An optional block can be added to overwrite the paths sent to the guard's `#run_on_change` method or to launch any arbitrary command.
|
||||
* The `#group` method allows you to group several guards together. Groups to be run can be specified with the Guard DSL option `--group` (or `-g`). This comes in handy especially when you have a huge Guardfile and want to focus your development on a certain part. Guards that don't belong to a group are considered global and are always run.
|
||||
* The `#ignore_paths` method allows you to ignore top level directories altogether. This comes is handy when you have large amounts of non-source data in you project. By default .bundle, .git, log, tmp, and vendor are ignored. Currently it is only possible to ignore the immediate descendants of the watched directory.
|
||||
|
||||
Example:
|
||||
|
||||
``` ruby
|
||||
ignore_paths 'foo', 'bar'
|
||||
|
||||
group 'backend' do
|
||||
guard 'bundler' do
|
||||
watch('Gemfile')
|
||||
|
@ -135,6 +135,7 @@ module Guard
|
||||
end
|
||||
|
||||
def ignore_paths(*paths)
|
||||
UI.info "Ignoring paths: #{paths.join(', ')}"
|
||||
::Guard.listener.ignore_paths.push(*paths)
|
||||
end
|
||||
end
|
||||
|
@ -81,6 +81,7 @@ module Guard
|
||||
!!@relativize_paths
|
||||
end
|
||||
|
||||
# return children of the passed dirs that are not in the ignore_paths list
|
||||
def exclude_ignored_paths(dirs, ignore_paths = self.ignore_paths)
|
||||
Dir.glob(dirs.map { |d| "#{d.sub(%r{/+$}, '')}/*" }, File::FNM_DOTMATCH).reject do |path|
|
||||
ignore_paths.include?(File.basename(path))
|
||||
|
Loading…
Reference in New Issue
Block a user