jazzy 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +7 -5
  3. data/Rakefile +2 -0
  4. data/bin/jazzy +1 -1
  5. data/jazzy.gemspec +1 -0
  6. data/lib/jazzy.rb +1 -0
  7. data/lib/jazzy/assets/css/highlight.css.scss +63 -0
  8. data/lib/jazzy/assets/css/jazzy.css.scss +27 -1
  9. data/lib/jazzy/assets/js/jazzy.js +8 -2
  10. data/lib/jazzy/config.rb +32 -0
  11. data/lib/jazzy/doc.mustache +15 -1
  12. data/lib/jazzy/doc_builder.rb +24 -12
  13. data/lib/jazzy/docset_builder.rb +77 -0
  14. data/lib/jazzy/docset_builder/info_plist.mustache +20 -0
  15. data/lib/jazzy/gem_version.rb +1 -1
  16. data/lib/jazzy/highlighter.rb +10 -0
  17. data/lib/jazzy/partials/task.mustache +3 -3
  18. data/lib/jazzy/source_declaration.rb +3 -3
  19. data/lib/jazzy/source_declaration/type.rb +136 -0
  20. data/lib/jazzy/source_module.rb +10 -0
  21. data/lib/jazzy/sourcekitten.rb +35 -62
  22. data/logo.sketch +0 -0
  23. data/spec/integration_spec.rb +10 -0
  24. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Info.plist +20 -0
  25. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Classes.html +267 -0
  26. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Classes/Manager.html +488 -0
  27. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Classes/Manager/init(configuration:).html +218 -0
  28. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Classes/Request.html +841 -0
  29. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Enums.html +257 -0
  30. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Enums/ParameterEncoding.html +346 -0
  31. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Extensions.html +708 -0
  32. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Extensions/Manager.html +344 -0
  33. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Extensions/Request.html +368 -0
  34. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Functions.html +1040 -0
  35. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Global Variables.html +226 -0
  36. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Manager.html +344 -0
  37. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Manager/init(configuration:).html +218 -0
  38. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/ParameterEncoding.html +346 -0
  39. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Protocols.html +275 -0
  40. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Protocols/URLRequestConvertible.html +227 -0
  41. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Protocols/URLStringConvertible.html +227 -0
  42. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/Request.html +368 -0
  43. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/URLRequestConvertible.html +227 -0
  44. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/URLStringConvertible.html +227 -0
  45. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/carat.png +0 -0
  46. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/css/highlight.css +202 -0
  47. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/css/jazzy.css +708 -0
  48. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/dash.png +0 -0
  49. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/gh.png +0 -0
  50. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/highlight.css +202 -0
  51. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/img/carat.png +0 -0
  52. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/img/dash.png +0 -0
  53. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/img/gh.png +0 -0
  54. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/index.html +755 -0
  55. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/init(configuration:).html +218 -0
  56. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/jazzy.css +708 -0
  57. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/jazzy.js +21 -0
  58. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/jquery.min.js +4 -0
  59. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/js/jazzy.js +21 -0
  60. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/Documents/js/jquery.min.js +4 -0
  61. data/spec/integration_specs/document_alamofire/after/docs/Alamofire.docset/Contents/Resources/docSet.dsidx.csv +81 -0
  62. data/spec/integration_specs/document_alamofire/after/docs/Classes.html +18 -7
  63. data/spec/integration_specs/document_alamofire/after/docs/Classes/Manager.html +31 -19
  64. data/spec/integration_specs/document_alamofire/after/docs/Classes/Manager/init(configuration:).html +14 -1
  65. data/spec/integration_specs/document_alamofire/after/docs/Classes/Request.html +61 -46
  66. data/spec/integration_specs/document_alamofire/after/docs/Enums.html +18 -7
  67. data/spec/integration_specs/document_alamofire/after/docs/Enums/ParameterEncoding.html +20 -4
  68. data/spec/integration_specs/document_alamofire/after/docs/Extensions.html +68 -48
  69. data/spec/integration_specs/document_alamofire/after/docs/Extensions/Manager.html +21 -7
  70. data/spec/integration_specs/document_alamofire/after/docs/Extensions/Request.html +22 -10
  71. data/spec/integration_specs/document_alamofire/after/docs/Functions.html +51 -34
  72. data/spec/integration_specs/document_alamofire/after/docs/Global Variables.html +15 -4
  73. data/spec/integration_specs/document_alamofire/after/docs/Protocols.html +20 -7
  74. data/spec/integration_specs/document_alamofire/after/docs/Protocols/URLRequestConvertible.html +16 -4
  75. data/spec/integration_specs/document_alamofire/after/docs/Protocols/URLStringConvertible.html +16 -4
  76. data/spec/integration_specs/document_alamofire/after/docs/css/highlight.css +202 -0
  77. data/spec/integration_specs/document_alamofire/after/docs/css/jazzy.css +14 -0
  78. data/spec/integration_specs/document_alamofire/after/docs/index.html +53 -42
  79. data/spec/integration_specs/document_alamofire/after/docs/js/jazzy.js +8 -2
  80. data/spec/integration_specs/misc_jazzy_features/after/docs/Classes.html +34 -22
  81. data/spec/integration_specs/misc_jazzy_features/after/docs/Classes/ImplicitlyInternalTopLevelClass.html +16 -4
  82. data/spec/integration_specs/misc_jazzy_features/after/docs/Enums.html +16 -4
  83. data/spec/integration_specs/misc_jazzy_features/after/docs/Enums/DocumentedEnum.html +14 -1
  84. data/spec/integration_specs/misc_jazzy_features/after/docs/Global Variables.html +16 -4
  85. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Info.plist +20 -0
  86. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/Classes.html +309 -0
  87. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/Classes/ImplicitlyInternalTopLevelClass.html +143 -0
  88. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/DocumentedEnum.html +134 -0
  89. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/Enums.html +147 -0
  90. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/Enums/DocumentedEnum.html +134 -0
  91. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/Global Variables.html +146 -0
  92. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/ImplicitlyInternalTopLevelClass.html +143 -0
  93. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/carat.png +0 -0
  94. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/css/highlight.css +202 -0
  95. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/css/jazzy.css +708 -0
  96. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/dash.png +0 -0
  97. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/gh.png +0 -0
  98. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/highlight.css +202 -0
  99. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/img/carat.png +0 -0
  100. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/img/dash.png +0 -0
  101. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/img/gh.png +0 -0
  102. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/index.html +106 -0
  103. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/jazzy.css +708 -0
  104. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/jazzy.js +21 -0
  105. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/jquery.min.js +4 -0
  106. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/js/jazzy.js +21 -0
  107. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/Documents/js/jquery.min.js +4 -0
  108. data/spec/integration_specs/misc_jazzy_features/after/docs/MiscJazzyFeatures.docset/Contents/Resources/docSet.dsidx.csv +15 -0
  109. data/spec/integration_specs/misc_jazzy_features/after/docs/css/highlight.css +202 -0
  110. data/spec/integration_specs/misc_jazzy_features/after/docs/css/jazzy.css +14 -0
  111. data/spec/integration_specs/misc_jazzy_features/after/docs/index.html +12 -1
  112. data/spec/integration_specs/misc_jazzy_features/after/docs/js/jazzy.js +8 -2
  113. metadata +88 -5
  114. data/lib/jazzy/assets/css/github_syntax_highlighting.css.scss +0 -142
  115. data/spec/integration_specs/document_alamofire/after/docs/css/github_syntax_highlighting.css +0 -98
  116. data/spec/integration_specs/misc_jazzy_features/after/docs/css/github_syntax_highlighting.css +0 -98
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleIdentifier</key>
6
+ <string>com.jazzy.{{bundle_identifier}}</string>
7
+ <key>CFBundleName</key>
8
+ <string>{{name}}</string>
9
+ <key>DocSetPlatformFamily</key>
10
+ <string>{{platform_family}}</string>
11
+ <key>isDashDocset</key>
12
+ <true/>
13
+ <key>dashIndexFilePath</key>
14
+ <string>index.html</string>
15
+ <key>isJavaScriptEnabled</key>
16
+ <true/>
17
+ <key>DashDocSetFamily</key>
18
+ <string>dashtoc</string>
19
+ </dict>
20
+ </plist>
@@ -1,3 +1,3 @@
1
1
  module Jazzy
