jazzy 0.9.5 → 0.11.2
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 +154 -0
- data/CONTRIBUTING.md +1 -1
- data/Gemfile.lock +64 -60
- data/README.md +49 -10
- data/Rakefile +7 -6
- data/bin/sourcekitten +0 -0
- data/jazzy.gemspec +5 -5
- data/lib/jazzy/config.rb +38 -5
- data/lib/jazzy/doc.rb +19 -2
- data/lib/jazzy/doc_builder.rb +10 -20
- data/lib/jazzy/docset_builder.rb +1 -1
- data/lib/jazzy/gem_version.rb +1 -1
- data/lib/jazzy/jazzy_markdown.rb +1 -1
- data/lib/jazzy/podspec_documenter.rb +21 -11
- data/lib/jazzy/source_declaration.rb +4 -0
- data/lib/jazzy/source_declaration/access_control_level.rb +10 -3
- data/lib/jazzy/source_document.rb +3 -2
- data/lib/jazzy/sourcekitten.rb +35 -22
- data/lib/jazzy/themes/apple/assets/css/jazzy.css.scss +4 -0
- 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/header.mustache +1 -1
- data/lib/jazzy/themes/fullwidth/assets/js/jazzy.js +33 -17
- data/lib/jazzy/themes/fullwidth/assets/js/jazzy.search.js +17 -10
- 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/header.mustache +1 -1
- data/lib/jazzy/themes/jony/assets/css/jazzy.css.scss +4 -0
- 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/header.mustache +1 -1
- data/spec/integration_spec.rb +7 -12
- metadata +14 -14
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,13 +17,13 @@ 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.5
|
21
|
-
spec.add_runtime_dependency 'mustache', '~> 1.1
|
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.4
|
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 '
|
26
|
-
spec.add_runtime_dependency 'sqlite3', '~> 1.3
|
25
|
+
spec.add_runtime_dependency 'sassc', '~> 2.1'
|
26
|
+
spec.add_runtime_dependency 'sqlite3', '~> 1.3'
|
27
27
|
spec.add_runtime_dependency 'xcinvoke', '~> 0.3.0'
|
28
28
|
|
29
29
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
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,6 +79,14 @@ 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
|
@@ -147,11 +154,16 @@ module Jazzy
|
|
147
154
|
'Default: .jazzy.yaml in source directory or ancestor'],
|
148
155
|
parse: ->(cf) { expand_path(cf) }
|
149
156
|
|
150
|
-
config_attr :
|
151
|
-
command_line: ['-
|
152
|
-
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.',
|
153
161
|
default: []
|
154
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
|
+
|
155
167
|
config_attr :sourcekitten_sourcefile,
|
156
168
|
command_line: ['-s', '--sourcekitten-sourcefile FILEPATH'],
|
157
169
|
description: 'File generated from sourcekitten output to parse',
|
@@ -193,6 +205,20 @@ module Jazzy
|
|
193
205
|
end
|
194
206
|
end
|
195
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
|
+
|
196
222
|
# ──────── Metadata ────────
|
197
223
|
|
198
224
|
config_attr :author_name,
|
@@ -213,9 +239,16 @@ module Jazzy
|
|
213
239
|
|
214
240
|
config_attr :version,
|
215
241
|
command_line: '--module-version VERSION',
|
216
|
-
description: '
|
242
|
+
description: 'Version string to use as part of the the default docs '\
|
243
|
+
'title and inside the docset.',
|
217
244
|
default: '1.0'
|
218
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
|
+
|
219
252
|
config_attr :copyright,
|
220
253
|
command_line: '--copyright COPYRIGHT_MARKDOWN',
|
221
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'
|
@@ -55,21 +55,13 @@ module Jazzy
|
|
55
55
|
def self.build(options)
|
56
56
|
if options.sourcekitten_sourcefile
|
57
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)
|
58
61
|
else
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
else
|
63
|
-
stdout = Dir.chdir(options.source_directory) do
|
64
|
-
arguments = SourceKitten.arguments_from_options(options)
|
65
|
-
SourceKitten.run_sourcekitten(arguments)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
unless $?.success?
|
69
|
-
warn 'Please pass in xcodebuild arguments using -x'
|
70
|
-
warn 'If build arguments are correct, please file an issue on ' \
|
71
|
-
'https://github.com/realm/jazzy/issues'
|
72
|
-
exit $?.exitstatus || 1
|
62
|
+
stdout = Dir.chdir(options.source_directory) do
|
63
|
+
arguments = SourceKitten.arguments_from_options(options)
|
64
|
+
SourceKitten.run_sourcekitten(arguments)
|
73
65
|
end
|
74
66
|
end
|
75
67
|
|
@@ -95,10 +87,9 @@ module Jazzy
|
|
95
87
|
def self.each_doc(output_dir, docs, &block)
|
96
88
|
docs.each do |doc|
|
97
89
|
next unless doc.render_as_page?
|
98
|
-
#
|
99
|
-
path = output_dir +
|
90
|
+
# Filepath is relative to documentation root:
|
91
|
+
path = output_dir + doc.filepath
|
100
92
|
block.call(doc, path)
|
101
|
-
next if doc.name == 'index'
|
102
93
|
each_doc(
|
103
94
|
output_dir,
|
104
95
|
doc.children,
|
@@ -198,8 +189,7 @@ module Jazzy
|
|
198
189
|
assets_directory = Config.instance.theme_directory + 'assets'
|
199
190
|
FileUtils.cp_r(assets_directory.children, destination)
|
200
191
|
Pathname.glob(destination + 'css/**/*.scss').each do |scss|
|
201
|
-
|
202
|
-
css = Sass::Engine.new(contents, syntax: :scss).render
|
192
|
+
css = SassC::Engine.new(scss.read).render
|
203
193
|
css_filename = scss.sub(/\.scss$/, '')
|
204
194
|
css_filename.open('w') { |f| f.write(css) }
|
205
195
|
FileUtils.rm scss
|
data/lib/jazzy/docset_builder.rb
CHANGED
@@ -78,7 +78,7 @@ module Jazzy
|
|
78
78
|
'searchIndex (name, type, path);')
|
79
79
|
source_module.all_declarations.select(&:type).each do |doc|
|
80
80
|
db.execute('INSERT OR IGNORE INTO searchIndex(name, type, path) ' \
|
81
|
-
'VALUES (?, ?, ?);', [doc.name, doc.type.dash_type, doc.
|
81
|
+
'VALUES (?, ?, ?);', [doc.name, doc.type.dash_type, doc.filepath])
|
82
82
|
end
|
83
83
|
end
|
84
84
|
end
|
data/lib/jazzy/gem_version.rb
CHANGED
data/lib/jazzy/jazzy_markdown.rb
CHANGED
@@ -18,7 +18,8 @@ module Jazzy
|
|
18
18
|
Pod::Config.instance.with_changes(installation_root: installation_root,
|
19
19
|
verbose: false) do
|
20
20
|
sandbox = Pod::Sandbox.new(Pod::Config.instance.sandbox_root)
|
21
|
-
|
21
|
+
swift_version = compiler_swift_version(config.swift_version)
|
22
|
+
installer = Pod::Installer.new(sandbox, podfile(swift_version))
|
22
23
|
installer.install!
|
23
24
|
stdout = Dir.chdir(sandbox.root) do
|
24
25
|
targets = installer.pod_targets
|
@@ -27,8 +28,6 @@ module Jazzy
|
|
27
28
|
|
28
29
|
targets.map do |t|
|
29
30
|
args = %W[doc --module-name #{podspec.module_name} -- -target #{t}]
|
30
|
-
swift_version = compiler_swift_version(config.swift_version)
|
31
|
-
args << "SWIFT_VERSION=#{swift_version}"
|
32
31
|
SourceKitten.run_sourcekitten(args)
|
33
32
|
end
|
34
33
|
end
|
@@ -98,7 +97,7 @@ module Jazzy
|
|
98
97
|
private_class_method :github_file_prefix
|
99
98
|
|
100
99
|
# Latest valid value for SWIFT_VERSION.
|
101
|
-
LATEST_SWIFT_VERSION = '
|
100
|
+
LATEST_SWIFT_VERSION = '5'.freeze
|
102
101
|
|
103
102
|
# All valid values for SWIFT_VERSION that are longer
|
104
103
|
# than a major version number. Ordered ascending.
|
@@ -107,13 +106,24 @@ module Jazzy
|
|
107
106
|
# Go from a full Swift version like 4.2.1 to
|
108
107
|
# something valid for SWIFT_VERSION.
|
109
108
|
def compiler_swift_version(user_version)
|
110
|
-
|
109
|
+
unless user_version
|
110
|
+
return podspec_swift_version || LATEST_SWIFT_VERSION
|
111
|
+
end
|
111
112
|
|
112
113
|
LONG_SWIFT_VERSIONS.select do |version|
|
113
114
|
user_version.start_with?(version)
|
114
115
|
end.last || "#{user_version[0]}.0"
|
115
116
|
end
|
116
117
|
|
118
|
+
def podspec_swift_version
|
119
|
+
# `swift_versions` exists from CocoaPods 1.7
|
120
|
+
if podspec.respond_to?('swift_versions')
|
121
|
+
podspec.swift_versions.max
|
122
|
+
else
|
123
|
+
podspec.swift_version
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
117
127
|
# @!group SourceKitten output helper methods
|
118
128
|
|
119
129
|
def pod_path
|
@@ -124,7 +134,8 @@ module Jazzy
|
|
124
134
|
end
|
125
135
|
end
|
126
136
|
|
127
|
-
|
137
|
+
# rubocop:disable Metrics/MethodLength
|
138
|
+
def podfile(swift_version)
|
128
139
|
podspec = @podspec
|
129
140
|
path = pod_path
|
130
141
|
@podfile ||= Pod::Podfile.new do
|
@@ -133,26 +144,25 @@ module Jazzy
|
|
133
144
|
deterministic_uuids: false
|
134
145
|
|
135
146
|
[podspec, *podspec.recursive_subspecs].each do |ss|
|
136
|
-
|
137
|
-
next if ss.respond_to?('test_specification') && ss.test_specification
|
147
|
+
next if ss.test_specification
|
138
148
|
|
139
149
|
ss.available_platforms.each do |p|
|
140
150
|
# Travis builds take too long when building docs for all available
|
141
151
|
# platforms for the Moya integration spec, so we just document OSX.
|
142
|
-
# Also Moya's RxSwift subspec doesn't yet support Swift 4, so skip
|
143
|
-
# that too while we're at it.
|
144
152
|
# TODO: remove once jazzy is fast enough.
|
145
153
|
if ENV['JAZZY_INTEGRATION_SPECS']
|
146
|
-
next if
|
154
|
+
next if p.name != :osx
|
147
155
|
end
|
148
156
|
target("Jazzy-#{ss.name.gsub('/', '__')}-#{p.name}") do
|
149
157
|
use_frameworks!
|
150
158
|
platform p.name, p.deployment_target
|
151
159
|
pod ss.name, path: path.realpath.to_s
|
160
|
+
current_target_definition.swift_version = swift_version
|
152
161
|
end
|
153
162
|
end
|
154
163
|
end
|
155
164
|
end
|
156
165
|
end
|
166
|
+
# rubocop:enable Metrics/MethodLength
|
157
167
|
end
|
158
168
|
end
|
@@ -26,6 +26,8 @@ module Jazzy
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def self.from_doc(doc)
|
29
|
+
return AccessControlLevel.internal if implicit_deinit?(doc)
|
30
|
+
|
29
31
|
accessibility = doc['key.accessibility']
|
30
32
|
if accessibility
|
31
33
|
acl = new(accessibility)
|
@@ -33,12 +35,17 @@ module Jazzy
|
|
33
35
|
return acl
|
34
36
|
end
|
35
37
|
end
|
36
|
-
acl =
|
38
|
+
acl = from_doc_explicit_declaration(doc)
|
37
39
|
acl || AccessControlLevel.public # fallback on public ACL
|
38
40
|
end
|
39
41
|
|
40
|
-
def self.
|
41
|
-
|
42
|
+
def self.implicit_deinit?(doc)
|
43
|
+
doc['key.name'] == 'deinit' &&
|
44
|
+
from_doc_explicit_declaration(doc).nil?
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.from_doc_explicit_declaration(doc)
|
48
|
+
case doc['key.parsed_declaration']
|
42
49
|
when /private\ / then private
|
43
50
|
when /fileprivate\ / then fileprivate
|
44
51
|
when /public\ / then public
|
@@ -20,6 +20,7 @@ module Jazzy
|
|
20
20
|
def self.make_index(readme_path)
|
21
21
|
SourceDocument.new.tap do |sd|
|
22
22
|
sd.name = 'index'
|
23
|
+
sd.url = sd.name + '.html'
|
23
24
|
sd.readme_path = readme_path
|
24
25
|
end
|
25
26
|
end
|
@@ -36,8 +37,8 @@ module Jazzy
|
|
36
37
|
Config.instance
|
37
38
|
end
|
38
39
|
|
39
|
-
def
|
40
|
-
name.downcase.strip.tr(' ', '-').gsub(/[
|
40
|
+
def url_name
|
41
|
+
name.downcase.strip.tr(' ', '-').gsub(/[^[[:word:]]-]/, '')
|
41
42
|
end
|
42
43
|
|
43
44
|
def content(source_module)
|
data/lib/jazzy/sourcekitten.rb
CHANGED
@@ -126,12 +126,11 @@ module Jazzy
|
|
126
126
|
# @return [Hash] input docs with URLs
|
127
127
|
def self.make_doc_urls(docs)
|
128
128
|
docs.each do |doc|
|
129
|
-
if
|
130
|
-
# Create HTML page for this doc if it has children or is root-level
|
129
|
+
if doc.render_as_page?
|
131
130
|
doc.url = (
|
132
131
|
subdir_for_doc(doc) +
|
133
132
|
[sanitize_filename(doc) + '.html']
|
134
|
-
).join('/')
|
133
|
+
).map { |path| ERB::Util.url_encode(path) }.join('/')
|
135
134
|
doc.children = make_doc_urls(doc.children)
|
136
135
|
else
|
137
136
|
# Don't create HTML page for this doc if it doesn't have children
|
@@ -140,8 +139,8 @@ module Jazzy
|
|
140
139
|
warn 'A compile error prevented ' + doc.fully_qualified_name +
|
141
140
|
' from receiving a unique USR. Documentation may be ' \
|
142
141
|
'incomplete. Please check for compile errors by running ' \
|
143
|
-
'`xcodebuild ' \
|
144
|
-
"
|
142
|
+
'`xcodebuild` or `swift build` with arguments ' \
|
143
|
+
"`#{Config.instance.build_tool_arguments.shelljoin}`."
|
145
144
|
end
|
146
145
|
id = doc.usr
|
147
146
|
unless id
|
@@ -159,17 +158,17 @@ module Jazzy
|
|
159
158
|
end
|
160
159
|
# rubocop:enable Metrics/MethodLength
|
161
160
|
|
162
|
-
# Determine the subdirectory in which a doc should be placed
|
161
|
+
# Determine the subdirectory in which a doc should be placed.
|
162
|
+
# Guides in the root for back-compatibility.
|
163
|
+
# Declarations under outer namespace type (Structures, Classes, etc.)
|
163
164
|
def self.subdir_for_doc(doc)
|
164
|
-
|
165
|
-
# Class, etc).
|
165
|
+
return [] if doc.type.markdown?
|
166
166
|
top_level_decl = doc.namespace_path.first
|
167
|
-
if top_level_decl
|
168
|
-
# File program elements under top ancestor’s type (Struct, Class, etc.)
|
167
|
+
if top_level_decl.type.name
|
169
168
|
[top_level_decl.type.plural_url_name] +
|
170
169
|
doc.namespace_ancestors.map(&:name)
|
171
170
|
else
|
172
|
-
#
|
171
|
+
# Category - in the root
|
173
172
|
[]
|
174
173
|
end
|
175
174
|
end
|
@@ -183,22 +182,33 @@ module Jazzy
|
|
183
182
|
end.select { |x| x }.flatten(1)
|
184
183
|
end
|
185
184
|
|
185
|
+
def self.use_spm?(options)
|
186
|
+
options.swift_build_tool == :spm ||
|
187
|
+
(!options.swift_build_tool_configured &&
|
188
|
+
Dir['*.xcodeproj', '*.xcworkspace'].empty? &&
|
189
|
+
!options.build_tool_arguments.include?('-project') &&
|
190
|
+
!options.build_tool_arguments.include?('-workspace'))
|
191
|
+
end
|
192
|
+
|
186
193
|
# Builds SourceKitten arguments based on Jazzy options
|
187
194
|
def self.arguments_from_options(options)
|
188
195
|
arguments = ['doc']
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
196
|
+
if options.objc_mode
|
197
|
+
arguments += objc_arguments_from_options(options)
|
198
|
+
else
|
199
|
+
arguments += ['--spm'] if use_spm?(options)
|
200
|
+
unless options.module_name.empty?
|
201
|
+
arguments += ['--module-name', options.module_name]
|
202
|
+
end
|
203
|
+
arguments += ['--']
|
204
|
+
end
|
205
|
+
|
206
|
+
arguments + options.build_tool_arguments
|
197
207
|
end
|
198
208
|
|
199
209
|
def self.objc_arguments_from_options(options)
|
200
210
|
arguments = []
|
201
|
-
if options.
|
211
|
+
if options.build_tool_arguments.empty?
|
202
212
|
arguments += ['--objc', options.umbrella_header.to_s, '--', '-x',
|
203
213
|
'objective-c', '-isysroot',
|
204
214
|
`xcrun --show-sdk-path --sdk #{options.sdk}`.chomp,
|
@@ -391,7 +401,8 @@ module Jazzy
|
|
391
401
|
parsed &&
|
392
402
|
(annotated.include?(' = default') || # SR-2608
|
393
403
|
parsed.match('@autoclosure|@escaping') || # SR-6321
|
394
|
-
parsed.include?("\n")
|
404
|
+
parsed.include?("\n") ||
|
405
|
+
parsed.include?('extension '))
|
395
406
|
end
|
396
407
|
|
397
408
|
# Replace the fully qualified name of a type with its base name
|
@@ -420,7 +431,9 @@ module Jazzy
|
|
420
431
|
parsed_decl_body.unindent(inline_attrs.length)
|
421
432
|
else
|
422
433
|
# Strip ugly references to decl type name
|
423
|
-
unqualify_name(annotated_decl_body, declaration)
|
434
|
+
unqualified = unqualify_name(annotated_decl_body, declaration)
|
435
|
+
# Workaround for SR-9816
|
436
|
+
unqualified.gsub(" {\n get\n }", '')
|
424
437
|
end
|
425
438
|
|
426
439
|
# @available attrs only in compiler 'interface' style
|