jazzy 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +100 -0
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +33 -0
- data/CONTRIBUTING.md +1 -1
- data/Gemfile.lock +9 -9
- data/README.md +3 -0
- data/Rakefile +25 -9
- data/bin/sourcekitten +0 -0
- data/jazzy.gemspec +1 -1
- data/lib/jazzy/config.rb +17 -2
- data/lib/jazzy/doc.rb +6 -2
- data/lib/jazzy/doc_builder.rb +3 -3
- data/lib/jazzy/gem_version.rb +1 -1
- data/lib/jazzy/highlighter.rb +24 -2
- data/lib/jazzy/jazzy_markdown.rb +12 -1
- data/lib/jazzy/source_declaration.rb +14 -0
- data/lib/jazzy/source_declaration/type.rb +5 -1
- data/lib/jazzy/sourcekitten.rb +23 -15
- data/spec/integration_spec.rb +26 -16
- metadata +14 -9
- data/bin/libCYaml.dylib +0 -0
- data/circle.yml +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 319a5e064f71871c4311e5b60e6b2a45a85d2c99
|
4
|
+
data.tar.gz: 6cbebd00f828e1ef1a08382a2af92e0723126cbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bd0c57811ffaaf3b0f1dbf5b15441c3acc461024ac1ce5934faa78d82d049d612c7b5d93970b8a532ecbc71beadb3735d6bf53f264c01a128cbf2cc54654c80
|
7
|
+
data.tar.gz: de4b36d41306cc0746f21154838793efc3e95b56d86bf4ad26c911f371db0b83318b3db07e770c223007fc43c327eb9deabdc8e89cd21d3049d87c45872cb345
|
@@ -0,0 +1,100 @@
|
|
1
|
+
aliases:
|
2
|
+
- &save-mac-bundler-cache
|
3
|
+
key: bundle_mac
|
4
|
+
paths:
|
5
|
+
- vendor/bundle
|
6
|
+
|
7
|
+
- &restore-mac-bundler-cache
|
8
|
+
key: bundle_mac
|
9
|
+
|
10
|
+
- &bundler-environment
|
11
|
+
BUNDLE_JOBS: 3
|
12
|
+
BUNDLE_RETRY: 3
|
13
|
+
BUNDLE_PATH: vendor/bundle
|
14
|
+
|
15
|
+
- &shell
|
16
|
+
/bin/bash --login -eo pipefail
|
17
|
+
|
18
|
+
- &set-ruby-version
|
19
|
+
echo "ruby-2.4" > ~/.ruby-version
|
20
|
+
|
21
|
+
version: 2
|
22
|
+
jobs:
|
23
|
+
|
24
|
+
swift:
|
25
|
+
macos:
|
26
|
+
xcode: "9.2.0"
|
27
|
+
environment: *bundler-environment
|
28
|
+
# Used to invoke chruby
|
29
|
+
shell: *shell
|
30
|
+
steps:
|
31
|
+
- checkout
|
32
|
+
- restore_cache: *restore-mac-bundler-cache
|
33
|
+
- run: *set-ruby-version
|
34
|
+
- run: bundle install
|
35
|
+
- run: git submodule update --init --recursive
|
36
|
+
- run: bundle exec rake swift_spec
|
37
|
+
- save_cache: *save-mac-bundler-cache
|
38
|
+
|
39
|
+
objc:
|
40
|
+
macos:
|
41
|
+
xcode: "9.2.0"
|
42
|
+
environment: *bundler-environment
|
43
|
+
# Used to invoke chruby
|
44
|
+
shell: *shell
|
45
|
+
steps:
|
46
|
+
- checkout
|
47
|
+
- restore_cache: *restore-mac-bundler-cache
|
48
|
+
- run: *set-ruby-version
|
49
|
+
- run: bundle install
|
50
|
+
- run: git submodule update --init --recursive
|
51
|
+
- run: bundle exec rake objc_spec
|
52
|
+
- save_cache: *save-mac-bundler-cache
|
53
|
+
|
54
|
+
cocoapods:
|
55
|
+
macos:
|
56
|
+
xcode: "9.2.0"
|
57
|
+
environment: *bundler-environment
|
58
|
+
# Used to invoke chruby
|
59
|
+
shell: *shell
|
60
|
+
steps:
|
61
|
+
- checkout
|
62
|
+
- restore_cache:
|
63
|
+
key: cocoapods
|
64
|
+
- restore_cache: *restore-mac-bundler-cache
|
65
|
+
- run: *set-ruby-version
|
66
|
+
- run: bundle install
|
67
|
+
- run: git submodule update --init --recursive
|
68
|
+
- run: bundle exec rake cocoapods_spec
|
69
|
+
- save_cache:
|
70
|
+
key: cocoapods
|
71
|
+
paths:
|
72
|
+
- ~/.cocoapods
|
73
|
+
- save_cache: *save-mac-bundler-cache
|
74
|
+
|
75
|
+
danger_and_rubocop:
|
76
|
+
docker:
|
77
|
+
- image: circleci/ruby:2.4-node
|
78
|
+
environment: *bundler-environment
|
79
|
+
# Used to invoke chruby
|
80
|
+
shell: *shell
|
81
|
+
steps:
|
82
|
+
- checkout
|
83
|
+
- restore_cache:
|
84
|
+
key: bundle_linux
|
85
|
+
- run: bundle install
|
86
|
+
- run: bundle exec danger --verbose || true
|
87
|
+
- run: bundle exec rake rubocop
|
88
|
+
- save_cache:
|
89
|
+
key: bundle_linux
|
90
|
+
paths:
|
91
|
+
- vendor/bundle
|
92
|
+
|
93
|
+
workflows:
|
94
|
+
version: 2
|
95
|
+
workflow:
|
96
|
+
jobs:
|
97
|
+
- swift
|
98
|
+
- objc
|
99
|
+
- cocoapods
|
100
|
+
- danger_and_rubocop
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,36 @@
|
|
1
|
+
## 0.9.1
|
2
|
+
|
3
|
+
##### Breaking
|
4
|
+
|
5
|
+
* None.
|
6
|
+
|
7
|
+
##### Enhancements
|
8
|
+
|
9
|
+
* Added a config option (`--undocumented-text UNDOCUMENTED_TEXT`) to set the
|
10
|
+
default text for undocumented symbols.
|
11
|
+
[Akhil Batra](https://github.com/akhillies)
|
12
|
+
[#913](https://github.com/realm/jazzy/issues/913)
|
13
|
+
|
14
|
+
* Added a config option to hide Objective-C or Swift declarations:
|
15
|
+
`--hide-declarations [objc|swift]`.
|
16
|
+
[Ibrahim Ulukaya](https://github.com/ulukaya)
|
17
|
+
[#828](https://github.com/realm/jazzy/issues/828)
|
18
|
+
|
19
|
+
* Automatically use Swift or Objective-C syntax highlighting for code blocks
|
20
|
+
in documentation comments. Improve Swift highlighting with latest Rouge.
|
21
|
+
[John Fairhurst](https://github.com/johnfairh)
|
22
|
+
[#218](https://github.com/realm/jazzy/issues/218)
|
23
|
+
|
24
|
+
##### Bug Fixes
|
25
|
+
|
26
|
+
* Fix Swift declarations when generating Objective-C docs for generic types.
|
27
|
+
[John Fairhurst](https://github.com/johnfairh)
|
28
|
+
[#910](https://github.com/realm/jazzy/issues/910)
|
29
|
+
|
30
|
+
* Don't create documentation nodes for generic type parameters.
|
31
|
+
[John Fairhurst](https://github.com/johnfairh)
|
32
|
+
[#878](https://github.com/realm/jazzy/issues/878)
|
33
|
+
|
1
34
|
## 0.9.0
|
2
35
|
|
3
36
|
##### Breaking
|
data/CONTRIBUTING.md
CHANGED
@@ -49,7 +49,7 @@ git push
|
|
49
49
|
You'll need push access to the integration specs repo to do this. You can
|
50
50
|
request access from one of the maintainers when filing your PR.
|
51
51
|
|
52
|
-
You must have Xcode
|
52
|
+
You must have Xcode 9.2 installed to build the integration specs.
|
53
53
|
|
54
54
|
## Making changes to SourceKitten
|
55
55
|
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
jazzy (0.9.
|
4
|
+
jazzy (0.9.1)
|
5
5
|
cocoapods (~> 1.0)
|
6
6
|
mustache (~> 0.99)
|
7
7
|
open4
|
8
8
|
redcarpet (~> 3.2)
|
9
|
-
rouge (
|
9
|
+
rouge (>= 2.0.6, < 4.0)
|
10
10
|
sass (~> 3.4)
|
11
11
|
sqlite3 (~> 1.3)
|
12
12
|
xcinvoke (~> 0.3.0)
|
@@ -14,7 +14,7 @@ PATH
|
|
14
14
|
GEM
|
15
15
|
remote: https://rubygems.org/
|
16
16
|
specs:
|
17
|
-
CFPropertyList (2.3.
|
17
|
+
CFPropertyList (2.3.6)
|
18
18
|
activesupport (4.2.10)
|
19
19
|
i18n (~> 0.7)
|
20
20
|
minitest (~> 5.1)
|
@@ -96,12 +96,12 @@ GEM
|
|
96
96
|
gh_inspector (1.0.3)
|
97
97
|
git (1.3.0)
|
98
98
|
hashdiff (0.3.7)
|
99
|
-
i18n (0.9.
|
99
|
+
i18n (0.9.1)
|
100
100
|
concurrent-ruby (~> 1.0)
|
101
101
|
kramdown (1.15.0)
|
102
102
|
liferaft (0.0.6)
|
103
103
|
metaclass (0.0.4)
|
104
|
-
minitest (5.
|
104
|
+
minitest (5.11.1)
|
105
105
|
mocha (1.3.0)
|
106
106
|
metaclass (~> 0.0.1)
|
107
107
|
mocha-on-bacon (0.2.3)
|
@@ -130,7 +130,7 @@ GEM
|
|
130
130
|
rb-inotify (0.9.10)
|
131
131
|
ffi (>= 0.5.0, < 2)
|
132
132
|
redcarpet (3.4.0)
|
133
|
-
rouge (1.
|
133
|
+
rouge (3.1.0)
|
134
134
|
rubocop (0.49.0)
|
135
135
|
parallel (~> 1.10)
|
136
136
|
parser (>= 2.3.3.1, < 3.0)
|
@@ -141,7 +141,7 @@ GEM
|
|
141
141
|
ruby-macho (1.1.0)
|
142
142
|
ruby-progressbar (1.9.0)
|
143
143
|
safe_yaml (1.0.4)
|
144
|
-
sass (3.5.
|
144
|
+
sass (3.5.5)
|
145
145
|
sass-listen (~> 4.0.0)
|
146
146
|
sass-listen (4.0.0)
|
147
147
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
@@ -162,7 +162,7 @@ GEM
|
|
162
162
|
hashdiff
|
163
163
|
xcinvoke (0.3.0)
|
164
164
|
liferaft (~> 0.0.6)
|
165
|
-
xcodeproj (1.5.
|
165
|
+
xcodeproj (1.5.4)
|
166
166
|
CFPropertyList (~> 2.3.3)
|
167
167
|
claide (>= 1.0.2, < 2.0)
|
168
168
|
colored2 (~> 3.1)
|
@@ -186,4 +186,4 @@ DEPENDENCIES
|
|
186
186
|
webmock
|
187
187
|
|
188
188
|
BUNDLED WITH
|
189
|
-
1.
|
189
|
+
1.16.0
|
data/README.md
CHANGED
@@ -99,6 +99,8 @@ parameters to jazzy:
|
|
99
99
|
* `--framework-root ...`
|
100
100
|
* `--sdk [iphone|watch|appletv][os|simulator]|macosx` (optional, default value
|
101
101
|
of `macosx`)
|
102
|
+
* `--hide-declarations [objc|swift]` (optional, hides the selected language
|
103
|
+
declarations)
|
102
104
|
|
103
105
|
##### Example
|
104
106
|
|
@@ -155,6 +157,7 @@ directory.
|
|
155
157
|
| Example | `--documentation=Docs/*.md` |
|
156
158
|
| jazzy.yaml example | `documentation: Docs/*.md` |
|
157
159
|
|
160
|
+
By default, jazzy looks for one of README.md, README.markdown, README.mdown or README (in that order) in the directory from where it runs to render the index page at the root of the docs output directory.
|
158
161
|
Using the `--documentation` option, extra markdown files can be integrated into the generated docs and sidebar navigation.
|
159
162
|
|
160
163
|
Any files found matching the file pattern will be parsed and included as a document with the type 'Guide' when generated. If the files are not included using the `custom_categories` config option, they will be grouped under 'Other Guides' in the sidebar navigation.
|
data/Rakefile
CHANGED
@@ -27,13 +27,34 @@ begin
|
|
27
27
|
|
28
28
|
desc 'Run specs'
|
29
29
|
task :spec do
|
30
|
-
title 'Running
|
30
|
+
title 'Running Tests'
|
31
|
+
Rake::Task['unit_spec'].invoke
|
32
|
+
Rake::Task['objc_spec'].invoke
|
33
|
+
Rake::Task['swift_spec'].invoke
|
34
|
+
Rake::Task['cocoapods_spec'].invoke
|
35
|
+
Rake::Task['rubocop'].invoke
|
36
|
+
end
|
37
|
+
|
38
|
+
desc 'Run unit specs'
|
39
|
+
task :unit_spec do
|
31
40
|
files = FileList['spec/*_spec.rb']
|
32
41
|
.exclude('spec/integration_spec.rb').shuffle.join(' ')
|
33
42
|
sh "bundle exec bacon #{files}"
|
34
|
-
|
43
|
+
end
|
35
44
|
|
36
|
-
|
45
|
+
desc 'Run objc integration specs'
|
46
|
+
task :objc_spec do
|
47
|
+
sh 'JAZZY_SPEC_SUBSET=objc bundle exec bacon spec/integration_spec.rb'
|
48
|
+
end
|
49
|
+
|
50
|
+
desc 'Run swift integration specs'
|
51
|
+
task :swift_spec do
|
52
|
+
sh 'JAZZY_SPEC_SUBSET=swift bundle exec bacon spec/integration_spec.rb'
|
53
|
+
end
|
54
|
+
|
55
|
+
desc 'Run cocoapods integration specs'
|
56
|
+
task :cocoapods_spec do
|
57
|
+
sh 'JAZZY_SPEC_SUBSET=cocoapods bundle exec bacon spec/integration_spec.rb'
|
37
58
|
end
|
38
59
|
|
39
60
|
desc 'Rebuilds integration fixtures'
|
@@ -84,12 +105,7 @@ begin
|
|
84
105
|
Dir.chdir(sk_dir) do
|
85
106
|
`swift build -c release -Xswiftc -static-stdlib`
|
86
107
|
end
|
87
|
-
|
88
|
-
FileUtils.cp_r Dir["#{build_dir}/{sourcekitten,*.dylib}"], 'bin'
|
89
|
-
Dir["#{build_dir}/*.dylib"].each do |file|
|
90
|
-
system 'install_name_tool', '-change', File.expand_path(file),
|
91
|
-
"@loader_path/#{File.basename(file)}", 'bin/sourcekitten'
|
92
|
-
end
|
108
|
+
FileUtils.cp_r "#{sk_dir}/.build/release/sourcekitten", 'bin'
|
93
109
|
system 'install_name_tool', '-delete_rpath',
|
94
110
|
(Pathname(`xcrun -find swift`) + '../../lib/swift/macosx').to_s,
|
95
111
|
'bin/sourcekitten'
|
data/bin/sourcekitten
CHANGED
Binary file
|
data/jazzy.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_runtime_dependency 'mustache', '~> 0.99'
|
22
22
|
spec.add_runtime_dependency 'open4'
|
23
23
|
spec.add_runtime_dependency 'redcarpet', '~> 3.2'
|
24
|
-
spec.add_runtime_dependency 'rouge', '
|
24
|
+
spec.add_runtime_dependency 'rouge', ['>= 2.0.6', '< 4.0']
|
25
25
|
spec.add_runtime_dependency 'sass', '~> 3.4'
|
26
26
|
spec.add_runtime_dependency 'sqlite3', '~> 1.3'
|
27
27
|
spec.add_runtime_dependency 'xcinvoke', '~> 0.3.0'
|
data/lib/jazzy/config.rb
CHANGED
@@ -92,7 +92,7 @@ module Jazzy
|
|
92
92
|
|
93
93
|
# ──────── Build ────────
|
94
94
|
|
95
|
-
# rubocop:disable
|
95
|
+
# rubocop:disable Layout/AlignParameters
|
96
96
|
|
97
97
|
config_attr :output,
|
98
98
|
description: 'Folder to output the HTML docs to',
|
@@ -127,6 +127,15 @@ module Jazzy
|
|
127
127
|
description: 'The SDK for which your code should be built.',
|
128
128
|
default: 'macosx'
|
129
129
|
|
130
|
+
config_attr :hide_declarations,
|
131
|
+
command_line: '--hide-declarations [objc|swift] ',
|
132
|
+
description: 'Hide declarations in the specified language. Given that ' \
|
133
|
+
'generating Swift docs only generates Swift declarations, ' \
|
134
|
+
'this is only really useful to display just the Swift ' \
|
135
|
+
'declarations & names when generating docs for an ' \
|
136
|
+
'Objective-C framework.',
|
137
|
+
default: ''
|
138
|
+
|
130
139
|
config_attr :config_file,
|
131
140
|
command_line: '--config PATH',
|
132
141
|
description: ['Configuration file (.yaml or .json)',
|
@@ -328,7 +337,13 @@ module Jazzy
|
|
328
337
|
raise '--assets-directory is deprecated: use --theme instead.'
|
329
338
|
end
|
330
339
|
|
331
|
-
|
340
|
+
config_attr :undocumented_text,
|
341
|
+
command_line: '--undocumented-text UNDOCUMENTED_TEXT',
|
342
|
+
description: 'Default text for undocumented symbols. The default '\
|
343
|
+
'is "Undocumented", put "" if no text is required',
|
344
|
+
default: 'Undocumented'
|
345
|
+
|
346
|
+
# rubocop:enable Style/AlignParameter
|
332
347
|
|
333
348
|
def initialize
|
334
349
|
self.class.all_config_attrs.each do |attr|
|
data/lib/jazzy/doc.rb
CHANGED
@@ -27,12 +27,16 @@ module Jazzy
|
|
27
27
|
ENV['JAZZY_FAKE_VERSION'] || Jazzy::VERSION
|
28
28
|
end
|
29
29
|
|
30
|
+
def objc_first?
|
31
|
+
Config.instance.objc_mode && Config.instance.hide_declarations != 'objc'
|
32
|
+
end
|
33
|
+
|
30
34
|
def language
|
31
|
-
|
35
|
+
objc_first? ? 'Objective-C' : 'Swift'
|
32
36
|
end
|
33
37
|
|
34
38
|
def language_stub
|
35
|
-
|
39
|
+
objc_first? ? 'objc' : 'swift'
|
36
40
|
end
|
37
41
|
end
|
38
42
|
end
|
data/lib/jazzy/doc_builder.rb
CHANGED
@@ -338,8 +338,8 @@ module Jazzy
|
|
338
338
|
{
|
339
339
|
name: item.name,
|
340
340
|
abstract: abstract,
|
341
|
-
declaration: item.
|
342
|
-
other_language_declaration: item.
|
341
|
+
declaration: item.display_declaration,
|
342
|
+
other_language_declaration: item.display_other_language_declaration,
|
343
343
|
usr: item.usr,
|
344
344
|
dash_type: item.type.dash_type,
|
345
345
|
github_token_url: gh_token_url(item, source_module),
|
@@ -409,7 +409,7 @@ module Jazzy
|
|
409
409
|
doc[:name] = doc_model.name
|
410
410
|
doc[:kind] = doc_model.type.name
|
411
411
|
doc[:dash_type] = doc_model.type.dash_type
|
412
|
-
doc[:declaration] = doc_model.
|
412
|
+
doc[:declaration] = doc_model.display_declaration
|
413
413
|
doc[:overview] = overview
|
414
414
|
doc[:structure] = source_module.doc_structure
|
415
415
|
doc[:tasks] = render_tasks(source_module, doc_model.children)
|
data/lib/jazzy/gem_version.rb
CHANGED
data/lib/jazzy/highlighter.rb
CHANGED
@@ -3,8 +3,30 @@ require 'rouge'
|
|
3
3
|
module Jazzy
|
4
4
|
# This module helps highlight code
|
5
5
|
module Highlighter
|
6
|
-
|
7
|
-
|
6
|
+
class Formatter < Rouge::Formatters::HTML
|
7
|
+
def initialize(language)
|
8
|
+
@language = language
|
9
|
+
super()
|
10
|
+
end
|
11
|
+
|
12
|
+
def stream(tokens, &b)
|
13
|
+
yield "<pre class=\"highlight #{@language}\"><code>"
|
14
|
+
super
|
15
|
+
yield "</code></pre>\n"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# What Rouge calls the language
|
20
|
+
def self.default_language
|
21
|
+
if Config.instance.objc_mode
|
22
|
+
'objective_c'
|
23
|
+
else
|
24
|
+
'swift'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.highlight(source, language = default_language)
|
29
|
+
source && Rouge.highlight(source, language, Formatter.new(language))
|
8
30
|
end
|
9
31
|
end
|
10
32
|
end
|
data/lib/jazzy/jazzy_markdown.rb
CHANGED
@@ -8,6 +8,8 @@ module Jazzy
|
|
8
8
|
include Redcarpet::Render::SmartyPants
|
9
9
|
include Rouge::Plugins::Redcarpet
|
10
10
|
|
11
|
+
attr_accessor :default_language
|
12
|
+
|
11
13
|
def header(text, header_level)
|
12
14
|
text_slug = text.gsub(/[^\w]+/, '-')
|
13
15
|
.downcase
|
@@ -96,6 +98,14 @@ module Jazzy
|
|
96
98
|
str << text
|
97
99
|
str << (list_type == :ordered ? "</ol>\n" : "</ul>\n")
|
98
100
|
end
|
101
|
+
|
102
|
+
def block_code(code, language)
|
103
|
+
super(code, language || default_language)
|
104
|
+
end
|
105
|
+
|
106
|
+
def rouge_formatter(lexer)
|
107
|
+
Highlighter::Formatter.new(lexer.tag)
|
108
|
+
end
|
99
109
|
end
|
100
110
|
|
101
111
|
REDCARPET_OPTIONS = {
|
@@ -161,8 +171,9 @@ module Jazzy
|
|
161
171
|
@markdown ||= Redcarpet::Markdown.new(renderer, REDCARPET_OPTIONS)
|
162
172
|
end
|
163
173
|
|
164
|
-
def self.render(markdown_text)
|
174
|
+
def self.render(markdown_text, default_language = nil)
|
165
175
|
renderer.reset
|
176
|
+
renderer.default_language = default_language
|
166
177
|
markdown.render(markdown_text)
|
167
178
|
end
|
168
179
|
|
@@ -56,12 +56,26 @@ module Jazzy
|
|
56
56
|
name.split(/[\(\)]/) if type.objc_category?
|
57
57
|
end
|
58
58
|
|
59
|
+
def display_declaration
|
60
|
+
if Config.instance.hide_declarations == 'objc'
|
61
|
+
other_language_declaration
|
62
|
+
else
|
63
|
+
declaration
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def display_other_language_declaration
|
68
|
+
other_language_declaration unless
|
69
|
+
%w[swift objc].include? Config.instance.hide_declarations
|
70
|
+
end
|
71
|
+
|
59
72
|
attr_accessor :file
|
60
73
|
attr_accessor :line
|
61
74
|
attr_accessor :column
|
62
75
|
attr_accessor :usr
|
63
76
|
attr_accessor :modulename
|
64
77
|
attr_accessor :name
|
78
|
+
attr_accessor :objc_name
|
65
79
|
attr_accessor :declaration
|
66
80
|
attr_accessor :other_language_declaration
|
67
81
|
attr_accessor :abstract
|
@@ -73,7 +73,7 @@ module Jazzy
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def should_document?
|
76
|
-
declaration? && !param?
|
76
|
+
declaration? && !param? && !generic_type_param?
|
77
77
|
end
|
78
78
|
|
79
79
|
def declaration?
|
@@ -104,6 +104,10 @@ module Jazzy
|
|
104
104
|
kind == 'source.lang.swift.decl.var.local'
|
105
105
|
end
|
106
106
|
|
107
|
+
def generic_type_param?
|
108
|
+
kind == 'source.lang.swift.decl.generic_type_param'
|
109
|
+
end
|
110
|
+
|
107
111
|
def objc_unexposed?
|
108
112
|
kind == 'sourcekitten.source.lang.objc.decl.unexposed'
|
109
113
|
end
|
data/lib/jazzy/sourcekitten.rb
CHANGED
@@ -48,7 +48,11 @@ end
|
|
48
48
|
module Jazzy
|
49
49
|
# This module interacts with the sourcekitten command-line executable
|
50
50
|
module SourceKitten
|
51
|
-
|
51
|
+
def self.undocumented_abstract
|
52
|
+
@undocumented_abstract ||= Markdown.render(
|
53
|
+
Config.instance.undocumented_text,
|
54
|
+
).freeze
|
55
|
+
end
|
52
56
|
|
53
57
|
# Group root-level docs by custom categories (if any) and type
|
54
58
|
def self.group_docs(docs)
|
@@ -268,10 +272,9 @@ module Jazzy
|
|
268
272
|
# rubocop:enable Metrics/CyclomaticComplexity
|
269
273
|
# rubocop:enable Metrics/PerceivedComplexity
|
270
274
|
|
271
|
-
def self.should_mark_undocumented(
|
275
|
+
def self.should_mark_undocumented(filepath)
|
272
276
|
source_directory = Config.instance.source_directory.to_s
|
273
|
-
(filepath || '').start_with?(source_directory)
|
274
|
-
kind != 'source.lang.swift.decl.generic_type_param'
|
277
|
+
(filepath || '').start_with?(source_directory)
|
275
278
|
end
|
276
279
|
|
277
280
|
def self.process_undocumented_token(doc, declaration)
|
@@ -279,13 +282,13 @@ module Jazzy
|
|
279
282
|
|
280
283
|
filepath = doc['key.filepath']
|
281
284
|
objc = Config.instance.objc_mode
|
282
|
-
if objc || should_mark_undocumented(
|
285
|
+
if objc || should_mark_undocumented(filepath)
|
283
286
|
@stats.add_undocumented(declaration)
|
284
287
|
return nil if @skip_undocumented
|
285
|
-
declaration.abstract =
|
288
|
+
declaration.abstract = undocumented_abstract
|
286
289
|
else
|
287
|
-
|
288
|
-
|
290
|
+
declaration.abstract = Markdown.render(doc['key.doc.comment'] || '',
|
291
|
+
Highlighter.default_language)
|
289
292
|
end
|
290
293
|
|
291
294
|
declaration
|
@@ -302,13 +305,11 @@ module Jazzy
|
|
302
305
|
end
|
303
306
|
|
304
307
|
# rubocop:disable Metrics/CyclomaticComplexity
|
305
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
306
308
|
def self.make_doc_info(doc, declaration)
|
307
309
|
return unless should_document?(doc)
|
308
310
|
|
309
311
|
declaration.declaration = Highlighter.highlight(
|
310
312
|
doc['key.parsed_declaration'] || doc['key.doc.declaration'],
|
311
|
-
Config.instance.objc_mode ? 'objc' : 'swift',
|
312
313
|
)
|
313
314
|
if Config.instance.objc_mode && doc['key.swift_declaration']
|
314
315
|
declaration.other_language_declaration = Highlighter.highlight(
|
@@ -320,7 +321,8 @@ module Jazzy
|
|
320
321
|
return process_undocumented_token(doc, declaration)
|
321
322
|
end
|
322
323
|
|
323
|
-
declaration.abstract = Markdown.render(doc['key.doc.comment'] || ''
|
324
|
+
declaration.abstract = Markdown.render(doc['key.doc.comment'] || '',
|
325
|
+
Highlighter.default_language)
|
324
326
|
declaration.discussion = ''
|
325
327
|
declaration.return = Markdown.rendered_returns
|
326
328
|
declaration.parameters = parameters(doc, Markdown.rendered_parameters)
|
@@ -328,7 +330,6 @@ module Jazzy
|
|
328
330
|
@stats.add_documented
|
329
331
|
end
|
330
332
|
# rubocop:enable Metrics/CyclomaticComplexity
|
331
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
332
333
|
|
333
334
|
def self.make_substructure(doc, declaration)
|
334
335
|
declaration.children = if doc['key.substructure']
|
@@ -358,7 +359,14 @@ module Jazzy
|
|
358
359
|
declaration.parent_in_code = parent
|
359
360
|
declaration.type = SourceDeclaration::Type.new(doc['key.kind'])
|
360
361
|
declaration.typename = doc['key.typename']
|
361
|
-
|
362
|
+
declaration.objc_name = doc['key.name']
|
363
|
+
documented_name = if Config.instance.hide_declarations == 'objc' &&
|
364
|
+
doc['key.swift_name']
|
365
|
+
doc['key.swift_name']
|
366
|
+
else
|
367
|
+
declaration.objc_name
|
368
|
+
end
|
369
|
+
current_mark = SourceMark.new(documented_name) if declaration.type.mark?
|
362
370
|
if declaration.type.swift_enum_case?
|
363
371
|
# Enum "cases" are thin wrappers around enum "elements".
|
364
372
|
declarations += make_source_declarations(
|
@@ -377,7 +385,7 @@ module Jazzy
|
|
377
385
|
declaration.file = Pathname(doc['key.filepath']) if doc['key.filepath']
|
378
386
|
declaration.usr = doc['key.usr']
|
379
387
|
declaration.modulename = doc['key.modulename']
|
380
|
-
declaration.name =
|
388
|
+
declaration.name = documented_name
|
381
389
|
declaration.mark = current_mark
|
382
390
|
declaration.access_control_level =
|
383
391
|
SourceDeclaration::AccessControlLevel.from_doc(doc)
|
@@ -639,7 +647,7 @@ module Jazzy
|
|
639
647
|
def self.reject_objc_types(docs)
|
640
648
|
enums = docs.map do |doc|
|
641
649
|
[doc, doc.children]
|
642
|
-
end.flatten.select { |child| child.type.objc_enum? }.map(&:
|
650
|
+
end.flatten.select { |child| child.type.objc_enum? }.map(&:objc_name)
|
643
651
|
docs.map do |doc|
|
644
652
|
doc.children = doc.children.reject do |child|
|
645
653
|
child.type.objc_typedef? && enums.include?(child.name)
|
data/spec/integration_spec.rb
CHANGED
@@ -49,13 +49,16 @@ require 'colored'
|
|
49
49
|
require 'CLIntegracon'
|
50
50
|
|
51
51
|
require 'cocoapods'
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
52
|
+
|
53
|
+
def configure_cocoapods
|
54
|
+
Pod::Config.instance.with_changes(silent: true) do
|
55
|
+
config = Pod::Config.instance
|
56
|
+
# working around a bug where `pod setup --silent` isn't silent
|
57
|
+
if config.sources_manager.master_repo_functional?
|
58
|
+
Pod::Command::Repo::Update.invoke(%w[master])
|
59
|
+
else
|
60
|
+
Pod::Command::Setup.invoke
|
61
|
+
end
|
59
62
|
end
|
60
63
|
end
|
61
64
|
|
@@ -130,6 +133,10 @@ describe_cli 'jazzy' do
|
|
130
133
|
</script>
|
131
134
|
HTML
|
132
135
|
|
136
|
+
spec_subset = ENV['JAZZY_SPEC_SUBSET']
|
137
|
+
|
138
|
+
# rubocop:disable Style/MultilineIfModifier
|
139
|
+
|
133
140
|
describe 'jazzy objective-c' do
|
134
141
|
describe 'Creates Realm Objective-C docs' do
|
135
142
|
realm_version = ''
|
@@ -160,14 +167,9 @@ describe_cli 'jazzy' do
|
|
160
167
|
behaves_like cli_spec 'misc_jazzy_objc_features',
|
161
168
|
'--theme fullwidth'
|
162
169
|
end
|
163
|
-
end
|
170
|
+
end if !spec_subset || spec_subset == 'objc'
|
164
171
|
|
165
172
|
describe 'jazzy swift' do
|
166
|
-
describe 'Creates docs for a podspec with dependencies and subspecs' do
|
167
|
-
behaves_like cli_spec 'document_moya_podspec',
|
168
|
-
'--podspec=Moya.podspec'
|
169
|
-
end
|
170
|
-
|
171
173
|
describe 'Creates docs with a module name, author name, project URL, ' \
|
172
174
|
'xcodebuild options, and github info' do
|
173
175
|
behaves_like cli_spec 'document_alamofire',
|
@@ -208,12 +210,20 @@ describe_cli 'jazzy' do
|
|
208
210
|
behaves_like cli_spec 'document_siesta',
|
209
211
|
# Siesta already has Docs/
|
210
212
|
'--output api-docs',
|
211
|
-
# Use Swift 4 rather than the specified 3.0.2
|
212
|
-
'--swift-version=4'
|
213
|
+
# Use Swift 4.0.2 rather than the specified 3.0.2
|
214
|
+
'--swift-version=4.0.3'
|
213
215
|
end
|
214
216
|
|
215
217
|
describe 'Creates docs for Swift project with a variety of contents' do
|
216
218
|
behaves_like cli_spec 'misc_jazzy_features'
|
217
219
|
end
|
218
|
-
end
|
220
|
+
end if !spec_subset || spec_subset == 'swift'
|
221
|
+
|
222
|
+
describe 'jazzy cocoapods' do
|
223
|
+
configure_cocoapods
|
224
|
+
describe 'Creates docs for a podspec with dependencies and subspecs' do
|
225
|
+
behaves_like cli_spec 'document_moya_podspec',
|
226
|
+
'--podspec=Moya.podspec'
|
227
|
+
end
|
228
|
+
end if !spec_subset || spec_subset == 'cocoapods'
|
219
229
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jazzy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Simard
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2018-01-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: cocoapods
|
@@ -72,16 +72,22 @@ dependencies:
|
|
72
72
|
name: rouge
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
|
-
- - "
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.0.6
|
78
|
+
- - "<"
|
76
79
|
- !ruby/object:Gem::Version
|
77
|
-
version: '
|
80
|
+
version: '4.0'
|
78
81
|
type: :runtime
|
79
82
|
prerelease: false
|
80
83
|
version_requirements: !ruby/object:Gem::Requirement
|
81
84
|
requirements:
|
82
|
-
- - "
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 2.0.6
|
88
|
+
- - "<"
|
83
89
|
- !ruby/object:Gem::Version
|
84
|
-
version: '
|
90
|
+
version: '4.0'
|
85
91
|
- !ruby/object:Gem::Dependency
|
86
92
|
name: sass
|
87
93
|
requirement: !ruby/object:Gem::Requirement
|
@@ -161,6 +167,7 @@ executables:
|
|
161
167
|
extensions: []
|
162
168
|
extra_rdoc_files: []
|
163
169
|
files:
|
170
|
+
- ".circleci/config.yml"
|
164
171
|
- ".gitignore"
|
165
172
|
- ".gitmodules"
|
166
173
|
- ".rubocop.yml"
|
@@ -173,9 +180,7 @@ files:
|
|
173
180
|
- README.md
|
174
181
|
- Rakefile
|
175
182
|
- bin/jazzy
|
176
|
-
- bin/libCYaml.dylib
|
177
183
|
- bin/sourcekitten
|
178
|
-
- circle.yml
|
179
184
|
- images/logo.jpg
|
180
185
|
- images/logo.sketch
|
181
186
|
- images/realm.png
|
@@ -259,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
259
264
|
version: '0'
|
260
265
|
requirements: []
|
261
266
|
rubyforge_project:
|
262
|
-
rubygems_version: 2.6.
|
267
|
+
rubygems_version: 2.6.8
|
263
268
|
signing_key:
|
264
269
|
specification_version: 4
|
265
270
|
summary: Soulful docs for Swift & Objective-C.
|
data/bin/libCYaml.dylib
DELETED
Binary file
|