lib/jazzy/config.rb in jazzy-0.4.1 vs lib/jazzy/config.rb in jazzy-0.5.0
- old
+ new
@@ -103,10 +103,15 @@
config_attr :framework_root,
command_line: '--framework-root PATH',
description: 'The root path to your Objective-C framework.',
parse: ->(fr) { expand_path(fr) }
+ config_attr :sdk,
+ command_line: '--sdk [iphone|watch|appletv][os|simulator]|macosx',
+ description: 'The SDK for which your code should be built.',
+ default: 'macosx'
+
config_attr :config_file,
command_line: '--config PATH',
description: ['Configuration file (.yaml or .json)',
'Default: .jazzy.yaml in source directory or ancestor'],
parse: ->(cf) { expand_path(cf) }
@@ -135,11 +140,15 @@
Array(files).map { |f| expand_path(f) }
end
config_attr :swift_version,
command_line: '--swift-version VERSION',
- default: '2.1'
+ default: '2.1.1',
+ parse: ->(v) do
+ raise 'jazzy only supports Swift 2.0 or later.' if v.to_f < 2
+ v
+ end
# ──────── Metadata ────────
config_attr :author_name,
command_line: ['-a', '--author AUTHOR_NAME'],
@@ -236,33 +245,50 @@
'“Classes, Protocols, etc.”', 'Types not explicitly named '\
'in a custom category appear in generic groups at the end.',
'Example: http://git.io/v4Bcp'],
default: []
+ config_attr :custom_head,
+ command_line: '--head HTML',
+ description: 'Custom HTML to inject into <head></head>.',
+ default: ''
+
+ config_attr :theme_directory,
+ command_line: '--theme [apple | fullwidth | DIRPATH]',
+ description: "Which theme to use. Specify either 'apple' (default), "\
+ "'fullwidth' or the path to your mustache templates and " \
+ 'other assets for a custom theme.',
+ default: 'apple',
+ parse: ->(t) do
+ return expand_path(t) unless t == 'apple' || t == 'fullwidth'
+ Pathname(__FILE__).parent + 'themes' + t
+ end
+
config_attr :template_directory,
command_line: ['-t', '--template-directory DIRPATH'],
- description: 'The directory that contains the mustache templates to use',
- default: Pathname(__FILE__).parent + 'templates',
- parse: ->(td) { expand_path(td) }
+ description: 'DEPRECATED: Use --theme instead.',
+ parse: ->(_) do
+ raise '--template-directory (-t) is deprecated: use --theme instead.'
+ end
config_attr :assets_directory,
command_line: '--assets-directory DIRPATH',
- description: 'The directory that contains the assets (CSS, JS, images) '\
- 'used by the templates',
- default: Pathname(__FILE__).parent + 'assets',
- parse: ->(ad) { expand_path(ad) }
+ description: 'DEPRECATED: Use --theme instead.',
+ parse: ->(_) do
+ raise '--assets-directory is deprecated: use --theme instead.'
+ end
# rubocop:enable Style/AlignParameters
def initialize
self.class.all_config_attrs.each do |attr|
attr.set_to_default(self)
end
end
- def template_directory=(template_directory)
- @template_directory = template_directory
- Doc.template_path = template_directory
+ def theme_directory=(theme_directory)
+ @theme_directory = theme_directory
+ Doc.template_path = theme_directory + 'templates'
end
# rubocop:disable Metrics/MethodLength
def self.parse!
config = new