Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed wildcards in file exclude config #640

Merged
merged 4 commits into from
Aug 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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