jazzy 0.0.16 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +4 -4
  3. data/bin/sourcekitten +0 -0
  4. data/lib/jazzy/config.rb +39 -9
  5. data/lib/jazzy/doc_builder.rb +9 -7
  6. data/lib/jazzy/docset_builder.rb +12 -3
  7. data/lib/jazzy/gem_version.rb +1 -1
  8. data/lib/jazzy/partials/task.mustache +1 -1
  9. data/lib/jazzy/source_declaration/access_control_level.rb +41 -0
  10. data/lib/jazzy/source_declaration.rb +2 -0
  11. data/lib/jazzy/source_module.rb +4 -1
  12. data/lib/jazzy/sourcekitten.rb +57 -25
  13. data/spec/integration_spec.rb +6 -2
  14. data/spec/integration_specs/document_alamofire/after/docs/Classes/Manager.html +25 -25
  15. data/spec/integration_specs/document_alamofire/after/docs/Classes/Request.html +38 -37
  16. data/spec/integration_specs/document_alamofire/after/docs/Classes.html +21 -20
  17. data/spec/integration_specs/document_alamofire/after/docs/Enums/ParameterEncoding.html +58 -21
  18. data/spec/integration_specs/document_alamofire/after/docs/Enums.html +22 -21
  19. data/spec/integration_specs/document_alamofire/after/docs/Extensions/Manager.html +21 -20
  20. data/spec/integration_specs/document_alamofire/after/docs/Extensions/Request.html +23 -22
  21. data/spec/integration_specs/document_alamofire/after/docs/Extensions.html +21 -20
  22. data/spec/integration_specs/document_alamofire/after/docs/Functions.html +22 -21
  23. data/spec/integration_specs/document_alamofire/after/docs/Global Variables.html +22 -21
  24. data/spec/integration_specs/document_alamofire/after/docs/Protocols/URLRequestConvertible.html +22 -21
  25. data/spec/integration_specs/document_alamofire/after/docs/Protocols/URLStringConvertible.html +22 -21
  26. data/spec/integration_specs/document_alamofire/after/docs/Protocols.html +21 -20
  27. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Info.plist +0 -0
  28. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/Classes/Manager.html +25 -25
  29. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/Classes/Request.html +38 -37
  30. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/Classes.html +21 -20
  31. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset/Contents/Resources/Documents → docsets/Alamofire.docset/Contents/Resources/Documents/Enums}/ParameterEncoding.html +58 -21
  32. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/Enums.html +22 -21
  33. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/Extensions/Manager.html +21 -20
  34. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset/Contents/Resources/Documents → docsets/Alamofire.docset/Contents/Resources/Documents/Extensions}/Request.html +23 -22
  35. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/Extensions.html +21 -20
  36. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/Functions.html +22 -21
  37. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/Global Variables.html +22 -21
  38. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/Manager.html +21 -20
  39. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset/Contents/Resources/Documents/Enums → docsets/Alamofire.docset/Contents/Resources/Documents}/ParameterEncoding.html +58 -21
  40. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset/Contents/Resources/Documents → docsets/Alamofire.docset/Contents/Resources/Documents/Protocols}/URLRequestConvertible.html +22 -21
  41. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/Protocols/URLStringConvertible.html +22 -21
  42. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/Protocols.html +21 -20
  43. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset/Contents/Resources/Documents/Extensions → docsets/Alamofire.docset/Contents/Resources/Documents}/Request.html +23 -22
  44. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset/Contents/Resources/Documents/Protocols → docsets/Alamofire.docset/Contents/Resources/Documents}/URLRequestConvertible.html +22 -21
  45. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/URLStringConvertible.html +22 -21
  46. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/carat.png +0 -0
  47. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/css/highlight.css +0 -0
  48. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/css/jazzy.css +0 -0
  49. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/dash.png +0 -0
  50. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/gh.png +0 -0
  51. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/highlight.css +0 -0
  52. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/img/carat.png +0 -0
  53. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/img/dash.png +0 -0
  54. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/img/gh.png +0 -0
  55. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/index.html +21 -20
  56. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/jazzy.css +0 -0
  57. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/jazzy.js +0 -0
  58. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/jquery.min.js +0 -0
  59. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/js/jazzy.js +0 -0
  60. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/Documents/js/jquery.min.js +0 -0
  61. data/spec/integration_specs/document_alamofire/after/docs/{Alamofire.docset → docsets/Alamofire.docset}/Contents/Resources/docSet.dsidx.csv +16 -17
  62. data/spec/integration_specs/document_alamofire/after/docs/docsets/Alamofire.xml +1 -0
  63. data/spec/integration_specs/document_alamofire/after/docs/index.html +21 -20
  64. data/spec/integration_specs/document_alamofire/after/execution_output.txt +1 -2
  65. data/spec/integration_specs/misc_jazzy_features/after/docs/Classes/ImplicitlyInternalTopLevelClass.html +5 -5
  66. data/spec/integration_specs/misc_jazzy_features/after/docs/Classes.html +7 -7
  67. data/spec/integration_specs/misc_jazzy_features/after/docs/Enums/DocumentedEnum.html +14 -5
  68. data/spec/integration_specs/misc_jazzy_features/after/docs/Enums.html +5 -5
  69. data/spec/integration_specs/misc_jazzy_features/after/docs/Global Variables.html +6 -6
  70. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Info.plist +0 -0
  71. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Resources/Documents/Classes/ImplicitlyInternalTopLevelClass.html +5 -5
  72. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Resources/Documents/Classes.html +7 -7
  73. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset/Contents/Resources/Documents/Enums → docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents}/DocumentedEnum.html +14 -5
  74. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset/Contents/Resources/Documents → docsets/MiscJazzyFeatures.docset/Contents/Resources/Documents/Enums}/DocumentedEnum.html +14 -5
  75. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Resources/Documents/Enums.html +5 -5
  76. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Resources/Documents/Global Variables.html +6 -6
  77. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Resources/Documents/ImplicitlyInternalTopLevelClass.html +5 -5
  78. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Resources/Documents/carat.png +0 -0
  79. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Resources/Documents/css/highlight.css +0 -0
  80. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Resources/Documents/css/jazzy.css +0 -0
  81. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Resources/Documents/dash.png +0 -0
  82. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Resources/Documents/gh.png +0 -0
  83. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Resources/Documents/highlight.css +0 -0
  84. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Resources/Documents/img/carat.png +0 -0
  85. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Resources/Documents/img/dash.png +0 -0
  86. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Resources/Documents/img/gh.png +0 -0
  87. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Resources/Documents/index.html +5 -5
  88. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Resources/Documents/jazzy.css +0 -0
  89. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Resources/Documents/jazzy.js +0 -0
  90. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Resources/Documents/jquery.min.js +0 -0
  91. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Resources/Documents/js/jazzy.js +0 -0
  92. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Resources/Documents/js/jquery.min.js +0 -0
  93. data/spec/integration_specs/misc_jazzy_features/after/docs/{MiscJazzyFeatures.docset → docsets/MiscJazzyFeatures.docset}/Contents/Resources/docSet.dsidx.csv +0 -0
  94. data/spec/integration_specs/misc_jazzy_features/after/docs/index.html +5 -5
  95. data/spec/integration_specs/misc_jazzy_features/after/execution_output.txt +1 -2
  96. metadata +65 -67
  97. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Classes/Manager/init(configuration:).html +0 -218
  98. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Manager/init(configuration:).html +0 -218
  99. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/init(configuration:).html +0 -218
  100. data/spec/integration_specs/document_alamofire/after/docs/Classes/Manager/init(configuration:).html +0 -218
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91c1b5381e39fcf3979fcdf3f441a9afa3c6346f
4
- data.tar.gz: 65736a28e4fc270646fdf7cd9be491953339634e
3
+ metadata.gz: 549602405c7fd774831d722881c5c8d89696945c
4
+ data.tar.gz: 02dd41a23da8915336f4e3251f9ba72f9579fe97
5
5
  SHA512:
