Skip to content

Commit

Permalink
[Docs] Build docs using jazzy (realm#3016)
Browse files Browse the repository at this point in the history
* Add `.jazzy.yaml` configuration file
* Update `swiftlint generate-docs` to write docs to a directory rather than a single file
* Add jazzy to the Gemfile
* Run `bundle update`
* Add CI job to run jazzy automatically and publish to GitHub Pages

![swiftlint-jazzy](https://user-images.githubusercontent.com/474794/71799038-fcf4e180-3008-11ea-81fa-3eb9cf296506.gif)
  • Loading branch information
jpsim authored Jan 8, 2020
1 parent 4388c9f commit d2643db
Show file tree
Hide file tree
Showing 21 changed files with 280 additions and 27,215 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ SwiftLintFramework.framework.zip
benchmark_*
portable_swiftlint.zip
osscheck/
docs/
rule_docs/

# Swift Package Manager
#
Expand Down
20 changes: 20 additions & 0 deletions .jazzy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module: SwiftLintFramework
author: JP Simard, SwiftLint Contributors
author_url: https://jpsim.com
root_url: https://realm.github.io/SwiftLint/
github_url: https://github.com/realm/SwiftLint
github_file_prefix: https://github.com/realm/SwiftLint/tree/master
swift_build_tool: spm
theme: fullwidth
clean: true
copyright: '© 2020 [JP Simard](https://jpsim.com) under MIT.'

documentation: rule_docs/*.md
hide_unlisted_documentation: true
custom_categories_unlisted_prefix: ''
exclude:
- Source/SwiftLintFramework/Rules/**/*.swift
custom_categories:
- name: Rules
children:
- Rule Directory
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@
when case expressions involved tuples.
[JP Simard](https://github.com/jpsim)

* API docs for SwiftLintFramework are now available at
[realm.github.io/SwiftLint](https://realm.github.io/SwiftLint). `Rules.md`
now redirects to the rules directory in the API docs
[here](https://realm.github.io/SwiftLint/rule-directory.html). Contributors no
longer need to update rule documentation in PRs as this is now done
automatically. The rule documentation now includes the default configuration.
[JP Simard](https://github.com/jpsim)
[#1653](https://github.com/realm/SwiftLint/issues/1653)
[#1704](https://github.com/realm/SwiftLint/issues/1704)
[#2808](https://github.com/realm/SwiftLint/issues/2808)
[#2933](https://github.com/realm/SwiftLint/issues/2933)
[#2961](https://github.com/realm/SwiftLint/issues/2961)

#### Bug Fixes

* Fix issues in `unused_import` rule when correcting violations in files
Expand Down
2 changes: 0 additions & 2 deletions Dangerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ modified_files = git.modified_files + git.added_files
has_app_changes = !modified_files.grep(/Source/).empty?
has_test_changes = !modified_files.grep(/Tests/).empty?
has_danger_changes = !modified_files.grep(/Dangerfile|script\/oss-check|Gemfile/).empty?
has_rules_changes = !modified_files.grep(/Source\/SwiftLintFramework\/Rules/).empty?
has_rules_docs_changes = modified_files.include?('Rules.md')

# Add a CHANGELOG entry for app changes
if !modified_files.include?('CHANGELOG.md') && has_app_changes
Expand Down
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
source 'https://rubygems.org'

gem 'cocoapods', '~> 1.7.0'
gem 'cocoapods'
gem 'danger'
gem 'jazzy'
64 changes: 46 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,50 +1,55 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.0)
CFPropertyList (3.0.2)
activesupport (4.2.11.1)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
algoliasearch (1.27.1)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
claide (1.0.3)
claide-plugins (0.9.2)
cork
nap
open4 (~> 1.3)
cocoapods (1.7.0)
cocoapods (1.8.4)
activesupport (>= 4.0.2, < 5)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.7.0)
cocoapods-core (= 1.8.4)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.2.2, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-stats (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.3.1, < 2.0)
cocoapods-trunk (>= 1.4.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (>= 2.2.0, < 3.0)
fourflusher (>= 2.3.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.6.6)
nap (~> 1.0)
ruby-macho (~> 1.4)
xcodeproj (>= 1.8.2, < 2.0)
cocoapods-core (1.7.0)
xcodeproj (>= 1.11.1, < 2.0)
cocoapods-core (1.8.4)
activesupport (>= 4.0.2, < 6)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
cocoapods-deintegrate (1.0.4)
cocoapods-downloader (1.2.2)
cocoapods-downloader (1.3.0)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.0)
cocoapods-stats (1.1.0)
cocoapods-trunk (1.3.1)
cocoapods-trunk (1.4.1)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.1.0)
Expand All @@ -66,41 +71,63 @@ GEM
octokit (~> 4.7)
terminal-table (~> 1)
escape (0.0.4)
faraday (0.17.0)
faraday (0.17.3)
multipart-post (>= 1.2, < 3)
faraday-http-cache (2.0.0)
faraday (~> 0.8)
fourflusher (2.2.0)
ffi (1.11.3)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
git (1.5.0)
httpclient (2.8.3)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jazzy (0.13.1)
cocoapods (~> 1.5)
mustache (~> 1.1)
open4
redcarpet (~> 3.4)
rouge (>= 2.0.6, < 4.0)
sassc (~> 2.1)
sqlite3 (~> 1.3)
xcinvoke (~> 0.3.0)
json (2.3.0)
kramdown (2.1.0)
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
minitest (5.11.3)
liferaft (0.0.6)
minitest (5.13.0)
molinillo (0.6.6)
multipart-post (2.1.1)
mustache (1.1.1)
nanaimo (0.2.6)
nap (1.1.0)
netrc (0.11.0)
no_proxy_fix (0.1.2)
octokit (4.14.0)
octokit (4.15.0)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
open4 (1.3.4)
public_suffix (4.0.1)
public_suffix (4.0.3)
redcarpet (3.5.0)
rouge (3.14.0)
ruby-macho (1.4.0)
sassc (2.2.1)
ffi (~> 1.9)
sawyer (0.8.2)
addressable (>= 2.3.5)
faraday (> 0.8, < 2.0)
sqlite3 (1.4.2)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thread_safe (0.3.6)
tzinfo (1.2.5)
tzinfo (1.2.6)
thread_safe (~> 0.1)
unicode-display_width (1.6.0)
xcodeproj (1.9.0)
xcinvoke (0.3.0)
liferaft (~> 0.0.6)
xcodeproj (1.14.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
Expand All @@ -111,8 +138,9 @@ PLATFORMS
ruby

DEPENDENCIES
cocoapods (~> 1.7.0)
cocoapods
danger
jazzy

BUNDLED WITH
2.0.1
2.0.2
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 Realm Inc.
Copyright (c) 2020 Realm Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ SWIFTLINTFRAMEWORK_PLIST=Source/SwiftLintFramework/Supporting Files/Info.plist

VERSION_STRING=$(shell /usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "$(SWIFTLINT_PLIST)")

.PHONY: all bootstrap clean build install package test uninstall
.PHONY: all bootstrap clean build install package test uninstall docs

all: build

Expand Down Expand Up @@ -136,6 +136,11 @@ publish:
pod trunk push SwiftLintFramework.podspec
pod trunk push SwiftLint.podspec

docs:
swift run swiftlint generate-docs
bundle install
bundle exec jazzy

get_version:
@echo $(VERSION_STRING)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ continues to contribute more over time.
[Pull requests](CONTRIBUTING.md) are encouraged.

You can find an updated list of rules and more information about them
in [Rules.md](Rules.md).
[here](https://realm.github.io/SwiftLint/rule-directory.html).

You can also check [Source/SwiftLintFramework/Rules](Source/SwiftLintFramework/Rules)
directory to see their implementation.
Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ $ TOOLCHAINS=com.apple.dt.toolchain.Swift_2_3 swiftlint autocorrect

SwiftLint 已经包含了超过 75 条规则,并且我们希望 Swift 社区(就是你!)会在以后有更多的贡献,我们鼓励提交 [Pull Requests](CONTRIBUTING.md)

你可以在 [Rules.md](Rules.md) 找到规则的更新列表和更多信息。
你可以在 [Rule Directory](https://realm.github.io/SwiftLint/rule-directory.html) 找到规则的更新列表和更多信息。

你也可以检视 [Source/SwiftLintFramework/Rules](Source/SwiftLintFramework/Rules) 目录来查看它们的实现。

Expand Down
Loading

0 comments on commit d2643db

Please sign in to comment.