Skip to content

Commit

Permalink
Merge pull request #640 from pcantrell/fix-exclude-pattern-matching
Browse files Browse the repository at this point in the history
Fixed wildcards in file exclude config
  • Loading branch information
pcantrell authored Aug 25, 2016
2 parents a77746f + a0bffb2 commit 9f7ee00
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
[Paul Cantrell](https://github.com/pcantrell)
[#598](https://github.com/realm/jazzy/issues/598)

* The `exclude` option now properly supports wildcards.
[Paul Cantrell](https://github.com/pcantrell)
[#640](https://github.com/realm/jazzy/issues/640)

## 0.7.0

##### Breaking
Expand Down
5 changes: 3 additions & 2 deletions lib/jazzy/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,11 @@ def expand_path(path)

config_attr :excluded_files,
command_line: ['-e', '--exclude file1,file2,directory3,…fileN', Array],
description: 'Files/directories to be excluded from documentation',
description: 'Files/directories to be excluded from documentation. '\
'Supports wildcards.',
default: [],
parse: ->(files) do
Array(files).map { |f| expand_path(f) }
Array(files).map { |f| expand_path(f).to_s }
end

config_attr :swift_version,
Expand Down
4 changes: 3 additions & 1 deletion lib/jazzy/sourcekitten.rb
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,9 @@ def self.filter_excluded_files(json)
excluded_files = Config.instance.excluded_files
json.map do |doc|
key = doc.keys.first
doc[key] unless excluded_files.detect { |f| File.fnmatch?(key, f) }
doc[key] unless excluded_files.detect do |exclude|
File.fnmatch?(exclude, key)
end
end.compact
end

Expand Down

0 comments on commit 9f7ee00

Please sign in to comment.