jazzy 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b7c32e3e4852444ab51ebfb2769dfd60a798e51
4
- data.tar.gz: 79448b6ccf52510142b1612f279eb5bc46619b1d
3
+ metadata.gz: 9b6c8d617080bf1a2a5d1930f3c63c630da8869e
4
+ data.tar.gz: 558a557588f533343725d3efc06cf7c00d25e241
5
5
  SHA512:
6
- metadata.gz: 4bf01a81ca089fa588c0f2a9630fc61384b17199d634930b0764e6b22d6b45135bb288661e9ae89e914a24c66e4fa9db11058f3b74993b3e436b9525b86f2800
7
- data.tar.gz: 35fa4a004b97fce136135b53eeb13dc35cf6ebb40c27e12c6077badfc898bfe57526d65ea389299888ba040f0c2bc82031ab62fd3790bdcf85fec2e8909053c7
6
+ metadata.gz: 22f290f2559756550a4122c9338528d6d0b9a21a66f5d4f2906e1f35d0c8f7f20d3ecc2285a88a900619d5d17170fb70548ed971de1bde3d08045b5ab026392d
7
+ data.tar.gz: 87ac65fd0994caf9229c76d6c68e837b0fa167863d213a33834be1c16f6d8212703fcce5ca2d8219a9573407432447aaf9597beead518877b67235c6b5a3d1ad
data/.rubocop.yml CHANGED
@@ -31,6 +31,9 @@ Metrics/BlockLength:
31
31
  Style/NumericPredicate:
32
32
  Enabled: false
33
33
 
34
+ Style/IndentHeredoc:
35
+ Enabled: false
36
+
34
37
  # We adopted raise instead of fail.
35
38
  SignalException:
36
39
  EnforcedStyle: only_raise