6
- metadata.gz: cd122d28d2e16768fe6165f099998c8c1afadcf02798278d00300151762b7b43d4c17ac6f6cf56f553a0cc3cfaf0ae42211bb31d224626096c6b0b66879e03fc
7
- data.tar.gz: dd4a094146d32a3a7c61c571ededa504acdaf58df5fcfbc6546321d3291d73d6c997c039d78cb55258e64a35cad0ab5a195720a44ccaf15ba0cd1f576a53cd4d
6
+ metadata.gz: 58930f702701094f66113af5fe7447737c738ef23a2a57672329ea3c09e600aaacf6ec7e232acf31d3493ca19db72afc4fd9531fac706dd2b84722ddc52ebbf5
7
+ data.tar.gz: f39d276d4a19aa87de055a5772b8a77f1ceb2ff20da0dce3405b8d0c1a86620db96a7e5153073f4b6c3e8dc708325cadfdfe3338418a96e77ce1565fa096cdee
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jazzy (0.0.16)
4
+ jazzy (0.0.17)
5
5
  activesupport (~> 4.1)
6
6
  mustache (~> 0.99)
7
7
  nokogiri (~> 1.6)
@@ -35,12 +35,12 @@ GEM
35
35
  json (1.8.1)
36
36
  metaclass (0.0.4)
37
37
  mini_portile (0.6.1)
38
- minitest (5.4.3)
38
+ minitest (5.5.0)
39
39
  mocha (1.1.0)
40
40
  metaclass (~> 0.0.1)
41
41
  mocha-on-bacon (0.2.2)
42
42
  mocha (>= 0.13.0)
43
- mustache (0.99.7)
43
+ mustache (0.99.8)
44
44
  nokogiri (1.6.5)
45
45
  mini_portile (~> 0.6.0)
46
46
  parser (2.2.0.pre.5)
@@ -51,7 +51,7 @@ GEM
51
51
  bacon (~> 1.2)
52
52
  rainbow (2.0.0)
53
53
  rake (10.3.2)
54
- redcarpet (3.2.1)
54
+ redcarpet (3.2.2)
55
55
  rouge (1.7.4)
56
56
  rubocop (0.26.1)
