Skip to content

Commit

Permalink
[Config] Added ability to exclude files from documentation. Fixes #173.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsim committed Apr 30, 2015
1 parent c518ef8 commit 95e7e3b
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 3 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
## Master

##### Breaking

* None.

##### Enhancements

* Added the ability to ignore certain files by passing in an `-e`/`--exclude`
argument to jazzy.
[JP Simard](https://github.com/jpsim)
[#173](https://github.com/realm/jazzy/issues/173)

##### Bug Fixes

* None.


## 0.2.0

##### Breaking
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.4.0</string>
<string>0.4.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
Binary file not shown.
Binary file modified lib/jazzy/SourceKitten/sourcekitten
Binary file not shown.
7 changes: 7 additions & 0 deletions lib/jazzy/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Config
attr_accessor :docset_icon
attr_accessor :docset_path
attr_accessor :source_directory
attr_accessor :excluded

def initialize
PodspecDocumenter.configure(self, Dir['*.podspec{,.json}'].first)
Expand All @@ -42,6 +43,7 @@ def initialize
self.min_acl = SourceDeclaration::AccessControlLevel.public
self.skip_undocumented = false
self.source_directory = Pathname.pwd
self.excluded = []
end

def podspec=(podspec)
Expand Down Expand Up @@ -164,6 +166,11 @@ def self.parse!
config.readme_path = Pathname(readme)
end

opt.on('-e', '--exclude file1,file2,…fileN', Array,
'Files to be excluded from documentation') do |files|
config.excluded = files
end

opt.on('-v', '--version', 'Print version number') do
puts 'jazzy version: ' + Jazzy::VERSION
exit
Expand Down
9 changes: 8 additions & 1 deletion lib/jazzy/sourcekitten.rb
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,19 @@ def self.deduplicate_declarations(declarations)
end
end

def self.filter_excluded_files(json)
excluded_files = Config.instance.excluded
json.map do |doc|
doc.values.first unless excluded_files.include?(doc.keys.first)
end.compact
end

# Parse sourcekitten STDOUT output as JSON
# @return [Hash] structured docs
def self.parse(sourcekitten_output, min_acl, skip_undocumented)
@min_acl = min_acl
@skip_undocumented = skip_undocumented
sourcekitten_json = JSON.parse(sourcekitten_output)
sourcekitten_json = filter_excluded_files(JSON.parse(sourcekitten_output))
docs = make_source_declarations(sourcekitten_json)
docs = deduplicate_declarations(docs)
SourceDeclaration::Type.all.each do |type|
Expand Down

0 comments on commit 95e7e3b

Please sign in to comment.