jazzy 0.9.3 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.circleci/config.yml +3 -3
- data/CHANGELOG.md +169 -0
- data/CONTRIBUTING.md +1 -1
- data/Gemfile.lock +67 -70
- data/README.md +71 -15
- data/Rakefile +7 -6
- data/bin/sourcekitten +0 -0
- data/jazzy.gemspec +4 -4
- data/lib/jazzy/config.rb +46 -8
- data/lib/jazzy/doc.rb +19 -2
- data/lib/jazzy/doc_builder.rb +22 -24
- data/lib/jazzy/docset_builder.rb +1 -1
- data/lib/jazzy/documentation_generator.rb +0 -7
- data/lib/jazzy/gem_version.rb +1 -1
- data/lib/jazzy/jazzy_markdown.rb +1 -1
- data/lib/jazzy/podspec_documenter.rb +36 -9
- data/lib/jazzy/source_declaration.rb +19 -4
- data/lib/jazzy/source_declaration/access_control_level.rb +10 -3
- data/lib/jazzy/source_declaration/type.rb +11 -1
- data/lib/jazzy/source_document.rb +21 -4
- data/lib/jazzy/sourcekitten.rb +73 -38
- data/lib/jazzy/themes/apple/assets/css/jazzy.css.scss +13 -5
- data/lib/jazzy/themes/apple/assets/js/jazzy.js +33 -20
- data/lib/jazzy/themes/apple/assets/js/jquery.min.js +2 -4
- data/lib/jazzy/themes/apple/templates/deprecation.mustache +12 -0
- data/lib/jazzy/themes/apple/templates/doc.mustache +1 -0
- data/lib/jazzy/themes/apple/templates/header.mustache +1 -1
- data/lib/jazzy/themes/apple/templates/task.mustache +12 -0
- data/lib/jazzy/themes/fullwidth/assets/css/jazzy.css.scss +10 -4
- data/lib/jazzy/themes/fullwidth/assets/js/jazzy.js +33 -17
- data/lib/jazzy/themes/fullwidth/assets/js/jazzy.search.js +17 -9
- data/lib/jazzy/themes/fullwidth/assets/js/jquery.min.js +2 -4
- data/lib/jazzy/themes/fullwidth/assets/js/lunr.min.js +1 -6
- data/lib/jazzy/themes/fullwidth/assets/js/typeahead.jquery.js +182 -46
- data/lib/jazzy/themes/fullwidth/templates/deprecation.mustache +12 -0
- data/lib/jazzy/themes/fullwidth/templates/doc.mustache +1 -0
- data/lib/jazzy/themes/fullwidth/templates/header.mustache +1 -1
- data/lib/jazzy/themes/fullwidth/templates/task.mustache +12 -0
- data/lib/jazzy/themes/jony/assets/css/jazzy.css.scss +9 -2
- data/lib/jazzy/themes/jony/assets/js/jazzy.js +33 -21
- data/lib/jazzy/themes/jony/assets/js/jquery.min.js +2 -4
- data/lib/jazzy/themes/jony/templates/deprecation.mustache +12 -0
- data/lib/jazzy/themes/jony/templates/doc.mustache +1 -0
- data/lib/jazzy/themes/jony/templates/header.mustache +1 -1
- data/lib/jazzy/themes/jony/templates/task.mustache +12 -0
- data/spec/integration_spec.rb +7 -12
- metadata +15 -14
- data/lib/jazzy/readme_generator.rb +0 -61
data/README.md
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|

|
2
2
|
|
3
|
-