57
57
  astrolabe (~> 1.3)
data/bin/sourcekitten CHANGED
Binary file
data/lib/jazzy/config.rb CHANGED
@@ -1,7 +1,11 @@
1
1
  require 'optparse'
2
2
  require 'pathname'
3
+ require 'uri'
4
+
5
+ require 'jazzy/source_declaration/access_control_level'
3
6
 
4
7
  module Jazzy
8
+ # rubocop:disable Metrics/ClassLength
5
9
  class Config
6
10
  attr_accessor :output
7
11
  attr_accessor :xcodebuild_arguments
@@ -15,19 +19,20 @@ module Jazzy
15
19
  attr_accessor :clean
16
20
  attr_accessor :readme_path
17
21
  attr_accessor :docset_platform
22
+ attr_accessor :root_url
23
+ attr_accessor :version
24
+ attr_accessor :min_acl
18
25
 
19
26
  def initialize
20
27
  self.output = Pathname('docs')
21
28
  self.xcodebuild_arguments = []
22
29
  self.author_name = ''
23
30
  self.module_name = ''
24
- self.github_url = nil
25
- self.github_file_prefix = nil
26
- self.author_url = ''
27
- self.dash_url = nil
28
- self.sourcekitten_sourcefile = nil
31
+ self.author_url = URI('')
29
32
  self.clean = false
30
33
  self.docset_platform = 'jazzy'
34
+ self.version = '1.0'
35
+ self.min_acl = SourceDeclaration::AccessControlLevel.internal
31
36
  end
32
37
 
33
38
  # rubocop:disable Metrics/MethodLength
@@ -62,7 +67,7 @@ module Jazzy
62
67
 
63
68
  opt.on('-u', '--author_url URL',
64
69
  'Author URL of this project (i.e. http://realm.io)') do |u|
65
- config.author_url = u
70
+ config.author_url = URI(u)
66
71
  end
67
72
 