2
- VERSION = '0.0.15' unless defined? Jazzy::VERSION
2
+ VERSION = '0.0.16' unless defined? Jazzy::VERSION
3
3
  end
@@ -0,0 +1,10 @@
1
+ require 'rouge'
2
+
3
+ module Jazzy
4
+ # This module helps highlight code
5
+ module Highlighter
6
+ def self.highlight(source, language)
7
+ source && Rouge.highlight(source, language, 'html')
8
+ end
9
+ end
10
+ end
@@ -3,6 +3,7 @@
3
3
  {{#pre_separator}}<hr/>{{/pre_separator}}
4
4
  <a name="/{{uid}}"></a>
5
5
  {{#name}}
6
+ <a name="//apple_ref/swift/Section/{{name}}" class="dashAnchor"></a>
6
7
  <a href="#/{{uid}}">
7
8
  <h3 class="section-name">{{name}}</h3>
8
9
  </a>
@@ -15,6 +16,7 @@
15
16
  <div class="task-group-term">
16
17
  <code>
17
18
  <a name="/{{usr}}">
19
+ <a name="//apple_ref/swift/{{dash_type}}/{{name}}" class="dashAnchor"></a>
18
20
  <a class="x-instance-method Swift" href="#/{{usr}}">{{name}}</a>
19
21
  </code>
20
22
  </div>
@@ -36,9 +38,7 @@
36
38
 
37
39
  <div class="Swift">
38
40
  <p class="aside-title">Swift</p>
39
- <p class="para">
40
- <code>{{declaration}}</code>
41
- </p>
41
+ {{{declaration}}}
42
42
  </div>
43
43
  </div>
44
44
  {{/declaration}}
@@ -1,8 +1,8 @@
1
+ require 'jazzy/source_declaration/type'
2
+
1
3
  module Jazzy
2
4
  class SourceDeclaration
3
- attr_accessor :kindNamePlural
4
- attr_accessor :kind
5
- attr_accessor :kindName
5
+ attr_accessor :type
6
6
  attr_accessor :file
7
7
  attr_accessor :line
8
8
  attr_accessor :column
@@ -0,0 +1,136 @@
1
+ require 'active_support/inflector'
2
+
3
+ module Jazzy
4
+ class SourceDeclaration
5
+ # rubocop:disable Metrics/ClassLength
6
+ class Type
7
+ def self.all
8
+ TYPES.keys.map { |k| new(k) }
9
+ end
10
+
11
+ attr_reader :kind
12
+
13
+ def initialize(kind)
14
+ @kind = kind
15
+ @type = TYPES[kind]
16
+ end
17
+
18
+ def dash_type
19
+ @type && @type[:dash]
20
+ end
21
+
22
+ def name
23
+ @type && @type[:jazzy]
24
+ end
25
+
26
+ def plural_name
27
+ name.pluralize
28
+ end
29
+
30
+ def mark?
31
+ kind == 'source.lang.swift.syntaxtype.comment.mark'
32
+ end
33
+
34
+ def declaration?
35
+ kind =~ /^source\.lang\.swift\.decl\..*/
36
+ end
37
+
38
+ def self.overview
39
+ Type.new('Overview')
40
+ end
41
+
42
+ def hash
43
+ kind.hash
44
+ end
45
+
46
+ alias_method :equals, :==
47
+ def ==(other)
48
+ other && kind == other.kind
49
+ end
50
+
51
+ TYPES = {
52
+ 'source.lang.swift.decl.function.method.class' => {
53
+ jazzy: 'Class Method',
54
+ dash: 'Method',
55
+ }.freeze,
56
+ 'source.lang.swift.decl.var.class' => {
57
+ jazzy: 'Class Variable',
58
+ dash: 'Variable',
59
+ }.freeze,
60
+ 'source.lang.swift.decl.class' => {
61
+ jazzy: 'Class',
62
+ dash: 'Class',
63
+ }.freeze,
64
+ 'source.lang.swift.decl.function.constructor' => {
65
+ jazzy: 'Constructor',
66
+ dash: 'Constructor',
67
+ }.freeze,
68
+ 'source.lang.swift.decl.function.destructor' => {
69
+ jazzy: 'Destructor',
70
+ dash: 'Method',
71
+ }.freeze,
72
+ 'source.lang.swift.decl.var.global' => {
73
+ jazzy: 'Global Variable',
74
+ dash: 'Global',
75
+ }.freeze,
76
+ 'source.lang.swift.decl.enumelement' => {
77
+ jazzy: 'Enum Element',
78
+ dash: 'Element',
79
+ }.freeze,
80
+ 'source.lang.swift.decl.enum' => {
81
+ jazzy: 'Enum',
82
+ dash: 'Enum',
83
+ }.freeze,
84
+ 'source.lang.swift.decl.extension' => {
85
+ jazzy: 'Extension',
86
+ dash: 'Extension',
87
+ }.freeze,
88
+ 'source.lang.swift.decl.function.free' => {
89
+ jazzy: 'Function',
90
+ dash: 'Function',
91
+ }.freeze,
92
+ 'source.lang.swift.decl.function.method.instance' => {
93
+ jazzy: 'Instance Method',
94
+ dash: 'Method',
95
+ }.freeze,
96
+ 'source.lang.swift.decl.var.instance' => {
97
+ jazzy: 'Instance Variable',
98
+ dash: 'Property',
99
+ }.freeze,
100
+ 'source.lang.swift.decl.var.local' => {
101
+ jazzy: 'Local Variable',
102
+ dash: 'Variable',
103
+ }.freeze,
104
+ 'source.lang.swift.decl.var.parameter' => {
105
+ jazzy: 'Parameter',
106
+ dash: 'Parameter',
107
+ }.freeze,
108
+ 'source.lang.swift.decl.protocol' => {
109
+ jazzy: 'Protocol',
110
+ dash: 'Protocol',
111
+ }.freeze,
112
+ 'source.lang.swift.decl.function.method.static' => {
113
+ jazzy: 'Static Method',
114
+ dash: 'Method',
115
+ }.freeze,
116
+ 'source.lang.swift.decl.var.static' => {
117
+ jazzy: 'Static Variable',
118
+ dash: 'Variable',
119
+ }.freeze,
120
+ 'source.lang.swift.decl.struct' => {
121
+ jazzy: 'Struct',
122
+ dash: 'Struct',
123
+ }.freeze,
124
+ 'source.lang.swift.decl.function.subscript' => {
125
+ jazzy: 'Subscript',
126
+ dash: 'Method',
127
+ }.freeze,
128
+ 'source.lang.swift.decl.typealias' => {
129
+ jazzy: 'Typealias',
130
+ dash: 'Alias',
131
+ }.freeze,
132
+ }.freeze
133
+ end
134
+ # rubocop:enable Metrics/ClassLength
135
+ end
136
+ end
@@ -24,5 +24,15 @@ module Jazzy
24
24
  self.author_url = options.author_url
25
25
  self.dash_url = options.dash_url
26
26
  end
27
+
28
+ def all_declarations
29
+ all_declarations = []
30
+ visitor = lambda do |d|
31
+ all_declarations.unshift(*d)
32
+ d.map(&:children).each { |c| visitor[c] }
33
+ end
34
+ visitor[docs]
35
+ all_declarations
36
+ end
27
37
  end
28
38
  end
@@ -1,4 +1,3 @@
1
- require 'active_support/inflector'
2
1
  require 'json'
3
2
  require 'pathname'
4
3
 
@@ -6,43 +5,18 @@ require 'jazzy/config'
6
5
  require 'jazzy/source_declaration'
7
6
  require 'jazzy/source_mark'
8
7
  require 'jazzy/xml_helper'
8
+ require 'jazzy/highlighter'
9
9
 
10
10
  module Jazzy
11
11
  # This module interacts with the sourcekitten command-line executable
12
12
  module SourceKitten
13
- # SourceKit-provided token kinds along with their names
14
- # @todo Make sure this list is exhaustive for source.lang.swift.decl.*
15
- @kinds = {
16
- 'source.lang.swift.decl.function.method.class' => 'Class Method',
17
- 'source.lang.swift.decl.var.class' => 'Class Variable',
18
- 'source.lang.swift.decl.class' => 'Class',
19
- 'source.lang.swift.decl.function.constructor' => 'Constructor',
20
- 'source.lang.swift.decl.function.destructor' => 'Destructor',
21
- 'source.lang.swift.decl.var.global' => 'Global Variable',
22
- 'source.lang.swift.decl.enumelement' => 'Enum Element',
23
- 'source.lang.swift.decl.enum' => 'Enum',
24
- 'source.lang.swift.decl.extension' => 'Extension',
25
- 'source.lang.swift.decl.function.free' => 'Function',
26
- 'source.lang.swift.decl.function.method.instance' => 'Instance Method',
27
- 'source.lang.swift.decl.var.instance' => 'Instance Variable',
28
- 'source.lang.swift.decl.var.local' => 'Local Variable',
29
- 'source.lang.swift.decl.var.parameter' => 'Parameter',
30
- 'source.lang.swift.decl.protocol' => 'Protocol',
31
- 'source.lang.swift.decl.function.method.static' => 'Static Method',
32
- 'source.lang.swift.decl.var.static' => 'Static Variable',
33
- 'source.lang.swift.decl.struct' => 'Struct',
34
- 'source.lang.swift.decl.function.subscript' => 'Subscript',
35
- 'source.lang.swift.decl.typealias' => 'Typealias',
36
- }.freeze
37
-
38
- # Group root-level docs by kind and add as children to a group doc element
39
- def self.group_docs(docs, kind)
40
- kind_name_plural = @kinds[kind].pluralize
41
- group, docs = docs.partition { |doc| doc.kind == kind }
13
+ # Group root-level docs by type and add as children to a group doc element
14
+ def self.group_docs(docs, type)
15
+ group, docs = docs.partition { |doc| doc.type == type }
42
16
  docs << SourceDeclaration.new.tap do |sd|
43
- sd.name = kind_name_plural
44
- sd.kind = 'Overview'
45
- sd.abstract = "The following #{kind_name_plural.downcase} are " \
17
+ sd.type = SourceDeclaration::Type.overview
18
+ sd.name = type.plural_name
19
+ sd.abstract = "The following #{type.plural_name.downcase} are " \
46
20
  'available globally.'
47
21
  sd.children = group
48
22
  end if group.count > 0
@@ -79,29 +53,30 @@ module Jazzy
79
53
  declaration.column = 0
80
54
  declaration.abstract = 'Undocumented'
81
55
  declaration.parameters = []
56
+ declaration.children = []
82
57
  end
83
58
 
84
59
  def self.make_doc_info(doc, declaration)
85
- if doc['key.doc.full_as_xml']
86
- xml = Nokogiri::XML(doc['key.doc.full_as_xml']).root
87
- declaration.line = XMLHelper.attribute(xml, 'line').to_i
88
- declaration.column = XMLHelper.attribute(xml, 'column').to_i
89
- declaration.declaration = XMLHelper.xpath(xml, 'Declaration')
90
- declaration.abstract = XMLHelper.xpath(xml, 'Abstract')
91
- declaration.discussion = XMLHelper.xpath(xml, 'Discussion')
92
- declaration.return = XMLHelper.xpath(xml, 'ResultDiscussion')
60
+ xml_key = 'key.doc.full_as_xml'
61
+ return make_default_doc_info(declaration) unless doc[xml_key]
93
62
 
94
- declaration.parameters = []
95
- xml.xpath('Parameters/Parameter').each do |parameter_el|
96
- declaration.parameters << {
97
- name: XMLHelper.xpath(parameter_el, 'Name'),
98
- discussion: Jazzy.markdown.render(
99
- XMLHelper.xpath(parameter_el, 'Discussion'),
100
- ),
101
- }
102
- end
103
- else
104
- make_default_doc_info(declaration)
63
+ xml = Nokogiri::XML(doc[xml_key]).root
64
+ declaration.line = XMLHelper.attribute(xml, 'line').to_i
65
+ declaration.column = XMLHelper.attribute(xml, 'column').to_i
66
+ decl = XMLHelper.xpath(xml, 'Declaration')
67
+ declaration.declaration = Highlighter.highlight(decl, 'swift')
68
+ declaration.abstract = XMLHelper.xpath(xml, 'Abstract')
69
+ declaration.discussion = XMLHelper.xpath(xml, 'Discussion')
70
+ declaration.return = XMLHelper.xpath(xml, 'ResultDiscussion')
71
+
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
+ }
105
80
  end
106
81
  end
107
82
 
@@ -125,22 +100,20 @@ module Jazzy
125
100
  next
126
101
  end
127
102
  declaration = SourceDeclaration.new
128
- declaration.kind = doc['key.kind']
129
- if declaration.kind == 'source.lang.swift.syntaxtype.comment.mark' &&
130
- doc['key.name'].start_with?('MARK: ')
103
+ declaration.type = SourceDeclaration::Type.new(doc['key.kind'])
104
+ if declaration.type.mark? && doc['key.name'].start_with?('MARK: ')
131
105
  current_mark = SourceMark.new(doc['key.name'])
132
106
  end
133
- next unless declaration.kind =~ /^source\.lang\.swift\.decl\..*/
107
+ next unless declaration.type.declaration?
134
108
 
135
- unless declaration.kindName = @kinds[declaration.kind]
109
+ unless declaration.type.name
136
110
  raise 'Please file an issue on ' \
137
111
  'https://github.com/realm/jazzy/issues about adding support for ' \
138
- "`#{declaration.kind}`"
112
+ "`#{declaration.type.kind}`."
139
113
  end
140
114
 
141
- declaration.kindNamePlural = declaration.kindName.pluralize
142
115
  declaration.file = doc['key.filepath']
143
- declaration.usr = doc['key.usr']
116
+ declaration.usr = doc['key.usr']
144
117
  declaration.name = doc['key.name']
145
118
  declaration.mark = current_mark
146
119
 
@@ -168,8 +141,8 @@ module Jazzy
168
141
  def self.parse(sourcekitten_output)
169
142
  sourcekitten_json = JSON.parse(sourcekitten_output)
170
143
  docs = make_source_declarations(sourcekitten_json)
171
- @kinds.keys.each do |kind|
172
- docs = group_docs(docs, kind)
144
+ SourceDeclaration::Type.all.each do |type|
145
+ docs = group_docs(docs, type)
173
146
  end
174
147
  [make_doc_urls(docs, []), doc_coverage(sourcekitten_json)]
175
148
  end
Binary file
@@ -56,6 +56,16 @@ CLIntegracon.configure do |c|
56
56
  c.ignores '.DS_Store'
57
57
  c.ignores '.git'
58
58
  c.ignores /^(?!(docs\/|execution_output.txt))/
59
+ c.ignores '*.tgz'
60
+
61
+ # Transform produced databases to csv
62
+ c.transform_produced '**/*.dsidx' do |path|
63
+ File.open("#{path}.csv", 'w') do |file|
64
+ file.write `sqlite3 -header -csv #{path} "select * from searchIndex;"`
65
+ end
66
+ end
67
+ # Now that we're comparing the CSV, we don't care about the binary
68
+ c.ignores '**/*.dsidx'
59
69
 
60
70
  c.hook_into :bacon
61
71
  end
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleIdentifier</key>
6
+ <string>com.jazzy.alamofire</string>
7
+ <key>CFBundleName</key>
8
+ <string>Alamofire</string>
9
+ <key>DocSetPlatformFamily</key>
10
+ <string>jazzy</string>
11
+ <key>isDashDocset</key>
12
+ <true/>
13
+ <key>dashIndexFilePath</key>
14
+ <string>index.html</string>
15
+ <key>isJavaScriptEnabled</key>
16
+ <true/>
17
+ <key>DashDocSetFamily</key>
18
+ <string>dashtoc</string>
19
+ </dict>
20
+ </plist>
@@ -0,0 +1,267 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>Classes Reference</title>
5
+ <link rel="stylesheet" type="text/css" href="css/jazzy.css" />
6
+ <link rel="stylesheet" type="text/css" href="css/highlight.css" />
7
+ <meta charset='utf-8'>
8
+ <script type="text/javascript">
9
+ window.jazzy = {'docset': false}
10
+ if (typeof window.dash != 'undefined') {
11
+ document.documentElement.className += ' dash'
12
+ window.jazzy.docset = true
13
+ }
14
+ if (navigator.userAgent.match(/xcode/i)) {
15
+ document.documentElement.className += ' xcode'
16
+ window.jazzy.docset = true
17
+ }
18
+ </script>
19
+ <script src="js/jquery.min.js" defer></script>
20
+ <script src="js/jazzy.js" defer></script>
21
+ </head>
22
+ <body id="reference" class="Swift">
23
+ <a title="Classes Reference"></a>
24
+ <header>
25
+ <div class="content-wrapper">
26
+ <p class="header-text"><a href="index.html">Alamofire Docs</a> (40% documented)</p>
27
+ <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>
28
+ </div>
29
+ </header>
30
+ <section id="valence">
31
+ <div class="content-wrapper">
32
+ <p id="hierarchial_navigation">
33
+ <a href="index.html" id="design_resources_link">Alamofire Reference</a>
34
+ <img id="carat" src="img/carat.png" height="10px" width="6px" />
35
+ Classes Reference
36
+ </p>
37
+ </div>
38
+ </section>
39
+ <div class="content-wrapper">
40
+ <nav class="book-parts">
41
+ <ul class="nav-parts">
42
+ <li class="part-name tasks">
43
+ <a href="Classes.html">Classes</a>
44
+ <ul class="nav-chapters">
45
+ <li class="nav-chapter">
46
+ <a href="Classes/Manager.html">Manager</a>
47
+ </li>
48
+ <li class="nav-chapter">
49
+ <a href="Classes/Request.html">Request</a>
50
+ </li>
51
+ </ul>
52
+ </li>
53
+ <li class="part-name tasks">
54
+ <a href="Global Variables.html">Global Variables</a>
55
+ <ul class="nav-chapters">
56
+ <li class="nav-chapter">
57
+ <a href="Global Variables.html#/s:v9Alamofire20AlamofireErrorDomainSS">AlamofireErrorDomain</a>
58
+ </li>
59
+ </ul>
60
+ </li>
61
+ <li class="part-name tasks">
62
+ <a href="Enums.html">Enums</a>
63
+ <ul class="nav-chapters">
64
+ <li class="nav-chapter">
65
+ <a href="Enums.html#/s:O9Alamofire6Method">Method</a>
66
+ </li>
67
+ <li class="nav-chapter">
68
+ <a href="Enums/ParameterEncoding.html">ParameterEncoding</a>
69
+ </li>
70
+ </ul>
71
+ </li>
72
+ <li class="part-name tasks">
73
+ <a href="Extensions.html">Extensions</a>
74
+ <ul class="nav-chapters">
75
+ <li class="nav-chapter">
76
+ <a href="Extensions.html#/s:SS">String</a>
77
+ </li>
78
+ <li class="nav-chapter">
79
+ <a href="Extensions.html#/c:objc(cs)NSURLRequest">NSURLRequest</a>
80
+ </li>
81
+ <li class="nav-chapter">
82
+ <a href="Extensions.html#/c:objc(cs)NSURLRequest">NSURLRequest</a>
83
+ </li>
84
+ <li class="nav-chapter">
85
+ <a href="Extensions/Request.html">Request</a>
86
+ </li>
87
+ <li class="nav-chapter">
88
+ <a href="Extensions/Manager.html">Manager</a>
89
+ </li>
90
+ <li class="nav-chapter">
91
+ <a href="Extensions.html#/s:C9Alamofire7Request">Request</a>
92
+ </li>
93
+ <li class="nav-chapter">
94
+ <a href="Extensions/Manager.html">Manager</a>
95
+ </li>
96
+ <li class="nav-chapter">
97
+ <a href="Extensions/Request.html">Request</a>
98
+ </li>
99
+ <li class="nav-chapter">
100
+ <a href="Extensions/Request.html">Request</a>
101
+ </li>
102
+ <li class="nav-chapter">
103
+ <a href="Extensions/Request.html">Request</a>
104
+ </li>
105
+ <li class="nav-chapter">
106
+ <a href="Extensions/Request.html">Request</a>
107
+ </li>
108
+ <li class="nav-chapter">
109
+ <a href="Extensions/Request.html">Request</a>
110
+ </li>
111
+ <li class="nav-chapter">
112
+ <a href="Extensions/Request.html">Request</a>
113
+ </li>
114
+ </ul>
115
+ </li>
116
+ <li class="part-name tasks">
117
+ <a href="Functions.html">Functions</a>
118
+ <ul class="nav-chapters">
119
+ <li class="nav-chapter">
120
+ <a href="Functions.html#/s:F9Alamofire7requestFTOS_6MethodPS_20URLStringConvertible_10parametersGSqGVSs10DictionarySSPSs9AnyObject___8encodingOS_17ParameterEncoding_CS_7Request">request(_:_:parameters:encoding:)</a>
121
+ </li>
122
+ <li class="nav-chapter">
123
+ <a href="Functions.html#/s:F9Alamofire7requestFPS_21URLRequestConvertible_CS_7Request">request(_:)</a>
124
+ </li>
125
+ <li class="nav-chapter">
126
+ <a href="Functions.html#/s:F9Alamofire6uploadFTOS_6MethodPS_20URLStringConvertible_CSo5NSURL_CS_7Request">upload(_:_:_:)</a>
127
+ </li>
128
+ <li class="nav-chapter">
129
+ <a href="Functions.html#/s:F9Alamofire6uploadFTPS_21URLRequestConvertible_CSo5NSURL_CS_7Request">upload(_:_:)</a>
130
+ </li>
131
+ <li class="nav-chapter">
132
+ <a href="Functions.html#/s:F9Alamofire6uploadFTOS_6MethodPS_20URLStringConvertible_CSo6NSData_CS_7Request">upload(_:_:_:)</a>
133
+ </li>
134
+ <li class="nav-chapter">
135
+ <a href="Functions.html#/s:F9Alamofire6uploadFTPS_21URLRequestConvertible_CSo6NSData_CS_7Request">upload(_:_:)</a>
136
+ </li>
137
+ <li class="nav-chapter">
138
+ <a href="Functions.html#/s:F9Alamofire6uploadFTOS_6MethodPS_20URLStringConvertible_CSo13NSInputStream_CS_7Request">upload(_:_:_:)</a>
139
+ </li>
140
+ <li class="nav-chapter">
141
+ <a href="Functions.html#/s:F9Alamofire6uploadFTPS_21URLRequestConvertible_CSo13NSInputStream_CS_7Request">upload(_:_:)</a>
142
+ </li>
143
+ <li class="nav-chapter">
144
+ <a href="Functions.html#/s:F9Alamofire8downloadFTOS_6MethodPS_20URLStringConvertible_FTCSo5NSURLCSo17NSHTTPURLResponse_S2__CS_7Request">download(_:_:_:)</a>
145
+ </li>
146
+ <li class="nav-chapter">
147
+ <a href="Functions.html#/s:F9Alamofire8downloadFTPS_21URLRequestConvertible_FTCSo5NSURLCSo17NSHTTPURLResponse_S1__CS_7Request">download(_:_:)</a>
148
+ </li>
149
+ <li class="nav-chapter">
150
+ <a href="Functions.html#/s:F9Alamofire8downloadFT10resumeDataCSo6NSDataFTCSo5NSURLCSo17NSHTTPURLResponse_S1__CS_7Request">download(resumeData:_:)</a>
151
+ </li>
152
+ </ul>
153
+ </li>
154
+ <li class="part-name tasks">
155
+ <a href="Protocols.html">Protocols</a>
156
+ <ul class="nav-chapters">
157
+ <li class="nav-chapter">
158
+ <a href="Protocols/URLStringConvertible.html">URLStringConvertible</a>
159
+ </li>
160
+ <li class="nav-chapter">
161
+ <a href="Protocols/URLRequestConvertible.html">URLRequestConvertible</a>
162
+ </li>
163
+ </ul>
164
+ </li>
165
+ </ul>
166
+ </nav>
167
+ <div class="pixel-line"></div>
168
+ <div class="rubber-band-gap"></div>
169
+ <article class="chapter">
170
+ <a name="/"></a>
171
+ <h1 class="chapter-name">Classes</h1>
172
+ <section>
173
+ <section class="section">
174
+ <p class="para">The following classes are available globally.</p>
175
+ </section>
176
+ <section class="section task-group-section">
177
+ <div class="task-group">
178
+ <div class="task-name-container">
179
+ <hr/>
180
+ <a name="/Unnamed"></a>
181
+
182
+ </div>
183
+ <ul class="task-group-list">
184
+ <li class="item symbol">
185
+ <div class="task-group-term">
186
+ <code>
187
+ <a name="/s:C9Alamofire7Manager">
188
+ <a name="//apple_ref/swift/Class/Manager" class="dashAnchor"></a>
189
+ <a class="x-instance-method Swift" href="#/s:C9Alamofire7Manager">Manager</a>
190
+ </code>
191
+ </div>
192
+ <div class="height-container">
193
+ <div class="pointy-thing-container"></div>
194
+ <section class="section instance-method">
195
+ <div class="pointy-thing"></div>
196
+ <div class="abstract">
197
+ <p class="para">Responsible for creating and managing <code>Request</code> objects, as well as their underlying <code>NSURLSession</code>.</p>
198
+ <a href="Classes/Manager.html" class="see-more">See more</a>
199
+ </div>
200
+ <div class="declaration">
201
+ <h4>Declaration</h4>
202
+
203
+ <div class="Swift">
204
+ <p class="aside-title">Swift</p>
205
+ <pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">Manager</span></code></pre>
206
+
207
+ </div>
208
+ </div>
209
+ <div class="result-description view-on-github">
210
+ <a href="https://github.com/Alamofire/Alamofire/blob/1.1.0/Source/Alamofire.swift#L215">Show on GitHub</a>
211
+ </div>
212
+ </section>
213
+ </div>
214
+ </li>
215
+ </ul>
216
+ </div>
217
+ <div class="task-group">
218
+ <div class="task-name-container">
219
+ <hr/>
220
+ <a name="/Unnamed2"></a>
221
+
222
+ </div>
223
+ <ul class="task-group-list">
224
+ <li class="item symbol">
225
+ <div class="task-group-term">
226
+ <code>
227
+ <a name="/s:C9Alamofire7Request">
228
+ <a name="//apple_ref/swift/Class/Request" class="dashAnchor"></a>
229
+ <a class="x-instance-method Swift" href="#/s:C9Alamofire7Request">Request</a>
230
+ </code>
231
+ </div>
232
+ <div class="height-container">
233
+ <div class="pointy-thing-container"></div>
234
+ <section class="section instance-method">
235
+ <div class="pointy-thing"></div>
236
+ <div class="abstract">
237
+ <p class="para">Responsible for sending a request and receiving the response and associated data from the server, as well as managing its underlying <code>NSURLSessionTask</code>.</p>
238
+ <a href="Classes/Request.html" class="see-more">See more</a>
239
+ </div>
240
+ <div class="declaration">
241
+ <h4>Declaration</h4>
242
+
243
+ <div class="Swift">
244
+ <p class="aside-title">Swift</p>
245
+ <pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">Request</span></code></pre>
246
+
247
+ </div>
248
+ </div>
249
+ <div class="result-description view-on-github">
250
+ <a href="https://github.com/Alamofire/Alamofire/blob/1.1.0/Source/Alamofire.swift#L522">Show on GitHub</a>
251
+ </div>
252
+ </section>
253
+ </div>
254
+ </li>
255
+ </ul>
256
+ </div>
257
+ </section>
258
+ </section>
259
+ <section id="footer">
260
+ <p class="copyright">&copy; YYYY <a class="link" href="https://nshipster.com/alamofire" target="_blank" rel="external">Alamofire</a>. All rights reserved. (Last updated: YYYY-MM-DD)</p>
261
+ <p class="copyright">Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ vX.X.X</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
262
+ </section>
263
+ </article>
264
+ </div>
265
+ </body>
266
+ </div>
267
+ </html>