jazzy 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +27 -0
- data/.travis.yml +2 -2
- data/CHANGELOG.md +41 -0
- data/Gemfile.lock +10 -12
- data/README.md +80 -14
- data/Rakefile +1 -3
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/SourceKittenFramework +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Commandant.framework/Commandant +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Commandant.framework/Versions/A/Commandant +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Commandant.framework/Versions/A/Resources/Info.plist +5 -5
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Result.framework/Result +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Result.framework/Versions/A/Resources/Info.plist +4 -4
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/Result.framework/Versions/A/Result +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SWXMLHash.framework/SWXMLHash +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SWXMLHash.framework/Versions/A/Resources/Info.plist +4 -4
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SWXMLHash.framework/Versions/A/SWXMLHash +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SwiftXPC.framework/SwiftXPC +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SwiftXPC.framework/Versions/A/Resources/Info.plist +5 -5
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/SwiftXPC.framework/Versions/A/SwiftXPC +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/libswiftCore.dylib +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/libswiftCoreGraphics.dylib +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/libswiftDarwin.dylib +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/libswiftDispatch.dylib +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/libswiftFoundation.dylib +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Frameworks/libswiftObjectiveC.dylib +0 -0
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/Resources/Info.plist +5 -5
- data/lib/jazzy/SourceKitten/Frameworks/SourceKittenFramework.framework/Versions/A/SourceKittenFramework +0 -0
- data/lib/jazzy/SourceKitten/bin/sourcekitten +0 -0
- data/lib/jazzy/assets/css/jazzy.css.scss +39 -14
- data/lib/jazzy/config.rb +342 -182
- data/lib/jazzy/doc.rb +8 -19
- data/lib/jazzy/doc_builder.rb +38 -26
- data/lib/jazzy/docset_builder.rb +4 -3
- data/lib/jazzy/executable.rb +2 -1
- data/lib/jazzy/gem_version.rb +1 -1
- data/lib/jazzy/jazzy_markdown.rb +16 -4
- data/lib/jazzy/podspec_documenter.rb +25 -11
- data/lib/jazzy/readme_generator.rb +7 -7
- data/lib/jazzy/source_declaration.rb +2 -0
- data/lib/jazzy/source_declaration/access_control_level.rb +21 -15
- data/lib/jazzy/source_declaration/type.rb +79 -5
- data/lib/jazzy/sourcekitten.rb +150 -24
- data/lib/jazzy/templates/doc.mustache +2 -2
- data/lib/jazzy/templates/nav.mustache +1 -1
- data/lib/jazzy/templates/task.mustache +26 -10
- data/spec/integration_spec.rb +34 -39
- metadata +2 -2
data/lib/jazzy/sourcekitten.rb
CHANGED
@@ -9,6 +9,8 @@ require 'jazzy/highlighter'
|
|
9
9
|
require 'jazzy/source_declaration'
|
10
10
|
require 'jazzy/source_mark'
|
11
11
|
|
12
|
+
ELIDED_AUTOLINK_TOKEN = '36f8f5912051ae747ef441d6511ca4cb'.freeze
|
13
|
+
|
12
14
|
module Jazzy
|
13
15
|
# This module interacts with the sourcekitten command-line executable
|
14
16
|
module SourceKitten
|
@@ -68,9 +70,9 @@ module Jazzy
|
|
68
70
|
if parents.empty? || doc.children.count > 0
|
69
71
|
# Create HTML page for this doc if it has children or is root-level
|
70
72
|
doc.url = (
|
71
|
-
|
72
|
-
|
73
|
-
|
73
|
+
subdir_for_doc(doc, parents) +
|
74
|
+
[doc.name + '.html']
|
75
|
+
).join('/')
|
74
76
|
doc.children = make_doc_urls(doc.children, parents + [doc])
|
75
77
|
else
|
76
78
|
# Don't create HTML page for this doc if it doesn't have children
|
@@ -111,11 +113,17 @@ module Jazzy
|
|
111
113
|
# Builds SourceKitten arguments based on Jazzy options
|
112
114
|
def self.arguments_from_options(options)
|
113
115
|
arguments = ['doc']
|
114
|
-
|
116
|
+
if options.objc_mode
|
117
|
+
if options.xcodebuild_arguments.empty?
|
118
|
+
arguments += ['--objc', options.umbrella_header.to_s, '-x',
|
119
|
+
'objective-c', '-isysroot',
|
120
|
+
`xcrun --show-sdk-path`.chomp, '-I',
|
121
|
+
options.framework_root.to_s]
|
122
|
+
end
|
123
|
+
elsif !options.module_name.empty?
|
115
124
|
arguments += ['--module-name', options.module_name]
|
116
125
|
end
|
117
|
-
arguments
|
118
|
-
arguments
|
126
|
+
arguments + options.xcodebuild_arguments
|
119
127
|
end
|
120
128
|
|
121
129
|
# Run sourcekitten with given arguments and return STDOUT
|
@@ -125,8 +133,8 @@ module Jazzy
|
|
125
133
|
raise "Unable to find an Xcode with swift version #{swift_version}."
|
126
134
|
end
|
127
135
|
bin_path = Pathname(__FILE__).parent + 'SourceKitten/bin/sourcekitten'
|
128
|
-
output,
|
129
|
-
|
136
|
+
output, = Executable.execute_command(bin_path, arguments, true,
|
137
|
+
env: xcode.as_env)
|
130
138
|
output
|
131
139
|
end
|
132
140
|
|
@@ -147,10 +155,13 @@ module Jazzy
|
|
147
155
|
def self.should_document?(doc)
|
148
156
|
return false if doc['key.doc.comment'].to_s.include?(':nodoc:')
|
149
157
|
|
158
|
+
# Always document Objective-C declarations.
|
159
|
+
return true if Config.instance.objc_mode
|
160
|
+
|
150
161
|
# Document extensions & enum elements, since we can't tell their ACL.
|
151
162
|
type = SourceDeclaration::Type.new(doc['key.kind'])
|
152
|
-
return true if type.
|
153
|
-
if type.
|
163
|
+
return true if type.swift_enum_element?
|
164
|
+
if type.swift_extension?
|
154
165
|
return Array(doc['key.substructure']).any? do |subdoc|
|
155
166
|
should_document?(subdoc)
|
156
167
|
end
|
@@ -162,7 +173,8 @@ module Jazzy
|
|
162
173
|
def self.process_undocumented_token(doc, declaration)
|
163
174
|
source_directory = Config.instance.source_directory.to_s
|
164
175
|
filepath = doc['key.filepath']
|
165
|
-
|
176
|
+
objc = Config.instance.objc_mode
|
177
|
+
if filepath && (filepath.start_with?(source_directory) || objc)
|
166
178
|
@undocumented_tokens << doc
|
167
179
|
end
|
168
180
|
return nil if !documented_child?(doc) && @skip_undocumented
|
@@ -205,7 +217,7 @@ module Jazzy
|
|
205
217
|
declaration.column = doc['key.doc.column']
|
206
218
|
declaration.declaration = Highlighter.highlight(
|
207
219
|
doc['key.parsed_declaration'] || doc['key.doc.declaration'],
|
208
|
-
'swift',
|
220
|
+
Config.instance.objc_mode ? 'objc' : 'swift',
|
209
221
|
)
|
210
222
|
declaration.abstract = comment_from_doc(doc)
|
211
223
|
declaration.discussion = ''
|
@@ -251,10 +263,8 @@ module Jazzy
|
|
251
263
|
declaration = SourceDeclaration.new
|
252
264
|
declaration.type = SourceDeclaration::Type.new(doc['key.kind'])
|
253
265
|
declaration.typename = doc['key.typename']
|
254
|
-
|
255
|
-
|
256
|
-
end
|
257
|
-
if declaration.type.enum_case?
|
266
|
+
current_mark = SourceMark.new(doc['key.name']) if declaration.type.mark?
|
267
|
+
if declaration.type.swift_enum_case?
|
258
268
|
# Enum "cases" are thin wrappers around enum "elements".
|
259
269
|
declarations += make_source_declarations(doc['key.substructure'])
|
260
270
|
next
|
@@ -292,11 +302,80 @@ module Jazzy
|
|
292
302
|
(@undocumented_tokens.count + @documented_count)
|
293
303
|
end
|
294
304
|
|
305
|
+
# Merges multiple extensions of the same entity into a single document.
|
306
|
+
#
|
307
|
+
# Merges extensions into the protocol/class/struct/enum they extend, if it
|
308
|
+
# occurs in the same project.
|
309
|
+
#
|
310
|
+
# Merges redundant declarations when documenting podspecs.
|
295
311
|
def self.deduplicate_declarations(declarations)
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
312
|
+
duplicate_groups = declarations
|
313
|
+
.group_by { |d| deduplication_key(d) }
|
314
|
+
.values
|
315
|
+
|
316
|
+
duplicate_groups.map do |group|
|
317
|
+
# Put extended type (if present) before extensions
|
318
|
+
merge_declarations(group)
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
# Two declarations get merged if they have the same deduplication key.
|
323
|
+
def self.deduplication_key(decl)
|
324
|
+
if decl.type.swift_extensible? || decl.type.swift_extension?
|
325
|
+
[decl.usr]
|
326
|
+
else
|
327
|
+
[decl.usr, decl.type.kind]
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
# Merges all of the given types and extensions into a single document.
|
332
|
+
def self.merge_declarations(decls)
|
333
|
+
extensions, typedecls = decls.partition { |d| d.type.swift_extension? }
|
334
|
+
|
335
|
+
if typedecls.size > 1
|
336
|
+
warn 'Found conflicting type declarations with the same name, which ' \
|
337
|
+
'may indicate a build issue or a bug in Jazzy: ' +
|
338
|
+
typedecls.map { |t| "#{t.type.name.downcase} #{t.name}" }.join(', ')
|
339
|
+
end
|
340
|
+
typedecl = typedecls.first
|
341
|
+
|
342
|
+
if typedecl && typedecl.type.swift_protocol?
|
343
|
+
merge_default_implementations_into_protocol(typedecl, extensions)
|
344
|
+
mark_members_from_protocol_extension(extensions)
|
345
|
+
extensions.reject! { |ext| ext.children.empty? }
|
346
|
+
end
|
347
|
+
|
348
|
+
decls = typedecls + extensions
|
349
|
+
decls.first.tap do |d|
|
350
|
+
d.children = deduplicate_declarations(decls.flat_map(&:children).uniq)
|
351
|
+
end
|
352
|
+
end
|
353
|
+
|
354
|
+
# If any of the extensions provide default implementations for methods in
|
355
|
+
# the given protocol, merge those members into the protocol doc instead of
|
356
|
+
# keeping them on the extension. These get a “Default implementation”
|
357
|
+
# annotation in the generated docs.
|
358
|
+
def self.merge_default_implementations_into_protocol(protocol, extensions)
|
359
|
+
protocol.children.each do |proto_method|
|
360
|
+
extensions.each do |ext|
|
361
|
+
defaults, ext.children = ext.children.partition do |ext_member|
|
362
|
+
ext_member.name == proto_method.name
|
363
|
+
end
|
364
|
+
unless defaults.empty?
|
365
|
+
proto_method.default_impl_abstract =
|
366
|
+
defaults.flat_map { |d| [d.abstract, d.discussion] }.join("\n\n")
|
367
|
+
end
|
368
|
+
end
|
369
|
+
end
|
370
|
+
end
|
371
|
+
|
372
|
+
# Protocol methods provided only in an extension and not in the protocol
|
373
|
+
# itself are a special beast: they do not use dynamic dispatch. These get an
|
374
|
+
# “Extension method” annotation in the generated docs.
|
375
|
+
def self.mark_members_from_protocol_extension(extensions)
|
376
|
+
extensions.each do |ext|
|
377
|
+
ext.children.each do |ext_member|
|
378
|
+
ext_member.from_protocol_extension = true
|
300
379
|
end
|
301
380
|
end
|
302
381
|
end
|
@@ -309,6 +388,47 @@ module Jazzy
|
|
309
388
|
end.compact
|
310
389
|
end
|
311
390
|
|
391
|
+
def self.names_and_urls(docs)
|
392
|
+
docs.flat_map do |doc|
|
393
|
+
# FIXME: autolink more than just top-level items.
|
394
|
+
[{ name: doc.name, url: doc.url }] # + names_and_urls(doc.children)
|
395
|
+
end
|
396
|
+
end
|
397
|
+
|
398
|
+
def self.autolink_text(text, data, url)
|
399
|
+
regex = /\b(#{data.map { |d| Regexp.escape(d[:name]) }.join('|')})\b/
|
400
|
+
text.gsub(regex) do
|
401
|
+
name = Regexp.last_match(1)
|
402
|
+
auto_url = data.find { |d| d[:name] == name }[:url]
|
403
|
+
if auto_url == url # docs shouldn't autolink to themselves
|
404
|
+
Regexp.last_match(0)
|
405
|
+
else
|
406
|
+
"<a href=\"#{ELIDED_AUTOLINK_TOKEN}#{auto_url}\">#{name}</a>"
|
407
|
+
end
|
408
|
+
end
|
409
|
+
end
|
410
|
+
|
411
|
+
def self.autolink(docs, data)
|
412
|
+
docs.map do |doc|
|
413
|
+
doc.abstract = autolink_text(doc.abstract, data, doc.url)
|
414
|
+
doc.return = autolink_text(doc.return, data, doc.url) if doc.return
|
415
|
+
doc.children = autolink(doc.children, data)
|
416
|
+
doc
|
417
|
+
end
|
418
|
+
end
|
419
|
+
|
420
|
+
def self.reject_objc_enum_typedefs(docs)
|
421
|
+
enums = docs.flat_map do |doc|
|
422
|
+
doc.children.select { |child| child.type.objc_enum? }.map(&:name)
|
423
|
+
end
|
424
|
+
docs.map do |doc|
|
425
|
+
doc.children.reject! do |child|
|
426
|
+
child.type.objc_typedef? && enums.include?(child.name)
|
427
|
+
end
|
428
|
+
doc
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
312
432
|
# Parse sourcekitten STDOUT output as JSON
|
313
433
|
# @return [Hash] structured docs
|
314
434
|
def self.parse(sourcekitten_output, min_acl, skip_undocumented)
|
@@ -318,10 +438,16 @@ module Jazzy
|
|
318
438
|
docs = make_source_declarations(sourcekitten_json)
|
319
439
|
docs = deduplicate_declarations(docs)
|
320
440
|
docs = group_docs(docs)
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
441
|
+
if Config.instance.objc_mode
|
442
|
+
docs = reject_objc_enum_typedefs(docs)
|
443
|
+
else
|
444
|
+
# Remove top-level enum cases because it means they have an ACL lower
|
445
|
+
# than min_acl
|
446
|
+
docs = docs.reject { |doc| doc.type.swift_enum_element? }
|
447
|
+
end
|
448
|
+
docs = make_doc_urls(docs, [])
|
449
|
+
docs = autolink(docs, names_and_urls(docs.flat_map(&:children)))
|
450
|
+
[docs, doc_coverage, @undocumented_tokens]
|
325
451
|
end
|
326
452
|
end
|
327
453
|
end
|
@@ -10,7 +10,7 @@
|
|
10
10
|
</head>
|
11
11
|
<body>
|
12
12
|
{{#dash_type}}
|
13
|
-
<a name="//apple_ref/
|
13
|
+
<a name="//apple_ref/{{language_stub}}/{{dash_type}}/{{name}}" class="dashAnchor"></a>
|
14
14
|
{{/dash_type}}
|
15
15
|
<a title="{{name}} {{kind}} Reference"></a>
|
16
16
|
{{> header}}
|
@@ -29,7 +29,7 @@
|
|
29
29
|
{{^hide_name}}<h1>{{name}}</h1>{{/hide_name}}
|
30
30
|
{{#declaration}}
|
31
31
|
<div class="declaration">
|
32
|
-
<div class="
|
32
|
+
<div class="language">
|
33
33
|
{{{declaration}}}
|
34
34
|
</div>
|
35
35
|
</div>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<ul class="nav-groups">
|
3
3
|
{{#structure}}
|
4
4
|
<li class="nav-group-name">
|
5
|
-
|
5
|
+
<a href="{{path_to_root}}{{section}}.html">{{section}}</a>
|
6
6
|
<ul class="nav-group-tasks">
|
7
7
|
{{#children}}
|
8
8
|
<li class="nav-group-task">
|
@@ -1,12 +1,12 @@
|
|
1
1
|
<div class="task-group">
|
2
2
|
{{#name}}
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
<div class="task-name-container">
|
4
|
+
<a name="/{{uid}}"></a>
|
5
|
+
<a name="//apple_ref/{{language_stub}}/Section/{{name}}" class="dashAnchor"></a>
|
6
|
+
<a href="#/{{uid}}">
|
7
|
+
<h3 class="section-name">{{name}}</h3>
|
8
|
+
</a>
|
9
|
+
</div>
|
10
10
|
{{/name}}
|
11
11
|
<ul>
|
12
12
|
{{#items}}
|
@@ -14,9 +14,19 @@
|
|
14
14
|
<div>
|
15
15
|
<code>
|
16
16
|
<a name="/{{usr}}"></a>
|
17
|
-
<a name="//apple_ref/
|
17
|
+
<a name="//apple_ref/{{language_stub}}/{{dash_type}}/{{name}}" class="dashAnchor"></a>
|
18
18
|
<a class="token" href="#/{{usr}}">{{name}}</a>
|
19
19
|
</code>
|
20
|
+
{{#default_impl_abstract}}
|
21
|
+
<span class="declaration-note">
|
22
|
+
Default implementation
|
23
|
+
</span>
|
24
|
+
{{/default_impl_abstract}}
|
25
|
+
{{#from_protocol_extension}}
|
26
|
+
<span class="declaration-note">
|
27
|
+
Extension method
|
28
|
+
</span>
|
29
|
+
{{/from_protocol_extension}}
|
20
30
|
</div>
|
21
31
|
<div class="height-container">
|
22
32
|
<div class="pointer-container"></div>
|
@@ -30,11 +40,17 @@
|
|
30
40
|
{{/url}}
|
31
41
|
</div>
|
32
42
|
{{/abstract}}
|
43
|
+
{{#default_impl_abstract}}
|
44
|
+
<h4>Default Implementation</h4>
|
45
|
+
<div class="default_impl abstract">
|
46
|
+
{{{default_impl_abstract}}}
|
47
|
+
</div>
|
48
|
+
{{/default_impl_abstract}}
|
33
49
|
{{#declaration}}
|
34
50
|
<div class="declaration">
|
35
51
|
<h4>Declaration</h4>
|
36
|
-
<div class="
|
37
|
-
<p class="aside-title">
|
52
|
+
<div class="language">
|
53
|
+
<p class="aside-title">{{language}}</p>
|
38
54
|
{{{declaration}}}
|
39
55
|
</div>
|
40
56
|
</div>
|
data/spec/integration_spec.rb
CHANGED
@@ -59,7 +59,7 @@ CLIntegracon.configure do |c|
|
|
59
59
|
# Ignore certain OSX files
|
60
60
|
c.ignores '.DS_Store'
|
61
61
|
c.ignores '.git'
|
62
|
-
c.ignores
|
62
|
+
c.ignores %r{^(?!(docs/|execution_output.txt))}
|
63
63
|
c.ignores '*.tgz'
|
64
64
|
|
65
65
|
# Transform produced databases to csv
|
@@ -75,7 +75,6 @@ CLIntegracon.configure do |c|
|
|
75
75
|
end
|
76
76
|
|
77
77
|
describe_cli 'jazzy' do
|
78
|
-
|
79
78
|
subject do |s|
|
80
79
|
s.executable = "ruby #{ROOT + 'bin/jazzy'}"
|
81
80
|
s.environment_vars = {
|
@@ -105,36 +104,13 @@ describe_cli 'jazzy' do
|
|
105
104
|
'--swift-version=1.2'
|
106
105
|
end
|
107
106
|
|
108
|
-
describe 'Creates Realm Swift docs' do
|
109
|
-
realm_version = ''
|
110
|
-
dir = ROOT + 'spec/integration_specs/document_realm_swift1.2/before'
|
111
|
-
Dir.chdir(dir) do
|
112
|
-
realm_version = `./build.sh get-version`.chomp
|
113
|
-
`REALM_SWIFT_VERSION=1.2 ./build.sh set-swift-version`
|
114
|
-
end
|
115
|
-
behaves_like cli_spec 'document_realm_swift1.2',
|
116
|
-
'--author Realm ' \
|
117
|
-
'--author_url "https://realm.io" ' \
|
118
|
-
'--github_url ' \
|
119
|
-
'https://github.com/realm/realm-cocoa ' \
|
120
|
-
'--github-file-prefix https://github.com/realm/' \
|
121
|
-
"realm-cocoa/tree/v#{realm_version} " \
|
122
|
-
'--module RealmSwift ' \
|
123
|
-
"--module-version #{realm_version} " \
|
124
|
-
'--root-url https://realm.io/docs/swift/' \
|
125
|
-
"#{realm_version}/api/ " \
|
126
|
-
'--xcodebuild-arguments ' \
|
127
|
-
'-project,RealmSwift.xcodeproj,-dry-run ' \
|
128
|
-
'--swift-version=1.2'
|
129
|
-
end
|
130
|
-
|
131
107
|
describe 'Creates docs for a podspec with dependencies and subspecs' do
|
132
108
|
behaves_like cli_spec 'document_moya_podspec',
|
133
109
|
'--podspec=Moya.podspec --swift-version=1.2'
|
134
110
|
end
|
135
111
|
end if !travis_swift || travis_swift == '1.2'
|
136
112
|
|
137
|
-
describe 'jazzy swift 2.
|
113
|
+
describe 'jazzy swift 2.1' do
|
138
114
|
describe 'Creates docs with a module name, author name, project URL, ' \
|
139
115
|
'xcodebuild options, and github info' do
|
140
116
|
behaves_like cli_spec 'document_alamofire',
|
@@ -143,8 +119,8 @@ describe_cli 'jazzy' do
|
|
143
119
|
'-x -project,Alamofire.xcodeproj,-dry-run ' \
|
144
120
|
'-g https://github.com/Alamofire/Alamofire ' \
|
145
121
|
'--github-file-prefix https://github.com/' \
|
146
|
-
'Alamofire/Alamofire/blob/
|
147
|
-
'--module-version
|
122
|
+
'Alamofire/Alamofire/blob/3.1.1 ' \
|
123
|
+
'--module-version 3.1.1 ' \
|
148
124
|
'-r http://static.realm.io/jazzy_demo/Alamofire/ ' \
|
149
125
|
'--skip-undocumented'
|
150
126
|
end
|
@@ -153,7 +129,7 @@ describe_cli 'jazzy' do
|
|
153
129
|
realm_version = ''
|
154
130
|
Dir.chdir(ROOT + 'spec/integration_specs/document_realm_swift/before') do
|
155
131
|
realm_version = `./build.sh get-version`.chomp
|
156
|
-
`REALM_SWIFT_VERSION=2.
|
132
|
+
`REALM_SWIFT_VERSION=2.1 ./build.sh set-swift-version`
|
157
133
|
end
|
158
134
|
behaves_like cli_spec 'document_realm_swift',
|
159
135
|
'--author Realm ' \
|
@@ -167,18 +143,37 @@ describe_cli 'jazzy' do
|
|
167
143
|
'--root-url https://realm.io/docs/swift/' \
|
168
144
|
"#{realm_version}/api/ " \
|
169
145
|
'--xcodebuild-arguments ' \
|
170
|
-
'-
|
171
|
-
'--template-directory
|
146
|
+
'-scheme,RealmSwift ' \
|
147
|
+
'--template-directory docs/templates'
|
148
|
+
end
|
149
|
+
|
150
|
+
describe 'Creates Realm Objective-C docs' do
|
151
|
+
realm_version = ''
|
152
|
+
relative_path = 'spec/integration_specs/document_realm_objc/before'
|
153
|
+
Dir.chdir(ROOT + relative_path) do
|
154
|
+
realm_version = `./build.sh get-version`.chomp
|
155
|
+
# jazzy will fail if it can't find all public header files
|
156
|
+
`touch Realm/RLMPlatform.h`
|
157
|
+
end
|
158
|
+
behaves_like cli_spec 'document_realm_objc',
|
159
|
+
'--objc ' \
|
160
|
+
'--author Realm ' \
|
161
|
+
'--author_url "https://realm.io" ' \
|
162
|
+
'--github_url ' \
|
163
|
+
'https://github.com/realm/realm-cocoa ' \
|
164
|
+
'--github-file-prefix https://github.com/realm/' \
|
165
|
+
"realm-cocoa/tree/v#{realm_version} " \
|
166
|
+
'--module Realm ' \
|
167
|
+
"--module-version #{realm_version} " \
|
168
|
+
'--root-url https://realm.io/docs/objc/' \
|
169
|
+
"#{realm_version}/api/ " \
|
170
|
+
'--umbrella-header Realm/Realm.h ' \
|
171
|
+
'--framework-root . ' \
|
172
|
+
'--template-directory docs/templates'
|
172
173
|
end
|
173
174
|
|
174
175
|
describe 'Creates docs for Swift project with a variety of contents' do
|
175
|
-
behaves_like cli_spec 'misc_jazzy_features',
|
176
|
-
'-m MiscJazzyFeatures -a Realm ' \
|
177
|
-
'-u https://github.com/realm/jazzy ' \
|
178
|
-
'-g https://github.com/realm/jazzy ' \
|
179
|
-
'-x -dry-run ' \
|
180
|
-
'--min-acl private ' \
|
181
|
-
'--hide-documentation-coverage'
|
176
|
+
behaves_like cli_spec 'misc_jazzy_features', '-x -dry-run'
|
182
177
|
end
|
183
|
-
end if !travis_swift || travis_swift == '2.
|
178
|
+
end if !travis_swift || travis_swift == '2.1'
|
184
179
|
end
|