Class: Jazzy::DocBuilder::DocsetBuilder

Inherits:
Object
  • Object
show all
Includes:
Config::Mixin
Defined in:
lib/jazzy/docset_builder.rb

Overview

Follows the instructions found at kapeli.com/docsets#dashDocset.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Config::Mixin

#config

Constructor Details

#initialize(generated_docs_dir) ⇒ DocsetBuilder

Returns a new instance of DocsetBuilder.



19
20
21
22
23
24
25
26
27
# File 'lib/jazzy/docset_builder.rb', line 19

def initialize(generated_docs_dir)
  @name = config.docset_title || config.module_names.first
  docset_path = config.docset_path ||
                "docsets/#{safe_name}.docset"
  @docset_dir = generated_docs_dir + docset_path
  @generated_docs_dir = generated_docs_dir
  @output_dir = docset_dir.parent
  @documents_dir = docset_dir + 'Contents/Resources/Documents/'
end

Instance Attribute Details

#docset_dirObject (readonly)

Returns the value of attribute docset_dir.



15
16
17
# File 'lib/jazzy/docset_builder.rb', line 15

def docset_dir
  @docset_dir
end

#documents_dirObject (readonly)

Returns the value of attribute documents_dir.



16
17
18
# File 'lib/jazzy/docset_builder.rb', line 16

def documents_dir
  @documents_dir
end

#generated_docs_dirObject (readonly)

Returns the value of attribute generated_docs_dir.



13
14
15
# File 'lib/jazzy/docset_builder.rb', line 13

def generated_docs_dir
  @generated_docs_dir
end

#nameObject (readonly)

Returns the value of attribute name.



17
18
19
# File 'lib/jazzy/docset_builder.rb', line 17

def name
  @name
end

#output_dirObject (readonly)

Returns the value of attribute output_dir.



12
13
14
# File 'lib/jazzy/docset_builder.rb', line 12

def output_dir
  @output_dir
end

#source_moduleObject (readonly)

Returns the value of attribute source_module.



14
15
16
# File 'lib/jazzy/docset_builder.rb', line 14

def source_module
  @source_module
end

Instance Method Details

#build!(all_declarations) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/jazzy/docset_builder.rb', line 29

def build!(all_declarations)
  docset_dir.rmtree if docset_dir.exist?
  copy_docs
  copy_icon if config.docset_icon
  write_plist
  create_index(all_declarations)
  create_archive
  create_xml if config.version && config.root_url
end

#dash_feed_urlObject

The dash-feed:// URL that links from the Dash icon in generated docs. This is passed to the Dash app and encodes the actual web ‘dash_url` where the user has placed the XML file.

Unfortunately for historical reasons this is also called the ‘dash_url’ where it appears in mustache templates and so on.



123
124
125
126
127
# File 'lib/jazzy/docset_builder.rb', line 123

def dash_feed_url
  dash_url&.then do |url|
    "dash-feed://#{ERB::Util.url_encode(url.to_s)}"
  end
end