data/CHANGELOG.md CHANGED
@@ -1,3 +1,42 @@
1
+ ## 0.8.3
2
+
3
+ ##### Breaking
4
+
5
+ * None.
6
+
7
+ ##### Enhancements
8
+
9
+ * Generate Swift declaration for more Objective-C declarations.
10
+ [Zheng Li](https://github.com/ainopara)
11
+
12
+ * Improve quality & accuracy of Swift interfaces for Objective-C declarations
13
+ when generating Objective-C docs.
14
+ [Norio Nomura](https://github.com/norio-nomura)
15
+
16
+ * Process Swift 3.2/4 doc comments.
17
+ [John Fairhurst](https://github.com/johnfairh)
18
+
19
+ ##### Bug Fixes
20
+
21
+ * Fix missing doc comments on some extensions.
22
+ [John Fairhurst](https://github.com/johnfairh)
23
+ [#454](https://github.com/realm/jazzy/issues/454)
24
+
25
+ * Fix failure when attempting to download documentation coverage badge with
26
+ jazzy using macOS system Ruby, or a Ruby built with outdated versions of
27
+ OpenSSL.
28
+ [JP Simard](https://github.com/jpsim)
29
+ [#824](https://github.com/realm/jazzy/issues/824)
30
+
31
+ * Stop `--skip-undocumented` from skipping documented items nested
32
+ inside extensions of types from other modules.
33
+ [John Fairhurst](https://github.com/johnfairh)
34
+ [#502](https://github.com/realm/jazzy/issues/502)
35
+
36
+ * Fix members added to extensions of a nested type showing up in the parent.
37
+ [John Fairhurst](https://github.com/johnfairh)
38
+ [#333](https://github.com/realm/jazzy/issues/333)
39
+
1
40
  ## 0.8.2
2
41
 
3
42
  ##### Breaking
data/Gemfile CHANGED
@@ -15,7 +15,7 @@ group :development do
15
15
 
16
16
  # Integration tests
17
17
  gem 'diffy'
18
- gem 'clintegracon'
18
+ gem 'clintegracon', '0.7.0'
19
19
 
20
20
  # Code Review
21
21
  gem 'danger'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jazzy (0.8.2)
4
+ jazzy (0.8.3)
5
5
  cocoapods (~> 1.0)
6
6
  mustache (~> 0.99)
7
7
  open4
@@ -20,7 +20,7 @@ GEM
20
20
  minitest (~> 5.1)
21
21
  thread_safe (~> 0.3, >= 0.3.4)
22
22
  tzinfo (~> 1.1)
23
- addressable (2.5.0)
23
+ addressable (2.5.1)
24
24
  public_suffix (~> 2.0, >= 2.0.2)
25
25
  ast (2.3.0)
26
26
  bacon (1.2.0)
@@ -67,14 +67,14 @@ GEM
67
67
  cocoapods-try (1.1.0)
68
68
  colored (1.2)
69
69
  colored2 (3.1.2)
70
- cork (0.2.0)
71
- colored (~> 1.2)
70
+ cork (0.3.0)
71
+ colored2 (~> 3.1)
72
72
  crack (0.4.3)
73
73
  safe_yaml (~> 1.0.0)
74
- danger (4.0.1)
74
+ danger (5.2.2)
75
75
  claide (~> 1.0)
76
76
  claide-plugins (>= 0.9.2)
77
- colored (~> 1.2)
77
+ colored2 (~> 3.1)
78
78
  cork (~> 0.1)
79
79
  faraday (~> 0.9)
80
80
  faraday-http-cache (~> 1.0)
@@ -82,9 +82,9 @@ GEM
82
82
  kramdown (~> 1.5)
83
83
  octokit (~> 4.2)
84
84
  terminal-table (~> 1)
85
- diffy (3.1.0)
85
+ diffy (3.2.0)
86
86
  escape (0.0.4)
87
- faraday (0.10.0)
87
+ faraday (0.12.1)
88
88
  multipart-post (>= 1.2, < 3)
89
89
  faraday-http-cache (1.3.1)
90
90
  faraday (~> 0.8)
@@ -92,15 +92,15 @@ GEM
92
92
  fuzzy_match (2.0.4)
93
93
  gh_inspector (1.0.3)
94
94
  git (1.3.0)
95
- hashdiff (0.3.0)
95
+ hashdiff (0.3.4)
96
96
  i18n (0.8.1)
97
- kramdown (1.13.1)
97
+ kramdown (1.13.2)
98
98
  liferaft (0.0.6)
99
99
  metaclass (0.0.4)
100
- minitest (5.10.1)
101
- mocha (1.1.0)
100
+ minitest (5.10.2)
101
+ mocha (1.2.1)
102
102
  metaclass (~> 0.0.1)
103
- mocha-on-bacon (0.2.2)
103
+ mocha-on-bacon (0.2.3)
104
104
  mocha (>= 0.13.0)
105
105
  molinillo (0.5.7)
106
106
  multipart-post (2.0.0)
@@ -108,20 +108,21 @@ GEM
108
108
  nanaimo (0.2.3)
109
109
  nap (1.1.0)
110
110
  netrc (0.7.8)
111
- octokit (4.6.2)
111
+ octokit (4.7.0)
112
112
  sawyer (~> 0.8.0, >= 0.5.3)
113
113
  open4 (1.3.4)
114
- parser (2.3.3.1)
114
+ parser (2.4.0.0)
115
115
  ast (~> 2.2)
116
116
  powerpack (0.1.1)
117
117
  prettybacon (0.0.2)
118
118
  bacon (~> 1.2)
119
- public_suffix (2.0.4)
120
- rainbow (2.2.1)
119
+ public_suffix (2.0.5)
120
+ rainbow (2.2.2)
121
+ rake
121
122
  rake (10.5.0)
122
123
  redcarpet (3.4.0)
123
124
  rouge (1.11.1)
124
- rubocop (0.47.1)
125
+ rubocop (0.48.1)
125
126
  parser (>= 2.3.3.1, < 3.0)
126
127
  powerpack (~> 0.1)
127
128
  rainbow (>= 1.99.1, < 3.0)
@@ -130,17 +131,18 @@ GEM
130
131
  ruby-macho (1.1.0)
131
132
  ruby-progressbar (1.8.1)
132
133
  safe_yaml (1.0.4)
133
- sass (3.4.23)
134
+ sass (3.4.24)
134
135
  sawyer (0.8.1)
135
136
  addressable (>= 2.3.5, < 2.6)
136
137
  faraday (~> 0.8, < 1.0)
137
138
  sqlite3 (1.3.13)
138
- terminal-table (1.6.0)
139
+ terminal-table (1.8.0)
140
+ unicode-display_width (~> 1.1, >= 1.1.1)
139
141
  thread_safe (0.3.6)
140
142
  tzinfo (1.2.3)
141
143
  thread_safe (~> 0.1)
142
- unicode-display_width (1.1.3)
143
- webmock (1.24.2)
144
+ unicode-display_width (1.2.1)
145
+ webmock (3.0.1)
144
146
  addressable (>= 2.3.6)
145
147
  crack (>= 0.3.2)
146
148
  hashdiff
@@ -158,7 +160,7 @@ PLATFORMS
158
160
  DEPENDENCIES
159
161
  bacon
160
162
  bundler (~> 1.7)
161
- clintegracon
163
+ clintegracon (= 0.7.0)
162
164
  danger
163
165
  diffy
164
166
  jazzy!
data/README.md CHANGED
@@ -86,7 +86,7 @@ parameters to jazzy:
86
86
 
87
87
  * `--objc`
88
88
  * `--umbrella-header ...`
89
- * `-framework-root ...`
89
+ * `--framework-root ...`
90
90
  * `--sdk [iphone|watch|appletv][os|simulator]|macosx` (optional, default value
91
91
  of `macosx`)
92
92
 
data/Rakefile CHANGED
@@ -71,8 +71,10 @@ begin
71
71
 
72
72
  #-- RuboCop ----------------------------------------------------------------#
73
73
 
74
- require 'rubocop/rake_task'
75
- RuboCop::RakeTask.new(:rubocop)
74
+ desc 'Runs RuboCop linter on Ruby files'
75
+ task :rubocop do
76
+ sh 'bundle exec rubocop lib spec'
77
+ end
76
78
 
77
79
  #-- SourceKitten -----------------------------------------------------------#
78
80
 
data/bin/sourcekitten CHANGED
Binary file
data/lib/jazzy/config.rb CHANGED
@@ -402,7 +402,7 @@ module Jazzy
402
402
  puts "Using config file #{config_path}"
403
403
  config_file = read_config_file(config_path)
404
404
 
405
- attrs_by_conf_key, attrs_by_name = %i(config_file_key name).map do |prop|
405
+ attrs_by_conf_key, attrs_by_name = %i[config_file_key name].map do |prop|
406
406
  self.class.all_config_attrs.group_by(&prop)
407
407
  end
408
408
 
@@ -39,7 +39,7 @@ module Jazzy
39
39
  # FIXME: include arbitrarily nested extensible types
40
40
  [{ name: child.name, url: child.url }] +
41
41
  Array(child.children.select do |sub_child|
42
- sub_child.type.swift_extensible?
42
+ sub_child.type.swift_extensible? || sub_child.type.extension?
43
43
  end).map do |sub_child|
44
44
  { name: "– #{sub_child.name}", url: sub_child.url }
45
45
  end
@@ -259,14 +259,15 @@ module Jazzy
259
259
  return if options.hide_documentation_coverage || !options.download_badge
260
260
 
261
261
  warn 'downloading coverage badge'
262
- color = color_for_coverage(coverage)
263
- uri = URI.parse('https://img.shields.io')
264
- url_path = "/badge/documentation-#{coverage}%25-#{color}.svg"
265
- Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
266
- resp = http.get url_path
267
- File.open(options.output + 'badge.svg', 'wb') do |file|
268
- file.write resp.body
269
- end
262
+ badge_url = 'https://img.shields.io/badge/documentation-' \
263
+ "#{coverage}%25-#{color_for_coverage(coverage)}.svg"
264
+ badge_output = options.output + 'badge.svg'
265
+ system('curl', '-s', badge_url, '-o', badge_output.to_s)
266
+ unless $?.success?
267
+ warn 'Downloading documentation coverage badge failed.'
268
+ warn 'Please try again when connected to the Internet, or skip the ' \
269
+ 'download by passing the `--no-download-badge` command flag.'
270
+ exit $?.exitstatus || 1
270
271
  end
271
272
  end
272
273
 
@@ -1,3 +1,3 @@
1
1
  module Jazzy
2
- VERSION = '0.8.2'.freeze unless defined? Jazzy::VERSION
2
+ VERSION = '0.8.3'.freeze unless defined? Jazzy::VERSION
3
3
  end
@@ -21,10 +21,10 @@ module Jazzy
21
21
 
22
22
  # List from
23
23
  # https://github.com/apple/swift/blob/master/include/swift/Markup/SimpleFields.def
24
- UNIQUELY_HANDLED_CALLOUTS = %w(parameters
24
+ UNIQUELY_HANDLED_CALLOUTS = %w[parameters
25
25
  parameter
26
- returns).freeze
27
- GENERAL_CALLOUTS = %w(attention
26
+ returns].freeze
27
+ GENERAL_CALLOUTS = %w[attention
28
28
  author
29
29
  authors
30
30
  bug
@@ -51,7 +51,7 @@ module Jazzy
51
51
  todo
52
52
  throws
53
53
  version
54
- warning).freeze
54
+ warning].freeze
55
55
  SPECIAL_LIST_TYPES = (UNIQUELY_HANDLED_CALLOUTS + GENERAL_CALLOUTS).freeze
56
56
 
57
57
  SPECIAL_LIST_TYPE_REGEX = %r{
@@ -24,7 +24,7 @@ module Jazzy
24
24
  .map(&:label)
25
25
 
26
26
  targets.map do |t|
27
- args = %W(doc --module-name #{podspec.module_name} -- -target #{t})
27
+ args = %W[doc --module-name #{podspec.module_name} -- -target #{t}]
28
28
  swift_version = (config.swift_version || '3')[0] + '.0'
29
29
  args << "SWIFT_VERSION=\"#{swift_version}\""
30
30
  SourceKitten.run_sourcekitten(args)
@@ -18,7 +18,7 @@ module Jazzy
18
18
 
19
19
  def self.readme_path
20
20
  return config.readme_path if config.readme_path
21
- %w(README.md README.markdown README.mdown README).each do |potential_name|
21
+ %w[README.md README.markdown README.mdown README].each do |potential_name|
22
22
  file = config.source_directory + potential_name
23
23
  return file if file.exist?
24
24
  end
@@ -38,7 +38,7 @@ module Jazzy
38
38
  end
39
39
 
40
40
  def fallback_readme
41
- %w(README.md README.markdown README.mdown README).each do |potential_name|
41
+ %w[README.md README.markdown README.mdown README].each do |potential_name|
42
42
  file = config.source_directory + potential_name
43
43
  return file.read if file.exist?
44
44
  end
@@ -37,7 +37,7 @@ module Jazzy
37
37
  d.map(&:children).each { |c| visitor[c] }
38
38
  end
39
39
  visitor[docs]
40
- all_declarations.select { |doc| doc.name != 'index' }
40
+ all_declarations.reject { |doc| doc.name == 'index' }
41
41
  end
42
42
  end
43
43
  end
@@ -47,7 +47,7 @@ end
47
47
  module Jazzy
48
48
  # This module interacts with the sourcekitten command-line executable
49
49
  module SourceKitten
50
- @default_abstract = Markdown.render('Undocumented').freeze
50
+ @undocumented_abstract = Markdown.render('Undocumented').freeze
51
51
 
52
52
  # Group root-level docs by custom categories (if any) and type
53
53
  def self.group_docs(docs)
@@ -222,16 +222,11 @@ module Jazzy
222
222
  # @todo: Fix these
223
223
  declaration.line = nil
224
224
  declaration.column = nil
225
- declaration.abstract = @default_abstract
225
+ declaration.abstract = ''
226
226
  declaration.parameters = []
227
227
  declaration.children = []
228
228
  end
229
229
 
230
- def self.documented_child?(doc)
231
- return false unless doc['key.substructure']
232
- doc['key.substructure'].any? { |child| documented_child?(child) }
233
- end
234
-
235
230
  def self.availability_attribute?(doc)
236
231
  return false unless doc['key.attributes']
237
232
  !doc['key.attributes'].select do |attribute|
@@ -276,13 +271,20 @@ module Jazzy
276
271
  end
277
272
 
278
273
  def self.process_undocumented_token(doc, declaration)
274
+ make_default_doc_info(declaration)
275
+
279
276
  filepath = doc['key.filepath']
280
277
  objc = Config.instance.objc_mode
281
278
  if objc || should_mark_undocumented(doc['key.kind'], filepath)
282
279
  @stats.add_undocumented(declaration)
280
+ return nil if @skip_undocumented
281
+ declaration.abstract = @undocumented_abstract
282
+ else
283
+ comment = doc['key.doc.comment']
284
+ declaration.abstract = Markdown.render(comment) if comment
283
285
  end
284
- return nil if !documented_child?(doc) && @skip_undocumented
285
- make_default_doc_info(declaration)
286
+
287
+ declaration
286
288
  end
287
289
 
288
290
  def self.parameters(doc, discovered)
@@ -382,6 +384,7 @@ module Jazzy
382
384
 
383
385
  next unless make_doc_info(doc, declaration)
384
386
  make_substructure(doc, declaration)
387
+ next if declaration.type.extension? && declaration.children.empty?
385
388
  declarations << declaration
386
389
  end
387
390
  declarations
@@ -390,6 +393,36 @@ module Jazzy
390
393
  # rubocop:enable Metrics/CyclomaticComplexity
391
394
  # rubocop:enable Metrics/MethodLength
392
395
 
396
+ # Expands extensions of nested types declared at the top level into
397
+ # a tree so they can be deduplicated properly
398
+ def self.expand_extensions(decls)
399
+ decls.map do |decl|
400
+ next decl unless decl.type.extension? && decl.name.include?('.')
401
+
402
+ name_parts = decl.name.split('.')
403
+ decl.name = name_parts.pop
404
+ expand_extension(decl, name_parts, decls)
405
+ end
406
+ end
407
+
408
+ def self.expand_extension(extension, name_parts, decls)
409
+ return extension if name_parts.empty?
410
+ name = name_parts.shift
411
+ candidates = decls.select { |decl| decl.name == name }
412
+ SourceDeclaration.new.tap do |decl|
413
+ make_default_doc_info(decl)
414
+ decl.name = name
415
+ decl.type = extension.type
416
+ decl.mark = extension.mark
417
+ decl.usr = candidates.first.usr unless candidates.empty?
418
+ child = expand_extension(extension,
419
+ name_parts,
420
+ candidates.flat_map(&:children).uniq)
421
+ child.parent_in_code = decl
422
+ decl.children = [child]
423
+ end
424
+ end
425
+
393
426
  # Merges multiple extensions of the same entity into a single document.
394
427
  #
395
428
  # Merges extensions into the protocol/class/struct/enum they extend, if it
@@ -612,6 +645,7 @@ module Jazzy
612
645
  @stats = Stats.new
613
646
  sourcekitten_json = filter_excluded_files(JSON.parse(sourcekitten_output))
614
647
  docs = make_source_declarations(sourcekitten_json).concat inject_docs
648
+ docs = expand_extensions(docs)
615
649
  docs = deduplicate_declarations(docs)
616
650
  if Config.instance.objc_mode
617
651
  docs = reject_objc_types(docs)
@@ -53,7 +53,7 @@ Pod::Config.instance.with_changes(silent: true) do
53
53
  config = Pod::Config.instance
54
54
  # working around a bug where `pod setup --silent` isn't silent
55
55
  if config.sources_manager.master_repo_functional?
56
- Pod::Command::Repo::Update.invoke(%w(master))
56
+ Pod::Command::Repo::Update.invoke(%w[master])
57
57
  else
58
58
  Pod::Command::Setup.invoke
59
59
  end
@@ -104,6 +104,9 @@ describe_cli 'jazzy' do
104
104
  s.default_args = []
105
105
  s.replace_path ROOT.to_s, 'ROOT'
106
106
  s.replace_pattern /^[\d\s:.-]+ ruby\[\d+:\d+\] warning:.*$[\n]?/, ''
107
+ # Remove version numbers from CocoaPods dependencies
108
+ # to make specs resilient against dependecy updates.
109
+ s.replace_pattern /(Installing \w+ )\((.*)\)/, '\1(X.Y.Z)'
107
110
  end
108
111
 
109
112
  require 'shellwords'
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.8.2
4
+ version: 0.8.3
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: 2017-05-13 00:00:00.000000000 Z
13
+ date: 2017-07-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cocoapods