68
73
  opt.on('-m', '--module MODULE_NAME',
@@ -71,14 +76,15 @@ module Jazzy
71
76
  end
72
77
 
73
78
  opt.on('-d', '--dash_url URL',
74
- 'URL to install docs in Dash (i.e. dash-feed://...') do |d|
75
- config.dash_url = d
79
+ 'Location of the dash XML feed \
80
+ (i.e. http://realm.io/docsets/realm.xml') do |d|
81
+ config.dash_url = URI(d)
76
82
  end
77
83
 
78
84
  opt.on('-g', '--github_url URL',
79
85
  'GitHub URL of this project (i.e. \
80
86
  https://github.com/realm/realm-cocoa)') do |g|
81
- config.github_url = g
87
+ config.github_url = URI(g)
82
88
  end
83
89
 
84
90
  opt.on('--github-file-prefix PREFIX',
@@ -92,6 +98,29 @@ module Jazzy
92
98
  config.sourcekitten_sourcefile = Pathname(s)
93
99
  end
94
100
 
101
+ opt.on('-r', '--root-url URL',
102
+ 'Absolute URL root where these docs will be stored') do |r|
103
+ config.root_url = URI(r)
104
+ if !config.dash_url && config.root_url
105
+ config.dash_url = URI.join(r, "docsets/#{config.module_name}.xml")
106
+ end
107
+ end
108
+
109
+ opt.on('--module-version VERSION',
110
+ 'module version. will be used when generating docset') do |mv|
111
+ config.version = mv
112
+ end
113
+
114
+ opt.on('--min-acl [private | internal | public]',
115
+ 'minimum access control level to document \
116
+ (default is internal)') do |acl|
117
+ if acl == 'private'
118
+ config.min_acl = SourceDeclaration::AccessControlLevel.private
119
+ elsif acl == 'public'
120
+ config.min_acl = SourceDeclaration::AccessControlLevel.public
121
+ end
122
+ end
123
+
95
124
  opt.on('-v', '--version', 'Print version number') do
96
125
  puts 'jazzy version: ' + Jazzy::VERSION
97
126
  exit
@@ -136,4 +165,5 @@ module Jazzy
136
165
  end
137
166
  end
138
167
  end
168
+ # rubocop:enable Metrics/ClassLength
139
169
  end
@@ -31,7 +31,7 @@ module Jazzy
31
31
  docs.each do |doc|
32
32
  structure << {
33
33
  section: doc.name,
34
- children: doc.children.map do |child|
34
+ children: doc.children.sort_by(&:name).map do |child|
35
35
  { name: child.name, url: child.url }
36
36
  end,
37
37
  }
@@ -97,7 +97,10 @@ module Jazzy
97
97
  output_dir = options.output
98
98
  prepare_output_dir(output_dir, options.clean)
99
99
 
100
- (docs, coverage) = SourceKitten.parse(sourcekitten_output)
100
+ (docs, coverage) = SourceKitten.parse(
101
+ sourcekitten_output,
102
+ options.min_acl,
103
+ )
101
104
 
102
105
  structure = doc_structure_for_docs(docs)
103
106
 
@@ -141,8 +144,8 @@ module Jazzy
141
144
  doc[:structure] = source_module.doc_structure
142
145
  doc[:module_name] = source_module.name
143
146
  doc[:author_name] = source_module.author_name
144
- doc[:author_website] = source_module.author_url
145
- doc[:github_url] = source_module.github_url
147
+ doc[:author_website] = source_module.author_url.to_s
148
+ doc[:github_url] = source_module.github_url.to_s
146
149
  doc[:dash_url] = source_module.dash_url
147
150
  doc[:path_to_root] = path_to_root
148
151
  doc.render
@@ -218,7 +221,6 @@ module Jazzy
218
221
  # @param [Array] doc_structure doc structure comprised of section names and
219
222
  # child names and URLs. @see doc_structure_for_docs
220
223
  def self.document(source_module, doc_model, path_to_root)
221
- # @todo render README here
222
224
  if doc_model.name == 'index'
223
225
  return document_index(source_module, path_to_root)
224
226
  end
@@ -233,8 +235,8 @@ module Jazzy
233
235
  doc[:tasks] = render_tasks(source_module, doc_model.children)
234
236
  doc[:module_name] = source_module.name
235
237
  doc[:author_name] = source_module.author_name
236
- doc[:author_website] = source_module.author_url
237
- doc[:github_url] = source_module.github_url
238
+ doc[:author_website] = source_module.author_url.to_s
239
+ doc[:github_url] = source_module.github_url.to_s
238
240
  doc[:dash_url] = source_module.dash_url
239
241
  doc[:path_to_root] = path_to_root
240
242
  doc.render
@@ -13,9 +13,9 @@ module Jazzy
13
13
  attr_reader :documents_dir
14
14
 
15
15
  def initialize(output_dir, source_module)
16
- @output_dir = output_dir
16
+ @output_dir = output_dir + 'docsets'
17
17
  @source_module = source_module
18
- @docset_dir = output_dir + "#{source_module.name}.docset"
18
+ @docset_dir = @output_dir + "#{source_module.name}.docset"
19
19
  @documents_dir = docset_dir + 'Contents/Resources/Documents/'
20
20
  end
21
21
 
@@ -25,6 +25,7 @@ module Jazzy
25
25
  write_plist
26
26
  create_index
27
27
  create_archive
28
+ create_xml if config.version && config.root_url
28
29
  end
29
30
 
30
31
  private
@@ -53,7 +54,7 @@ module Jazzy
53
54
  end
54
55
 
55
56
  def copy_docs
56
- files_to_copy = Dir.glob(output_dir + '**/*')
57
+ files_to_copy = Dir.glob(output_dir + '../**/*')
57
58
 
58
59
  FileUtils.mkdir_p documents_dir
59
60
  FileUtils.cp_r files_to_copy, documents_dir
@@ -72,6 +73,14 @@ module Jazzy
72
73
  end
73
74
  end
74
75
  end
76
+
77
+ def create_xml
78
+ (output_dir + "#{source_module.name}.xml").open('w') do |xml|
79
+ url = URI.join(config.root_url, "docsets/#{source_module.name}.tgz")
80
+ xml << "<entry><version>#{config.version}</version><url>#{url}" \
81
+ "</url></entry>\n"
82
+ end
83
+ end
75
84
  end
76
85
  end
77
86
  end
@@ -1,3 +1,3 @@
1
1
  module Jazzy
2
- VERSION = '0.0.16' unless defined? Jazzy::VERSION
2
+ VERSION = '0.0.17' unless defined? Jazzy::VERSION
3
3
  end
@@ -28,7 +28,7 @@
28
28
  <div class="abstract">
29
29
  {{{abstract}}}
30
30
  {{#url}}
31
- <a href="{{{url}}}" class="see-more">See more</a>
31
+ <a href="{{{path_to_root}}}{{{url}}}" class="see-more">See more</a>
32
32
  {{/url}}
33
33
  </div>
34
34
  {{/abstract}}
@@ -0,0 +1,41 @@
1
+ module Jazzy
2
+ class SourceDeclaration
3
+ class AccessControlLevel
4
+ include Comparable
5
+
6
+ attr_reader :level
7
+
8
+ def initialize(declaration_string)
9
+ if declaration_string =~ /private\ /
10
+ @level = :private
11
+ elsif declaration_string =~ /public\ /
12
+ @level = :public
13
+ else
14
+ @level = :internal
15
+ end
16
+ end
17
+
18
+ def self.private
19
+ AccessControlLevel.new('private ')
20
+ end
21
+
22
+ def self.internal
23
+ AccessControlLevel.new('internal ')
24
+ end
25
+
26
+ def self.public
27
+ AccessControlLevel.new('public ')
28
+ end
29
+
30
+ LEVELS = {
31
+ private: 0,
32
+ internal: 1,
33
+ public: 2,
34
+ }.freeze
35
+
36
+ def <=>(other)
37
+ LEVELS[level] <=> LEVELS[other.level]
38
+ end
39
+ end
40
+ end
41
+ end
@@ -1,3 +1,4 @@
1
+ require 'jazzy/source_declaration/access_control_level'
1
2
  require 'jazzy/source_declaration/type'
2
3
 
3
4
  module Jazzy
@@ -16,5 +17,6 @@ module Jazzy
16
17
  attr_accessor :parameters
17
18
  attr_accessor :url
18
19
  attr_accessor :mark
20
+ attr_accessor :access_control_level
19
21
  end
20
22
  end
@@ -1,3 +1,5 @@
1
+ require 'uri'
2
+
1
3
  require 'jazzy/config'
2
4
  require 'jazzy/source_declaration'
3
5
 
@@ -22,7 +24,8 @@ module Jazzy
22
24
  self.github_url = options.github_url
23
25
  self.github_file_prefix = options.github_file_prefix
24
26
  self.author_url = options.author_url
25
- self.dash_url = options.dash_url
27
+ return unless options.dash_url
28
+ self.dash_url = "dash-feed://#{URI.encode(options.dash_url.to_s, /\W/)}"
26
29
  end
27
30
 
28
31
  def all_declarations
@@ -10,6 +10,9 @@ require 'jazzy/highlighter'
10
10
  module Jazzy
11
11
  # This module interacts with the sourcekitten command-line executable
12
12
  module SourceKitten
13
+ @documented = 0
14
+ @undocumented = 0
15
+
13
16
  # Group root-level docs by type and add as children to a group doc element
14
17
  def self.group_docs(docs, type)
15
18
  group, docs = docs.partition { |doc| doc.type == type }
@@ -38,7 +41,6 @@ module Jazzy
38
41
  doc.url = parents.join('/') + '.html#/' + doc.usr
39
42
  end
40
43
  end
41
- docs
42
44
  end
43
45
 
44
46
  # Run sourcekitten with given arguments and return STDOUT
@@ -56,28 +58,57 @@ module Jazzy
56
58
  declaration.children = []
57
59
  end
58
60
 
61
+ def self.documented_child?(doc)
62
+ return false unless doc['key.substructure']
63
+ doc['key.substructure'].each do |child|
64
+ return true if documented_child?(child)
65
+ end
66
+ false
67
+ end
68
+
69
+ def self.should_document?(doc)
70
+ # Always document extensions, since we can't tell what ACL they are
71
+ return true if doc['key.kind'] == 'source.lang.swift.decl.extension'
72
+
73
+ SourceDeclaration::AccessControlLevel.new(doc['key.annotated_decl']) >=
74
+ @min_acl
75
+ end
76
+
77
+ def self.process_undocumented_token(doc, declaration)
78
+ @undocumented += 1
79
+ return nil unless documented_child?(doc)
80
+ make_default_doc_info(declaration)
81
+ end
82
+
83
+ def self.parameters_from_xml(xml)
84
+ xml.xpath('Parameters/Parameter').map do |parameter_el|
85
+ {
86
+ name: XMLHelper.xpath(parameter_el, 'Name'),
87
+ discussion: Jazzy.markdown.render(
88
+ XMLHelper.xpath(parameter_el, 'Discussion') || '',
89
+ ),
90
+ }
91
+ end
92
+ end
93
+
59
94
  def self.make_doc_info(doc, declaration)
95
+ return nil unless should_document?(doc)
60
96
  xml_key = 'key.doc.full_as_xml'
61
- return make_default_doc_info(declaration) unless doc[xml_key]
97
+ return process_undocumented_token(doc, declaration) unless doc[xml_key]
98
+ @documented += 1
62
99
 
63
100
  xml = Nokogiri::XML(doc[xml_key]).root
64
101
  declaration.line = XMLHelper.attribute(xml, 'line').to_i
65
102
  declaration.column = XMLHelper.attribute(xml, 'column').to_i
66
- decl = XMLHelper.xpath(xml, 'Declaration')
67
- declaration.declaration = Highlighter.highlight(decl, 'swift')
103
+ declaration.declaration = Highlighter.highlight(
104
+ doc['key.parsed_declaration'] || XMLHelper.xpath(xml, 'Declaration'),
105
+ 'swift',
106
+ )
68
107
  declaration.abstract = XMLHelper.xpath(xml, 'Abstract')
69
108
  declaration.discussion = XMLHelper.xpath(xml, 'Discussion')
70
109
  declaration.return = XMLHelper.xpath(xml, 'ResultDiscussion')
71
110
 
72
- declaration.parameters = []
73
- xml.xpath('Parameters/Parameter').each do |parameter_el|
74
- declaration.parameters << {
75
- name: XMLHelper.xpath(parameter_el, 'Name'),
76
- discussion: Jazzy.markdown.render(
77
- XMLHelper.xpath(parameter_el, 'Discussion'),
78
- ),
79
- }
80
- end
111
+ declaration.parameters = parameters_from_xml(xml)
81
112
  end
82
113
 
83
114
  def self.make_substructure(doc, declaration)
@@ -91,6 +122,7 @@ module Jazzy
91
122
  end
92
123
 
93
124
  # rubocop:disable Metrics/MethodLength
125
+ # rubocop:disable Metrics/CyclomaticComplexity
94
126
  def self.make_source_declarations(docs)
95
127
  declarations = []
96
128
  current_mark = SourceMark.new
@@ -116,35 +148,35 @@ module Jazzy
116
148
  declaration.usr = doc['key.usr']
117
149
  declaration.name = doc['key.name']
118
150
  declaration.mark = current_mark
151
+ acl = SourceDeclaration::AccessControlLevel.new(
152
+ doc['key.annotated_decl'],
153
+ )
154
+ declaration.access_control_level = acl
119
155
 
120
- make_doc_info(doc, declaration)
156
+ next unless make_doc_info(doc, declaration)
121
157
  make_substructure(doc, declaration)
122
158
  declarations << declaration
123
159
  end
124
160
  declarations
125
161
  end
162
+ # rubocop:enable Metrics/CyclomaticComplexity
126
163
  # rubocop:enable Metrics/MethodLength
127
164
 
128
- def self.doc_coverage(sourcekitten_json)
129
- documented = sourcekitten_json
130
- .map { |el| el['key.doc.documented'] }
131
- .inject(:+)
132
- undocumented = sourcekitten_json
133
- .map { |el| el['key.doc.undocumented'] }
134
- .inject(:+)
135
- return 0 if documented == 0 && undocumented == 0
136
- (100 * documented) / (undocumented + documented)
165
+ def self.doc_coverage
166
+ return 0 if @documented == 0 && @undocumented == 0
167
+ (100 * @documented) / (@undocumented + @documented)
137
168
  end
138
169
 
139
170
  # Parse sourcekitten STDOUT output as JSON
140
171
  # @return [Hash] structured docs
141
- def self.parse(sourcekitten_output)
172
+ def self.parse(sourcekitten_output, min_acl)
173
+ @min_acl = min_acl
142
174
  sourcekitten_json = JSON.parse(sourcekitten_output)
143
175
  docs = make_source_declarations(sourcekitten_json)
144
176
  SourceDeclaration::Type.all.each do |type|
145
177
  docs = group_docs(docs, type)
146
178
  end
147
- [make_doc_urls(docs, []), doc_coverage(sourcekitten_json)]
179
+ [make_doc_urls(docs, []), doc_coverage]
148
180
  end
149
181
  end
150
182
  end
@@ -90,13 +90,17 @@ describe_cli 'jazzy' do
90
90
  '-u https://nshipster.com/alamofire ' \
91
91
  '-x -project,Alamofire.xcodeproj ' \
92
92
  '-g https://github.com/Alamofire/Alamofire ' \
93
- '--github-file-prefix https://github.com/Alamofire/Alamofire/blob/1.1.0'
93
+ '--github-file-prefix https://github.com/' \
94
+ 'Alamofire/Alamofire/blob/1.1.0 ' \
95
+ '--module-version 1.1.0 ' \
96
+ '-r http://static.realm.io/jazzy_demo/Alamofire/'
94
97
  end
95
98
  describe 'Creates docs for Swift project with a variety of contents' do
96
99
  behaves_like cli_spec 'misc_jazzy_features',
97
100
  '-m MiscJazzyFeatures -a Realm ' \
98
101
  '-u https://github.com/realm/jazzy ' \
99
- '-g https://github.com/realm/jazzy '
102
+ '-g https://github.com/realm/jazzy ' \
103
+ '--min-acl private'
100
104
  end
101
105
  end
102
106
  end
@@ -24,8 +24,9 @@
24
24
  <a title="Manager Class Reference"></a>
25
25
  <header>
26
26
  <div class="content-wrapper">
27
- <p class="header-text"><a href="../index.html">Alamofire Docs</a> (40% documented)</p>
27
+ <p class="header-text"><a href="../index.html">Alamofire Docs</a> (83% documented)</p>
28
28
  <p id="header-links"><a href="https://github.com/Alamofire/Alamofire"><img id="header-icon" src="../img/gh.png" height="16px" width="16px" />View on GitHub</a></p>
29
+ <p id="header-links"><a href="dash-feed://http%3A%2F%2Fstatic%2Erealm%2Eio%2Fjazzy_demo%2FAlamofire%2Fdocsets%2FAlamofire%2Exml"><img id="header-icon" src="../img/dash.png" height="16px" width="16px" />Install in Dash</a></p>
29
30
  </div>
30
31
  </header>
31
32
  <section id="valence">
@@ -74,25 +75,22 @@
74
75
  <a href="../Extensions.html">Extensions</a>
75
76
  <ul class="nav-chapters">
76
77
  <li class="nav-chapter">
77
- <a href="../Extensions.html#/s:SS">String</a>
78
+ <a href="../Extensions/Manager.html">Manager</a>
78
79
  </li>
79
80
  <li class="nav-chapter">
80
- <a href="../Extensions.html#/c:objc(cs)NSURLRequest">NSURLRequest</a>
81
+ <a href="../Extensions/Manager.html">Manager</a>
81
82
  </li>
82
83
  <li class="nav-chapter">
83
84
  <a href="../Extensions.html#/c:objc(cs)NSURLRequest">NSURLRequest</a>
84
85
  </li>
85
86
  <li class="nav-chapter">
86
- <a href="../Extensions/Request.html">Request</a>
87
- </li>
88
- <li class="nav-chapter">
89
- <a href="../Extensions/Manager.html">Manager</a>
87
+ <a href="../Extensions.html#/c:objc(cs)NSURLRequest">NSURLRequest</a>
90
88
  </li>
91
89
  <li class="nav-chapter">
92
90
  <a href="../Extensions.html#/s:C9Alamofire7Request">Request</a>
93
91
  </li>
94
92
  <li class="nav-chapter">
95
- <a href="../Extensions/Manager.html">Manager</a>
93
+ <a href="../Extensions/Request.html">Request</a>
96
94
  </li>
97
95
  <li class="nav-chapter">
98
96
  <a href="../Extensions/Request.html">Request</a>
@@ -112,43 +110,46 @@
112
110
  <li class="nav-chapter">
113
111
  <a href="../Extensions/Request.html">Request</a>
114
112
  </li>
113
+ <li class="nav-chapter">
114
+ <a href="../Extensions.html#/s:SS">String</a>
115
+ </li>
115
116
  </ul>
116
117
  </li>
117
118
  <li class="part-name tasks">
118
119
  <a href="../Functions.html">Functions</a>
119
120
  <ul class="nav-chapters">
120
121
  <li class="nav-chapter">
121
- <a href="../Functions.html#/s:F9Alamofire7requestFTOS_6MethodPS_20URLStringConvertible_10parametersGSqGVSs10DictionarySSPSs9AnyObject___8encodingOS_17ParameterEncoding_CS_7Request">request(_:_:parameters:encoding:)</a>
122
+ <a href="../Functions.html#/s:F9Alamofire8downloadFTPS_21URLRequestConvertible_FTCSo5NSURLCSo17NSHTTPURLResponse_S1__CS_7Request">download(_:_:)</a>
122
123
  </li>
123
124
  <li class="nav-chapter">
124
- <a href="../Functions.html#/s:F9Alamofire7requestFPS_21URLRequestConvertible_CS_7Request">request(_:)</a>
125
+ <a href="../Functions.html#/s:F9Alamofire8downloadFTOS_6MethodPS_20URLStringConvertible_FTCSo5NSURLCSo17NSHTTPURLResponse_S2__CS_7Request">download(_:_:_:)</a>
125
126
  </li>
126
127
  <li class="nav-chapter">
127
- <a href="../Functions.html#/s:F9Alamofire6uploadFTOS_6MethodPS_20URLStringConvertible_CSo5NSURL_CS_7Request">upload(_:_:_:)</a>
128
+ <a href="../Functions.html#/s:F9Alamofire8downloadFT10resumeDataCSo6NSDataFTCSo5NSURLCSo17NSHTTPURLResponse_S1__CS_7Request">download(resumeData:_:)</a>
128
129
  </li>
129
130
  <li class="nav-chapter">
130
- <a href="../Functions.html#/s:F9Alamofire6uploadFTPS_21URLRequestConvertible_CSo5NSURL_CS_7Request">upload(_:_:)</a>
131
+ <a href="../Functions.html#/s:F9Alamofire7requestFPS_21URLRequestConvertible_CS_7Request">request(_:)</a>
131
132
  </li>
132
133
  <li class="nav-chapter">
133
- <a href="../Functions.html#/s:F9Alamofire6uploadFTOS_6MethodPS_20URLStringConvertible_CSo6NSData_CS_7Request">upload(_:_:_:)</a>
134
+ <a href="../Functions.html#/s:F9Alamofire7requestFTOS_6MethodPS_20URLStringConvertible_10parametersGSqGVSs10DictionarySSPSs9AnyObject___8encodingOS_17ParameterEncoding_CS_7Request">request(_:_:parameters:encoding:)</a>
134
135
  </li>
135
136
  <li class="nav-chapter">
136
137
  <a href="../Functions.html#/s:F9Alamofire6uploadFTPS_21URLRequestConvertible_CSo6NSData_CS_7Request">upload(_:_:)</a>
137
138
  </li>
138
139
  <li class="nav-chapter">
139
- <a href="../Functions.html#/s:F9Alamofire6uploadFTOS_6MethodPS_20URLStringConvertible_CSo13NSInputStream_CS_7Request">upload(_:_:_:)</a>
140
+ <a href="../Functions.html#/s:F9Alamofire6uploadFTPS_21URLRequestConvertible_CSo13NSInputStream_CS_7Request">upload(_:_:)</a>
140
141
  </li>
141
142
  <li class="nav-chapter">
142
- <a href="../Functions.html#/s:F9Alamofire6uploadFTPS_21URLRequestConvertible_CSo13NSInputStream_CS_7Request">upload(_:_:)</a>
143
+ <a href="../Functions.html#/s:F9Alamofire6uploadFTPS_21URLRequestConvertible_CSo5NSURL_CS_7Request">upload(_:_:)</a>
143
144
  </li>
144
145
  <li class="nav-chapter">
145
- <a href="../Functions.html#/s:F9Alamofire8downloadFTOS_6MethodPS_20URLStringConvertible_FTCSo5NSURLCSo17NSHTTPURLResponse_S2__CS_7Request">download(_:_:_:)</a>
146
+ <a href="../Functions.html#/s:F9Alamofire6uploadFTOS_6MethodPS_20URLStringConvertible_CSo13NSInputStream_CS_7Request">upload(_:_:_:)</a>
146
147
  </li>
147
148
  <li class="nav-chapter">
148
- <a href="../Functions.html#/s:F9Alamofire8downloadFTPS_21URLRequestConvertible_FTCSo5NSURLCSo17NSHTTPURLResponse_S1__CS_7Request">download(_:_:)</a>
149
+ <a href="../Functions.html#/s:F9Alamofire6uploadFTOS_6MethodPS_20URLStringConvertible_CSo5NSURL_CS_7Request">upload(_:_:_:)</a>
149
150
  </li>
150
151
  <li class="nav-chapter">
151
- <a href="../Functions.html#/s:F9Alamofire8downloadFT10resumeDataCSo6NSDataFTCSo5NSURLCSo17NSHTTPURLResponse_S1__CS_7Request">download(resumeData:_:)</a>
152
+ <a href="../Functions.html#/s:F9Alamofire6uploadFTOS_6MethodPS_20URLStringConvertible_CSo6NSData_CS_7Request">upload(_:_:_:)</a>
152
153
  </li>
153
154
  </ul>
154
155
  </li>
@@ -156,10 +157,10 @@
156
157
  <a href="../Protocols.html">Protocols</a>
157
158
  <ul class="nav-chapters">
158
159
  <li class="nav-chapter">
159
- <a href="../Protocols/URLStringConvertible.html">URLStringConvertible</a>
160
+ <a href="../Protocols/URLRequestConvertible.html">URLRequestConvertible</a>
160
161
  </li>
161
162
  <li class="nav-chapter">
162
- <a href="../Protocols/URLRequestConvertible.html">URLRequestConvertible</a>
163
+ <a href="../Protocols/URLStringConvertible.html">URLStringConvertible</a>
163
164
  </li>
164
165
  </ul>
165
166
  </li>
@@ -202,7 +203,7 @@
202
203
 
203
204
  <div class="Swift">
204
205
  <p class="aside-title">Swift</p>
205
- <pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="k">var</span> <span class="nv">sharedInstance</span><span class="p">:</span> <span class="kt">Manager</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
206
+ <pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="k">var</span> <span class="nv">sharedInstance</span><span class="p">:</span> <span class="kt">Manager</span></code></pre>
206
207
 
207
208
  </div>
208
209
  </div>
@@ -262,7 +263,7 @@
262
263
 
263
264
  <div class="Swift">
264
265
  <p class="aside-title">Swift</p>
265
- <pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">startRequestsImmediately</span><span class="p">:</span> <span class="kt">Bool</span></code></pre>
266
+ <pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">startRequestsImmediately</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span></code></pre>
266
267
 
267
268
  </div>
268
269
  </div>
@@ -286,14 +287,13 @@
286
287
  <div class="pointy-thing"></div>
287
288
  <div class="abstract">
288
289
 
289
- <a href="Classes/Manager/init(configuration:).html" class="see-more">See more</a>
290
290
  </div>
291
291
  <div class="declaration">
292
292
  <h4>Declaration</h4>
293
293
 
294
294
  <div class="Swift">
295
295
  <p class="aside-title">Swift</p>
296
- <pre class="highlight"><code><span class="kd">required</span> <span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">configuration</span><span class="p">:</span> <span class="kt">NSURLSessionConfiguration</span><span class="p">?</span> <span class="o">=</span> <span class="k">default</span><span class="p">)</span></code></pre>
296
+ <pre class="highlight"><code><span class="kd">required</span> <span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">configuration</span><span class="p">:</span> <span class="kt">NSURLSessionConfiguration</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
297
297
 
298
298
  </div>
299
299
  </div>
@@ -351,7 +351,7 @@
351
351
 
352
352
  <div class="Swift">
353
353
  <p class="aside-title">Swift</p>
354
- <pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">request</span><span class="p">(</span><span class="nv">method</span><span class="p">:</span> <span class="kt">Method</span><span class="p">,</span> <span class="n">_</span> <span class="kt">URLString</span><span class="p">:</span> <span class="kt">URLStringConvertible</span><span class="p">,</span> <span class="nv">parameters</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span> <span class="p">:</span> <span class="kt">AnyObject</span><span class="p">]?</span> <span class="o">=</span> <span class="k">default</span><span class="p">,</span> <span class="nv">encoding</span><span class="p">:</span> <span class="kt">ParameterEncoding</span> <span class="o">=</span> <span class="k">default</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Request</span></code></pre>
354
+ <pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">request</span><span class="p">(</span><span class="nv">method</span><span class="p">:</span> <span class="kt">Method</span><span class="p">,</span> <span class="n">_</span> <span class="kt">URLString</span><span class="p">:</span> <span class="kt">URLStringConvertible</span><span class="p">,</span> <span class="nv">parameters</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">AnyObject</span><span class="p">]?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">encoding</span><span class="p">:</span> <span class="kt">ParameterEncoding</span> <span class="o">=</span> <span class="o">.</span><span class="kt">URL</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Request</span></code></pre>
355
355
 
356
356
  </div>
357
357
  </div>