|
4
|
-
|
5
3
|
[](https://circleci.com/gh/realm/jazzy)
|
6
4
|
|
7
5
|
*jazzy is a command-line utility that generates documentation for Swift or Objective-C*
|
@@ -10,7 +8,7 @@
|
|
10
8
|
|
11
9
|
Both Swift and Objective-C projects are supported.
|
12
10
|
|
13
|
-
*
|
11
|
+
*SwiftPM support was recently added, so please report any issues you find.*
|
14
12
|
|
15
13
|
Instead of parsing your source files, `jazzy` hooks into [Clang][clang] and
|
16
14
|
[SourceKit][sourcekit] to use the [AST][ast] representation of your code and
|
@@ -25,9 +23,8 @@ unacceptable behavior to [info@realm.io](mailto:info@realm.io).
|
|
25
23
|
|
26
24
|
## Requirements
|
27
25
|
|
28
|
-
*
|
29
|
-
|
30
|
-
`--swift-version` configuration option to succeed.
|
26
|
+
* Development tools that can build the project you wish to document. Jazzy supports
|
27
|
+
both [Xcode][xcode] and [Swift Package Manager][spm] projects.
|
31
28
|
|
32
29
|
## Installation
|
33
30
|
|
@@ -35,17 +32,17 @@ document. It must be installed in a location indexed by Spotlight for the
|
|
35
32
|
[sudo] gem install jazzy
|
36
33
|
```
|
37
34
|
|
38
|
-
|
39
|
-
|
40
|
-
errors.
|
35
|
+
See [Installation Problems](#installation-problems) for solutions to some
|
36
|
+
common problems.
|
41
37
|
|
42
38
|
## Usage
|
43
39
|
|
44
40
|
Run `jazzy` from your command line. Run `jazzy -h` for a list of additional options.
|
45
41
|
|
46
42
|
If your Swift module is the first thing to build, and it builds fine when running
|
47
|
-
`xcodebuild` without any arguments from the root of your project, then
|
48
|
-
`jazzy` (without any arguments) from the root of your project should
|
43
|
+
`xcodebuild` or `swift build` without any arguments from the root of your project, then
|
44
|
+
just running `jazzy` (without any arguments) from the root of your project should
|
45
|
+
succeed too!
|
49
46
|
|
50
47
|
You can set options for your project’s documentation in a configuration file,
|
51
48
|
`.jazzy.yaml` by default. For a detailed explanation and an exhaustive list of
|
@@ -86,13 +83,22 @@ jazzy \
|
|
86
83
|
--github_url https://github.com/realm/realm-cocoa \
|
87
84
|
--github-file-prefix https://github.com/realm/realm-cocoa/tree/v0.96.2 \
|
88
85
|
--module-version 0.96.2 \
|
89
|
-
--
|
86
|
+
--build-tool-arguments -scheme,RealmSwift \
|
90
87
|
--module RealmSwift \
|
91
88
|
--root-url https://realm.io/docs/swift/0.96.2/api/ \
|
92
89
|
--output docs/swift_output \
|
93
90
|
--theme docs/themes
|
94
91
|
```
|
95
92
|
|
93
|
+
This is how docs are generated for a project that uses the Swift Package Manager:
|
94
|
+
|
95
|
+
```shell
|
96
|
+
jazzy \
|
97
|
+
--module DeckOfPlayingCards \
|
98
|
+
--swift-build-tool spm \
|
99
|
+
--build-tool-arguments -Xswiftc,-swift-version,-Xswiftc,5
|
100
|
+
```
|
101
|
+
|
96
102
|
### Objective-C
|
97
103
|
|
98
104
|
To generate documentation for Objective-C headers, you must pass the following
|
@@ -119,7 +125,7 @@ jazzy \
|
|
119
125
|
--github_url https://github.com/realm/realm-cocoa \
|
120
126
|
--github-file-prefix https://github.com/realm/realm-cocoa/tree/v2.2.0 \
|
121
127
|
--module-version 2.2.0 \
|
122
|
-
--
|
128
|
+
--build-tool-arguments --objc,Realm/Realm.h,--,-x,objective-c,-isysroot,$(xcrun --show-sdk-path),-I,$(pwd) \
|
123
129
|
--module Realm \
|
124
130
|
--root-url https://realm.io/docs/objc/2.2.0/api/ \
|
125
131
|
--output docs/objc_output \
|
@@ -168,7 +174,7 @@ Any files found matching the file pattern will be parsed and included as a docum
|
|
168
174
|
|
169
175
|
There are a few limitations:
|
170
176
|
- File names must be unique from source files.
|
171
|
-
- Readme should be specified separately using the `
|
177
|
+
- Readme should be specified separately using the `readme` option.
|
172
178
|
|
173
179
|
### Section description abstracts
|
174
180
|
|
@@ -222,14 +228,63 @@ Note that the `--include` option is applied before the `--exclude` option. For e
|
|
222
228
|
Declarations with a documentation comment containing `:nodoc:` are excluded from the
|
223
229
|
documentation.
|
224
230
|
|
231
|
+
### Choosing the Swift language version
|
232
|
+
|
233
|
+
Jazzy normally uses the Swift compiler from the Xcode currently configured by
|
234
|
+
`xcode-select`. Use the `--swift-version` flag to compile with a different
|
235
|
+
Xcode.
|
236
|
+
|
237
|
+
The value you pass to `--swift-version` must be the Swift language version given
|
238
|
+
by `swift --version` in the Xcode you want to use.
|
239
|
+
|
240
|
+
For example to use Xcode 9.4:
|
241
|
+
```shell
|
242
|
+
jazzy --swift-version 4.1.2
|
243
|
+
```
|
244
|
+
|
225
245
|
## Troubleshooting
|
226
246
|
|
227
|
-
|
247
|
+
### Swift
|
228
248
|
|
229
249
|
**Only extensions are listed in the documentation?**
|
230
250
|
|
231
251
|
Check the `--min-acl` setting -- see [above](#controlling-what-is-documented).
|
232
252
|
|
253
|
+
**Unable to find an Xcode with swift version X**
|
254
|
+
|
255
|
+
1. The value passed with `--swift-version` must exactly match the version
|
256
|
+
number from `swiftc --version`. For example Xcode 10.1 needs
|
257
|
+
`--swift-version 4.2.1`. See [the flag documentation](#choosing-the-swift-language-version).
|
258
|
+
2. The Xcode you want to use must be in the Spotlight index. You can check
|
259
|
+
this using `mdfind 'kMDItemCFBundleIdentifier == com.apple.dt.Xcode'`.
|
260
|
+
Some users have reported this issue being fixed by a reboot; `mdutil -E`
|
261
|
+
may also help. If none of these work then you can set the `DEVELOPER_DIR`
|
262
|
+
environment variable to point to the Xcode you want before running Jazzy
|
263
|
+
without the `--swift-version` flag.
|
264
|
+
|
265
|
+
### Installation Problems
|
266
|
+
|
267
|
+
**Can't find header files / clang**
|
268
|
+
|
269
|
+
Some of the Ruby gems that Jazzy depends on have native C extensions. This
|
270
|
+
means you need the Xcode command-line developer tools installed to build
|
271
|
+
them: run `xcode-select --install` to install the tools.
|
272
|
+
|
273
|
+
**/Applications/Xcode: No such file or directory**
|
274
|
+
|
275
|
+
The path of your active Xcode installation must not contain spaces. So
|
276
|
+
`/Applications/Xcode.app/` is fine, `/Applications/Xcode-10.2.app/` is fine,
|
277
|
+
but `/Applications/Xcode 10.2.app/` is not. This restriction applies only
|
278
|
+
when *installing* Jazzy, not running it.
|
279
|
+
|
280
|
+
### MacOS Before 10.14.4
|
281
|
+
|
282
|
+
Starting with Jazzy 0.10.0, if you see an error similar to `dyld: Symbol not found: _$s11SubSequenceSlTl` then you need to install the [Swift 5 Runtime Support for Command Line Tools](https://support.apple.com/kb/DL1998).
|
283
|
+
|
284
|
+
Alternatively, you can:
|
285
|
+
* Update to macOS 10.14.4 or later; or
|
286
|
+
* Install Xcode 10.2 or later at `/Applications/Xcode.app`.
|
287
|
+
|
233
288
|
## Development
|
234
289
|
|
235
290
|
Please review jazzy's [contributing guidelines](https://github.com/realm/jazzy/blob/master/CONTRIBUTING.md) when submitting pull requests.
|
@@ -280,3 +335,4 @@ read [our blog](https://realm.io/news) or say hi on twitter
|
|
280
335
|
[SourceKitten]: https://github.com/jpsim/SourceKitten "SourceKitten"
|
281
336
|
[bundler]: https://rubygems.org/gems/bundler
|
282
337
|
[mustache]: https://mustache.github.io "Mustache"
|
338
|
+
[spm]: https://swift.org/package-manager/ "Swift Package Manager"
|
data/Rakefile
CHANGED
@@ -75,13 +75,14 @@ begin
|
|
75
75
|
|
76
76
|
# Remove files not used for the comparison
|
77
77
|
# To keep the git diff clean
|
78
|
-
|
78
|
+
specs_root = 'spec/integration_specs/*/after'
|
79
|
+
files_glob = "#{specs_root}/{*,.*}"
|
79
80
|
files_to_delete = FileList[files_glob]
|
80
81
|
.exclude('**/.', '**/..')
|
81
|
-
.exclude(
|
82
|
-
|
83
|
-
.include(
|
84
|
-
.include(
|
82
|
+
.exclude("#{specs_root}/*docs",
|
83
|
+
"#{specs_root}/execution_output.txt")
|
84
|
+
.include("#{specs_root}/**/*.dsidx")
|
85
|
+
.include("#{specs_root}/**/*.tgz")
|
85
86
|
files_to_delete.each do |file_to_delete|
|
86
87
|
sh "rm -rf '#{file_to_delete}'"
|
87
88
|
end
|
@@ -103,7 +104,7 @@ begin
|
|
103
104
|
task :sourcekitten do
|
104
105
|
sk_dir = 'SourceKitten'
|
105
106
|
Dir.chdir(sk_dir) do
|
106
|
-
`swift build -c release
|
107
|
+
`swift build -c release`
|
107
108
|
end
|
108
109
|
FileUtils.cp_r "#{sk_dir}/.build/release/sourcekitten", 'bin'
|
109
110
|
end
|
data/bin/sourcekitten
CHANGED
Binary file
|
data/jazzy.gemspec
CHANGED
@@ -17,12 +17,12 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.files = `git ls-files`.split($/)
|
18
18
|
spec.executables << 'jazzy'
|
19
19
|
|
20
|
-
spec.add_runtime_dependency 'cocoapods', '~> 1.
|
21
|
-
spec.add_runtime_dependency 'mustache', '~>
|
20
|
+
spec.add_runtime_dependency 'cocoapods', '~> 1.5'
|
21
|
+
spec.add_runtime_dependency 'mustache', '~> 1.1'
|
22
22
|
spec.add_runtime_dependency 'open4'
|
23
|
-
spec.add_runtime_dependency 'redcarpet', '~> 3.
|
23
|
+
spec.add_runtime_dependency 'redcarpet', '~> 3.4'
|
24
24
|
spec.add_runtime_dependency 'rouge', ['>= 2.0.6', '< 4.0']
|
25
|
-
spec.add_runtime_dependency '
|
25
|
+
spec.add_runtime_dependency 'sassc', '~> 2.1'
|
26
26
|
spec.add_runtime_dependency 'sqlite3', '~> 1.3'
|
27
27
|
spec.add_runtime_dependency 'xcinvoke', '~> 0.3.0'
|
28
28
|
|
data/lib/jazzy/config.rb
CHANGED
@@ -2,7 +2,6 @@ require 'optparse'
|
|
2
2
|
require 'pathname'
|
3
3
|
require 'uri'
|
4
4
|
|
5
|
-
require 'jazzy/doc'
|
6
5
|
require 'jazzy/podspec_documenter'
|
7
6
|
require 'jazzy/source_declaration/access_control_level'
|
8
7
|
|
@@ -80,16 +79,29 @@ module Jazzy
|
|
80
79
|
@all_config_attrs << Attribute.new(name, **opts)
|
81
80
|
end
|
82
81
|
|
82
|
+
def self.alias_config_attr(name, forward, **opts)
|
83
|
+
alias_method name.to_s, forward.to_s
|
84
|
+
alias_method "#{name}=", "#{forward}="
|
85
|
+
alias_method "#{name}_configured", "#{forward}_configured"
|
86
|
+
alias_method "#{name}_configured=", "#{forward}_configured="
|
87
|
+
@all_config_attrs << Attribute.new(name, **opts)
|
88
|
+
end
|
89
|
+
|
83
90
|
class << self
|
84
91
|
attr_reader :all_config_attrs
|
85
92
|
end
|
86
93
|
|
87
94
|
attr_accessor :base_path
|
88
95
|
|
89
|
-
def
|
96
|
+
def expand_glob_path(path)
|
90
97
|
Pathname(path).expand_path(base_path) # nil means Pathname.pwd
|
91
98
|
end
|
92
99
|
|
100
|
+
def expand_path(path)
|
101
|
+
abs_path = expand_glob_path(path)
|
102
|
+
Pathname(Dir[abs_path][0] || abs_path) # Use existing filesystem spelling
|
103
|
+
end
|
104
|
+
|
93
105
|
# ──────── Build ────────
|
94
106
|
|
95
107
|
# rubocop:disable Layout/AlignParameters
|
@@ -142,11 +154,16 @@ module Jazzy
|
|
142
154
|
'Default: .jazzy.yaml in source directory or ancestor'],
|
143
155
|
parse: ->(cf) { expand_path(cf) }
|
144
156
|
|
145
|
-
config_attr :
|
146
|
-
command_line: ['-
|
147
|
-
description: 'Arguments to forward to xcodebuild'
|
157
|
+
config_attr :build_tool_arguments,
|
158
|
+
command_line: ['-b', '--build-tool-arguments arg1,arg2,…argN', Array],
|
159
|
+
description: 'Arguments to forward to xcodebuild, swift build, or ' \
|
160
|
+
'sourcekitten.',
|
148
161
|
default: []
|
149
162
|
|
163
|
+
alias_config_attr :xcodebuild_arguments, :build_tool_arguments,
|
164
|
+
command_line: ['-x', '--xcodebuild-arguments arg1,arg2,…argN', Array],
|
165
|
+
description: 'Back-compatibility alias for build_tool_arguments.'
|
166
|
+
|
150
167
|
config_attr :sourcekitten_sourcefile,
|
151
168
|
command_line: ['-s', '--sourcekitten-sourcefile FILEPATH'],
|
152
169
|
description: 'File generated from sourcekitten output to parse',
|
@@ -164,7 +181,7 @@ module Jazzy
|
|
164
181
|
'Supports wildcards.',
|
165
182
|
default: [],
|
166
183
|
parse: ->(files) do
|
167
|
-
Array(files).map { |f|
|
184
|
+
Array(files).map { |f| expand_glob_path(f).to_s }
|
168
185
|
end
|
169
186
|
|
170
187
|
config_attr :included_files,
|
@@ -173,7 +190,7 @@ module Jazzy
|
|
173
190
|
'Supports wildcards.',
|
174
191
|
default: [],
|
175
192
|
parse: ->(files) do
|
176
|
-
Array(files).map { |f|
|
193
|
+
Array(files).map { |f| expand_glob_path(f).to_s }
|
177
194
|
end
|
178
195
|
|
179
196
|
config_attr :swift_version,
|
@@ -188,6 +205,20 @@ module Jazzy
|
|
188
205
|
end
|
189
206
|
end
|
190
207
|
|
208
|
+
SWIFT_BUILD_TOOLS = %w[spm xcodebuild].freeze
|
209
|
+
|
210
|
+
config_attr :swift_build_tool,
|
211
|
+
command_line: "--swift-build-tool #{SWIFT_BUILD_TOOLS.join(' | ')}",
|
212
|
+
description: 'Control whether Jazzy uses Swift Package Manager or '\
|
213
|
+
'xcodebuild to build the module to be documented. By '\
|
214
|
+
'default it uses xcodebuild if there is a .xcodeproj '\
|
215
|
+
'file in the source directory.',
|
216
|
+
parse: ->(tool) do
|
217
|
+
return tool.to_sym if SWIFT_BUILD_TOOLS.include?(tool)
|
218
|
+
raise "Unsupported swift_build_tool #{tool}, "\
|
219
|
+
"supported values: #{SWIFT_BUILD_TOOLS.join(', ')}"
|
220
|
+
end
|
221
|
+
|
191
222
|
# ──────── Metadata ────────
|
192
223
|
|
193
224
|
config_attr :author_name,
|
@@ -208,9 +239,16 @@ module Jazzy
|
|
208
239
|
|
209
240
|
config_attr :version,
|
210
241
|
command_line: '--module-version VERSION',
|
211
|
-
description: '
|
242
|
+
description: 'Version string to use as part of the the default docs '\
|
243
|
+
'title and inside the docset.',
|
212
244
|
default: '1.0'
|
213
245
|
|
246
|
+
config_attr :title,
|
247
|
+
command_line: '--title TITLE',
|
248
|
+
description: 'Title to display at the top of each page, overriding the '\
|
249
|
+
'default generated from module name and version.',
|
250
|
+
default: ''
|
251
|
+
|
214
252
|
config_attr :copyright,
|
215
253
|
command_line: '--copyright COPYRIGHT_MARKDOWN',
|
216
254
|
description: 'copyright markdown rendered at the bottom of the docs pages'
|
data/lib/jazzy/doc.rb
CHANGED
@@ -8,10 +8,11 @@ require 'jazzy/jazzy_markdown'
|
|
8
8
|
|
9
9
|
module Jazzy
|
10
10
|
class Doc < Mustache
|
11
|
+
include Config::Mixin
|
12
|
+
|
11
13
|
self.template_name = 'doc'
|
12
14
|
|
13
15
|
def copyright
|
14
|
-
config = Config.instance
|
15
16
|
copyright = config.copyright || (
|
16
17
|
# Fake date is used to keep integration tests consistent
|
17
18
|
date = ENV['JAZZY_FAKE_DATE'] || DateTime.now.strftime('%Y-%m-%d')
|
@@ -28,7 +29,7 @@ module Jazzy
|
|
28
29
|
end
|
29
30
|
|
30
31
|
def objc_first?
|
31
|
-
|
32
|
+
config.objc_mode && config.hide_declarations != 'objc'
|
32
33
|
end
|
33
34
|
|
34
35
|
def language
|
@@ -38,5 +39,21 @@ module Jazzy
|
|
38
39
|
def language_stub
|
39
40
|
objc_first? ? 'objc' : 'swift'
|
40
41
|
end
|
42
|
+
|
43
|
+
def module_version
|
44
|
+
config.version_configured ? config.version : nil
|
45
|
+
end
|
46
|
+
|
47
|
+
def docs_title
|
48
|
+
if config.title_configured
|
49
|
+
config.title
|
50
|
+
elsif config.version_configured
|
51
|
+
# Fake version for integration tests
|
52
|
+
version = ENV['JAZZY_FAKE_MODULE_VERSION'] || config.version
|
53
|
+
"#{config.module_name} #{version} Docs"
|
54
|
+
else
|
55
|
+
"#{config.module_name} Docs"
|
56
|
+
end
|
57
|
+
end
|
41
58
|
end
|
42
59
|
end
|
data/lib/jazzy/doc_builder.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require 'mustache'
|
3
3
|
require 'pathname'
|
4
|
-
require '
|
4
|
+
require 'sassc'
|
5
5
|
|
6
6
|
require 'jazzy/config'
|
7
7
|
require 'jazzy/doc'
|
@@ -10,7 +10,6 @@ require 'jazzy/documentation_generator'
|
|
10
10
|
require 'jazzy/search_builder'
|
11
11
|
require 'jazzy/jazzy_markdown'
|
12
12
|
require 'jazzy/podspec_documenter'
|
13
|
-
require 'jazzy/readme_generator'
|
14
13
|
require 'jazzy/source_declaration'
|
15
14
|
require 'jazzy/source_document'
|
16
15
|
require 'jazzy/source_module'
|
@@ -56,21 +55,13 @@ module Jazzy
|
|
56
55
|
def self.build(options)
|
57
56
|
if options.sourcekitten_sourcefile
|
58
57
|
stdout = options.sourcekitten_sourcefile.read
|
58
|
+
elsif options.podspec_configured
|
59
|
+
pod_documenter = PodspecDocumenter.new(options.podspec)
|
60
|
+
stdout = pod_documenter.sourcekitten_output(options)
|
59
61
|
else
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
else
|
64
|
-
stdout = Dir.chdir(options.source_directory) do
|
65
|
-
arguments = SourceKitten.arguments_from_options(options)
|
66
|
-
SourceKitten.run_sourcekitten(arguments)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
unless $?.success?
|
70
|
-
warn 'Please pass in xcodebuild arguments using -x'
|
71
|
-
warn 'If build arguments are correct, please file an issue on ' \
|
72
|
-
'https://github.com/realm/jazzy/issues'
|
73
|
-
exit $?.exitstatus || 1
|
62
|
+
stdout = Dir.chdir(options.source_directory) do
|
63
|
+
arguments = SourceKitten.arguments_from_options(options)
|
64
|
+
SourceKitten.run_sourcekitten(arguments)
|
74
65
|
end
|
75
66
|
end
|
76
67
|
|
@@ -95,11 +86,10 @@ module Jazzy
|
|
95
86
|
|
96
87
|
def self.each_doc(output_dir, docs, &block)
|
97
88
|
docs.each do |doc|
|
98
|
-
next unless doc.
|
99
|
-
#
|
100
|
-
path = output_dir +
|
89
|
+
next unless doc.render_as_page?
|
90
|
+
# Filepath is relative to documentation root:
|
91
|
+
path = output_dir + doc.filepath
|
101
92
|
block.call(doc, path)
|
102
|
-
next if doc.name == 'index'
|
103
93
|
each_doc(
|
104
94
|
output_dir,
|
105
95
|
doc.children,
|
@@ -199,8 +189,7 @@ module Jazzy
|
|
199
189
|
assets_directory = Config.instance.theme_directory + 'assets'
|
200
190
|
FileUtils.cp_r(assets_directory.children, destination)
|
201
191
|
Pathname.glob(destination + 'css/**/*.scss').each do |scss|
|
202
|
-
|
203
|
-
css = Sass::Engine.new(contents, syntax: :scss).render
|
192
|
+
css = SassC::Engine.new(scss.read).render
|
204
193
|
css_filename = scss.sub(/\.scss$/, '')
|
205
194
|
css_filename.open('w') { |f| f.write(css) }
|
206
195
|
FileUtils.rm scss
|
@@ -332,6 +321,7 @@ module Jazzy
|
|
332
321
|
# Build mustache item for a top-level doc
|
333
322
|
# @param [Hash] item Parsed doc child item
|
334
323
|
# @param [Config] options Build options
|
324
|
+
# rubocop:disable Metrics/MethodLength
|
335
325
|
def self.render_item(item, source_module)
|
336
326
|
# Combine abstract and discussion into abstract
|
337
327
|
abstract = (item.abstract || '') + (item.discussion || '')
|
@@ -347,11 +337,16 @@ module Jazzy
|
|
347
337
|
from_protocol_extension: item.from_protocol_extension,
|
348
338
|
return: item.return,
|
349
339
|
parameters: (item.parameters if item.parameters.any?),
|
350
|
-
url: (item.url if item.
|
340
|
+
url: (item.url if item.render_as_page?),
|
351
341
|
start_line: item.start_line,
|
352
342
|
end_line: item.end_line,
|
343
|
+
direct_link: item.omit_content_from_parent?,
|
344
|
+
deprecation_message: item.deprecation_message,
|
345
|
+
unavailable_message: item.unavailable_message,
|
346
|
+
usage_discouraged: item.usage_discouraged?,
|
353
347
|
}
|
354
348
|
end
|
349
|
+
# rubocop:enable Metrics/MethodLength
|
355
350
|
|
356
351
|
def self.make_task(mark, uid, items)
|
357
352
|
{
|
@@ -391,7 +386,7 @@ module Jazzy
|
|
391
386
|
# @param [Array] doc_structure doc structure comprised of section names and
|
392
387
|
# child names and URLs. @see doc_structure_for_docs
|
393
388
|
def self.document(source_module, doc_model, path_to_root)
|
394
|
-
if doc_model.type.
|
389
|
+
if doc_model.type.markdown?
|
395
390
|
return document_markdown(source_module, doc_model, path_to_root)
|
396
391
|
end
|
397
392
|
|
@@ -418,6 +413,9 @@ module Jazzy
|
|
418
413
|
doc[:github_url] = source_module.github_url
|
419
414
|
doc[:dash_url] = source_module.dash_url
|
420
415
|
doc[:path_to_root] = path_to_root
|
416
|
+
doc[:deprecation_message] = doc_model.deprecation_message
|
417
|
+
doc[:unavailable_message] = doc_model.unavailable_message
|
418
|
+
doc[:usage_discouraged] = doc_model.usage_discouraged?
|
421
419
|
doc.render.gsub(ELIDED_AUTOLINK_TOKEN, path_to_root)
|
422
420
|
end
|
423
421
|
# rubocop:enable Metrics/MethodLength
|