jazzy 0.0.15 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7cb0dbb4a6f3cd950cce91c753acf09742ae0912
4
- data.tar.gz: be7cdc331cb23ad0fe1d8bc16f8f37c4fc61ea50
3
+ metadata.gz: 91c1b5381e39fcf3979fcdf3f441a9afa3c6346f
4
+ data.tar.gz: 65736a28e4fc270646fdf7cd9be491953339634e
5
5
  SHA512:
6
- metadata.gz: 511a552ddd739da369ce55affe2b4bac8afe8fc21b0e83c9fee2e928ed2f22b64245a60691c93ffbb5f016d240dac18a9b7b2433df2ec3d50807ad893f33c568
7
- data.tar.gz: f7ab8a26bc341ea31cb5d0e4d17f32c5e34eada4f699feb2bfa0a2c09b84e64a45ca5636ab4ac806fcce82e22fc4fd61f3ef87207837dd298031dc88f6ebe852
6
+ metadata.gz: cd122d28d2e16768fe6165f099998c8c1afadcf02798278d00300151762b7b43d4c17ac6f6cf56f553a0cc3cfaf0ae42211bb31d224626096c6b0b66879e03fc
7
+ data.tar.gz: dd4a094146d32a3a7c61c571ededa504acdaf58df5fcfbc6546321d3291d73d6c997c039d78cb55258e64a35cad0ab5a195720a44ccaf15ba0cd1f576a53cd4d
@@ -1,13 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jazzy (0.0.15)
4
+ jazzy (0.0.16)
5
5
  activesupport (~> 4.1)
6
6
  mustache (~> 0.99)
7
7
  nokogiri (~> 1.6)
8
8
  redcarpet (~> 3.2)
9
9
  rouge (~> 1.5)
10
10
  sass (~> 3.4)
11
+ sqlite3 (~> 1.3)
11
12
 
12
13
  GEM
13
14
  remote: http://rubygems.org/
@@ -40,7 +41,7 @@ GEM
40
41
  mocha-on-bacon (0.2.2)
41
42
  mocha (>= 0.13.0)
42
43
  mustache (0.99.7)
43
- nokogiri (1.6.4.1)
44
+ nokogiri (1.6.5)
44
45
  mini_portile (~> 0.6.0)
45
46
  parser (2.2.0.pre.5)
46
47
  ast (>= 1.1, < 3.0)
@@ -50,8 +51,8 @@ GEM
50
51
  bacon (~> 1.2)
51
52
  rainbow (2.0.0)
52
53
  rake (10.3.2)
53
- redcarpet (3.2.0)
54
- rouge (1.7.3)
54
+ redcarpet (3.2.1)
55
+ rouge (1.7.4)
55
56
  rubocop (0.26.1)
56
57
  astrolabe (~> 1.3)
57
58
  parser (>= 2.2.0.pre.4, < 3.0)
@@ -60,8 +61,9 @@ GEM
60
61
  ruby-progressbar (~> 1.4)
61
62
  ruby-progressbar (1.6.0)
62
63
  safe_yaml (1.0.4)
63
- sass (3.4.8)
64
+ sass (3.4.9)
64
65
  slop (3.6.0)
66
+ sqlite3 (1.3.10)
65
67
  thread_safe (0.3.4)
66
68
  tzinfo (1.2.2)
67
69
  thread_safe (~> 0.1)
data/Rakefile CHANGED
@@ -52,6 +52,8 @@ begin
52
52
  files_to_delete = FileList[files_glob]
53
53
  .exclude('spec/integration_specs/*/after/docs',
54
54
  'spec/integration_specs/*/after/execution_output.txt')
55
+ .include('**/*.dsidx')
56
+ .include('**/*.tgz')
55
57
  files_to_delete.each do |file_to_delete|
56
58
  sh "rm -rf '#{file_to_delete}'"
57
59
  end
data/bin/jazzy CHANGED
@@ -12,4 +12,4 @@ end
12
12
 
13
13
  require 'jazzy'
14
14
 
15
- Jazzy::DocBuilder.build(Jazzy::Config.parse!)
15
+ Jazzy::DocBuilder.build(Jazzy::Config.instance = Jazzy::Config.parse!)
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_runtime_dependency 'nokogiri', '~> 1.6'
24
24
  spec.add_runtime_dependency 'sass', '~> 3.4'
25
25
  spec.add_runtime_dependency 'rouge', '~> 1.5'
26
+ spec.add_runtime_dependency 'sqlite3', '~> 1.3'
26
27
 
27
28
  spec.add_development_dependency 'bundler', '~> 1.7'
28
29
  spec.add_development_dependency 'rake', '~> 10.3'
@@ -1 +1,2 @@
1
+ require 'jazzy/config'
1
2
  require 'jazzy/doc_builder'
@@ -0,0 +1,63 @@
1
+ /* Credit to https://gist.github.com/wataru420/2048287 */
2
+
3
+ .highlight {
4
+ .c { color: #999988; font-style: italic } /* Comment */
5
+ .err { color: #a61717; background-color: #e3d2d2 } /* Error */
6
+ .k { color: #000000; font-weight: bold } /* Keyword */
7
+ .o { color: #000000; font-weight: bold } /* Operator */
8
+ .cm { color: #999988; font-style: italic } /* Comment.Multiline */
9
+ .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
10
+ .c1 { color: #999988; font-style: italic } /* Comment.Single */
11
+ .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
12
+ .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
13
+ .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
14
+ .ge { color: #000000; font-style: italic } /* Generic.Emph */
15
+ .gr { color: #aa0000 } /* Generic.Error */
16
+ .gh { color: #999999 } /* Generic.Heading */
17
+ .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
18
+ .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
19
+ .go { color: #888888 } /* Generic.Output */
20
+ .gp { color: #555555 } /* Generic.Prompt */
21
+ .gs { font-weight: bold } /* Generic.Strong */
22
+ .gu { color: #aaaaaa } /* Generic.Subheading */
23
+ .gt { color: #aa0000 } /* Generic.Traceback */
24
+ .kc { color: #000000; font-weight: bold } /* Keyword.Constant */
25
+ .kd { color: #000000; font-weight: bold } /* Keyword.Declaration */
26
+ .kp { color: #000000; font-weight: bold } /* Keyword.Pseudo */
27
+ .kr { color: #000000; font-weight: bold } /* Keyword.Reserved */
28
+ .kt { color: #445588; font-weight: bold } /* Keyword.Type */
29
+ .m { color: #009999 } /* Literal.Number */
30
+ .s { color: #d14 } /* Literal.String */
31
+ .na { color: #008080 } /* Name.Attribute */
32
+ .nb { color: #0086B3 } /* Name.Builtin */
33
+ .nc { color: #445588; font-weight: bold } /* Name.Class */
34
+ .no { color: #008080 } /* Name.Constant */
35
+ .ni { color: #800080 } /* Name.Entity */
36
+ .ne { color: #990000; font-weight: bold } /* Name.Exception */
37
+ .nf { color: #990000; font-weight: bold } /* Name.Function */
38
+ .nn { color: #555555 } /* Name.Namespace */
39
+ .nt { color: #000080 } /* Name.Tag */
40
+ .nv { color: #008080 } /* Name.Variable */
41
+ .ow { color: #000000; font-weight: bold } /* Operator.Word */
42
+ .w { color: #bbbbbb } /* Text.Whitespace */
43
+ .mf { color: #009999 } /* Literal.Number.Float */
44
+ .mh { color: #009999 } /* Literal.Number.Hex */
45
+ .mi { color: #009999 } /* Literal.Number.Integer */
46
+ .mo { color: #009999 } /* Literal.Number.Oct */
47
+ .sb { color: #d14 } /* Literal.String.Backtick */
48
+ .sc { color: #d14 } /* Literal.String.Char */
49
+ .sd { color: #d14 } /* Literal.String.Doc */
50
+ .s2 { color: #d14 } /* Literal.String.Double */
51
+ .se { color: #d14 } /* Literal.String.Escape */
52
+ .sh { color: #d14 } /* Literal.String.Heredoc */
53
+ .si { color: #d14 } /* Literal.String.Interpol */
54
+ .sx { color: #d14 } /* Literal.String.Other */
55
+ .sr { color: #009926 } /* Literal.String.Regex */
56
+ .s1 { color: #d14 } /* Literal.String.Single */
57
+ .ss { color: #990073 } /* Literal.String.Symbol */
58
+ .bp { color: #999999 } /* Name.Builtin.Pseudo */
59
+ .vc { color: #008080 } /* Name.Variable.Class */
60
+ .vg { color: #008080 } /* Name.Variable.Global */
61
+ .vi { color: #008080 } /* Name.Variable.Instance */
62
+ .il { color: #009999 } /* Literal.Number.Integer.Long */
63
+ }
@@ -1,4 +1,5 @@
1
1
  $doc_coverage_color: #999;
2
+ $content_wrapper_width: 980px;
2
3
 
3
4
  html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td {
4
5
  background: transparent;
@@ -11,6 +12,12 @@ html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr
11
12
  }
12
13
 
13
14
  #reference {
15
+ .declaration .Swift pre {
16
+ // Ensure that declarations wrap, as they're a single line
17
+ white-space: pre-wrap;
18
+ font-size: 140%;
19
+ }
20
+
14
21
  .x-instance-method.Swift {
15
22
  margin-left: 15px;
16
23
  }
@@ -233,7 +240,7 @@ a[name] {
233
240
  .content-wrapper {
234
241
  background-color: rgba(242, 242, 242, 1);
235
242
  margin: 0 auto;
236
- width: 980px;
243
+ width: $content_wrapper_width;
237
244
  }
238
245
 
239
246
  .pixel-line {
@@ -848,3 +855,22 @@ td {
848
855
  }
849
856
  }
850
857
  }
858
+
859
+ html.dash {
860
+ .book-parts {
861
+ display: none;
862
+ width: 0;
863
+ }
864
+ .chapter {
865
+ width: $content_wrapper_width;
866
+ margin-left: 0;
867
+ }
868
+ #reference {
869
+ .height-container {
870
+ display: block;
871
+ }
872
+ .x-instance-method {
873
+ margin-left: 0;
874
+ }
875
+ }
876
+ }
@@ -1,10 +1,16 @@
1
1
  // On doc load, toggle the URL hash discussion if present
2
2
  $(document).ready(function() {
3
- var linkToHash = $('a[href="' + window.location.hash +'"]');
4
- linkToHash.trigger("click");
3
+ if (!window.jazzy.docset) {
4
+ var linkToHash = $('a[href="' + window.location.hash +'"]');
5
+ linkToHash.trigger("click");
6
+ }
5
7
  });
8
+
6
9
  // On x-instance-method click, toggle its discussion and animate token.marginLeft
7
10
  $(".x-instance-method").click(function() {
11
+ if (window.jazzy.docset) {
12
+ return;
13
+ }
8
14
  var link = $(this);
9
15
  var animationDuration = 300;
10
16
  var tokenOffset = "15px";
@@ -14,6 +14,7 @@ module Jazzy
14
14
  attr_accessor :sourcekitten_sourcefile
15
15
  attr_accessor :clean
16
16
  attr_accessor :readme_path
17
+ attr_accessor :docset_platform
17
18
 
18
19
  def initialize
19
20
  self.output = Pathname('docs')
@@ -26,6 +27,7 @@ module Jazzy
26
27
  self.dash_url = nil
27
28
  self.sourcekitten_sourcefile = nil
28
29
  self.clean = false
30
+ self.docset_platform = 'jazzy'
29
31
  end
30
32
 
31
33
  # rubocop:disable Metrics/MethodLength
@@ -103,5 +105,35 @@ module Jazzy
103
105
 
104
106
  config
105
107
  end
108
+
109
+ #-------------------------------------------------------------------------#
110
+
111
+ # @!group Singleton
112
+
113
+ # @return [Config] the current config instance creating one if needed.
114
+ #
115
+ def self.instance
116
+ @instance ||= new
117
+ end
118
+
119
+ # Sets the current config instance. If set to nil the config will be
120
+ # recreated when needed.
121
+ #
122
+ # @param [Config, Nil] the instance.
123
+ #
124
+ # @return [void]
125
+ #
126
+ class << self
127
+ attr_writer :instance
128
+ end
129
+
130
+ # Provides support for accessing the configuration instance in other
131
+ # scopes.
132
+ #
133
+ module Mixin
134
+ def config
135
+ Config.instance
136
+ end
137
+ end
106
138
  end
107
139
  end
@@ -3,12 +3,26 @@
3
3
  <head>
4
4
  <title>{{name}} {{kind}} Reference</title>
5
5
  <link rel="stylesheet" type="text/css" href="{{path_to_root}}css/jazzy.css" />
6
- <link rel="stylesheet" type="text/css" href="{{path_to_root}}css/github_syntax_highlighting.css" />
6
+ <link rel="stylesheet" type="text/css" href="{{path_to_root}}css/highlight.css" />
7
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>
8
19
  <script src="{{path_to_root}}js/jquery.min.js" defer></script>
9
20
  <script src="{{path_to_root}}js/jazzy.js" defer></script>
10
21
  </head>
11
22
  <body id="reference" class="Swift">
23
+ {{#dash_type}}
24
+ <a name="//apple_ref/swift/{{dash_type}}/{{name}}" class="dashAnchor"></a>
25
+ {{/dash_type}}
12
26
  <a title="{{name}} {{kind}} Reference"></a>
13
27
  <header>
14
28
  <div class="content-wrapper">
@@ -6,6 +6,7 @@ require 'sass'
6
6
 
7
7
  require 'jazzy/config'
8
8
  require 'jazzy/doc'
9
+ require 'jazzy/docset_builder'
9
10
  require 'jazzy/jazzy_markdown'
10
11
  require 'jazzy/readme_generator'
11
12
  require 'jazzy/source_declaration'
@@ -63,24 +64,28 @@ module Jazzy
63
64
  # @param [String] output_dir Root directory to write docs
64
65
  # @param [Array] docs Array of structured docs
65
66
  # @param [Config] options Build options
66
- # @param [Integer] depth Number of parents. Used to calculate path_to_root
67
- # for web.
68
67
  # @param [Array] doc_structure @see #doc_structure_for_docs
69
- def self.build_docs(output_dir, docs, source_module, depth)
70
- docs.each do |doc|
71
- next if doc.name != 'index' && doc.children.count == 0
72
- prepare_output_dir(output_dir, false)
73
- path = output_dir + "#{doc.name}.html"
68
+ def self.build_docs(output_dir, docs, source_module)
69
+ each_doc(output_dir, docs) do |doc, path, depth|
70
+ prepare_output_dir(path.parent, false)
74
71
  path_to_root = ['../'].cycle(depth).to_a.join('')
75
72
  path.open('w') do |file|
76
73
  file.write(document(source_module, doc, path_to_root))
77
74
  end
75
+ end
76
+ end
77
+
78
+ def self.each_doc(output_dir, docs, depth = 0, &block)
79
+ docs.each do |doc|
80
+ next if doc.name != 'index' && doc.children.count == 0
81
+ path = output_dir + "#{doc.name}.html"
82
+ block.call(doc, path, depth)
78
83
  next if doc.name == 'index'
79
- build_docs(
84
+ each_doc(
80
85
  output_dir + doc.name,
81
86
  doc.children,
82
- source_module,
83
87
  depth + 1,
88
+ &block
84
89
  )
85
90
  end
86
91
  end
@@ -96,13 +101,18 @@ module Jazzy
96
101
 
97
102
  structure = doc_structure_for_docs(docs)
98
103
 
99
- docs << SourceDeclaration.new.tap { |sd| sd.name = 'index' }
104
+ docs << SourceDeclaration.new.tap do |sd|
105
+ sd.name = 'index'
106
+ sd.children = []
107
+ end
100
108
 
101
109
  source_module = SourceModule.new(options, docs, structure, coverage)
102
- build_docs(output_dir, source_module.docs, source_module, 0)
110
+ build_docs(output_dir, source_module.docs, source_module)
103
111
 
104
112
  copy_assets(output_dir)
105
113
 
114
+ DocsetBuilder.new(output_dir, source_module).build!
115
+
106
116
  puts "jam out ♪♫ to your fresh new docs in `#{output_dir}`"
107
117
  end
108
118
 
@@ -161,6 +171,7 @@ module Jazzy
161
171
  abstract: Jazzy.markdown.render(abstract),
162
172
  declaration: item.declaration,
163
173
  usr: item.usr,
174
+ dash_type: item.type.dash_type,
164
175
  }
165
176
  gh_token_url = gh_token_url(item, source_module)
166
177
  item_render[:github_token_url] = gh_token_url
@@ -215,7 +226,8 @@ module Jazzy
215
226
  doc = Doc.new # Mustache model instance
216
227
  doc[:doc_coverage] = source_module.doc_coverage
217
228
  doc[:name] = doc_model.name
218
- doc[:kind] = doc_model.kindName
229
+ doc[:kind] = doc_model.type.name
230
+ doc[:dash_type] = doc_model.type.dash_type
219
231
  doc[:overview] = Jazzy.markdown.render(doc_model.abstract || '')
220
232
  doc[:structure] = source_module.doc_structure
221
233
  doc[:tasks] = render_tasks(source_module, doc_model.children)
@@ -0,0 +1,77 @@
1
+ require 'mustache'
2
+ require 'sqlite3'
3
+
4
+ module Jazzy
5
+ module DocBuilder
6
+ # Follows the instructions found at http://kapeli.com/docsets#dashDocset.
7
+ class DocsetBuilder
8
+ include Config::Mixin
9
+
10
+ attr_reader :output_dir
11
+ attr_reader :source_module
12
+ attr_reader :docset_dir
13
+ attr_reader :documents_dir
14
+
15
+ def initialize(output_dir, source_module)
16
+ @output_dir = output_dir
17
+ @source_module = source_module
18
+ @docset_dir = output_dir + "#{source_module.name}.docset"
19
+ @documents_dir = docset_dir + 'Contents/Resources/Documents/'
20
+ end
21
+
22
+ def build!
23
+ docset_dir.rmtree if docset_dir.exist?
24
+ copy_docs
25
+ write_plist
26
+ create_index
27
+ create_archive
28
+ end
29
+
30
+ private
31
+
32
+ def write_plist
33
+ info_plist_path = docset_dir + 'Contents/Info.plist'
34
+ info_plist_path.open('w') do |plist|
35
+ template = Pathname(__dir__) + 'docset_builder/info_plist.mustache'
36
+ plist << Mustache.render(
37
+ template.read,
38
+ bundle_identifier: source_module.name.downcase,
39
+ name: source_module.name,
40
+ platform_family: config.docset_platform,
41
+ )
42
+ end
43
+ end
44
+
45
+ def create_archive
46
+ target = "#{source_module.name}.tgz"
47
+ source = docset_dir.basename.to_s
48
+ options = {
49
+ chdir: output_dir.to_s,
50
+ [1, 2] => '/dev/null', # silence all output from `tar`
51
+ }
52
+ system('tar', "--exclude='.DS_Store'", '-cvzf', target, source, options)
53
+ end
54
+
55
+ def copy_docs
56
+ files_to_copy = Dir.glob(output_dir + '**/*')
57
+
58
+ FileUtils.mkdir_p documents_dir
59
+ FileUtils.cp_r files_to_copy, documents_dir
60
+ end
61
+
62
+ def create_index
63
+ search_index_path = docset_dir + 'Contents/Resources/docSet.dsidx'
64
+ SQLite3::Database.new(search_index_path.to_s) do |db|
65
+ db.execute('CREATE TABLE searchIndex(' \
66
+ 'id INTEGER PRIMARY KEY, name TEXT, type TEXT, path TEXT);')
67
+ db.execute('CREATE UNIQUE INDEX anchor ON ' \
68
+ 'searchIndex (name, type, path);')
69
+ source_module.all_declarations.select(&:type).each do |doc|
70
+ db.execute('INSERT OR IGNORE INTO searchIndex(name, type, path) ' \
71
+ 'VALUES (?, ?, ?);', [doc.name, doc.type.dash_type, doc.url])
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end