lib/jazzy/config.rb in jazzy-0.9.2 vs lib/jazzy/config.rb in jazzy-0.9.3
- old
+ new
@@ -178,13 +178,16 @@
config_attr :swift_version,
command_line: '--swift-version VERSION',
default: nil,
parse: ->(v) do
- return nil if v.to_s.empty?
- raise 'jazzy only supports Swift 2.0 or later.' if v.to_f < 2
- v
+ if v.to_s.empty?
+ nil
+ else
+ raise 'jazzy only supports Swift 2.0 or later.' if v.to_f < 2
+ v
+ end
end
# ──────── Metadata ────────
config_attr :author_name,
@@ -192,11 +195,11 @@
description: 'Name of author to attribute in docs (e.g. Realm)',
default: ''
config_attr :author_url,
command_line: ['-u', '--author_url URL'],
- description: 'Author URL of this project (e.g. http://realm.io)',
+ description: 'Author URL of this project (e.g. https://realm.io)',
default: '',
parse: ->(u) { URI(u) }
config_attr :module_name,
command_line: ['-m', '--module MODULE_NAME'],
@@ -250,11 +253,11 @@
parse: ->(r) { URI(r) }
config_attr :dash_url,
command_line: ['-d', '--dash_url URL'],
description: 'Location of the dash XML feed '\
- 'e.g. http://realm.io/docsets/realm.xml)',
+ 'e.g. https://realm.io/docsets/realm.xml)',
parse: ->(d) { URI(d) }
config_attr :github_url,
command_line: ['-g', '--github_url URL'],
description: 'GitHub URL of this project (e.g. '\
@@ -300,26 +303,30 @@
config_attr :custom_categories,
description: ['Custom navigation categories to replace the standard '\
'“Classes, Protocols, etc.”', 'Types not explicitly named '\
'in a custom category appear in generic groups at the end.',
- 'Example: http://git.io/v4Bcp'],
+ 'Example: https://git.io/v4Bcp'],
default: []
config_attr :custom_head,
command_line: '--head HTML',
description: 'Custom HTML to inject into <head></head>.',
default: ''
+ BUILTIN_THEME_DIR = Pathname(__FILE__).parent + 'themes'
+ BUILTIN_THEMES = BUILTIN_THEME_DIR.children(false).map(&:to_s)
+
config_attr :theme_directory,
- command_line: '--theme [apple | fullwidth | jony | DIRPATH]',
+ command_line: "--theme [#{BUILTIN_THEMES.join(' | ')} | DIRPATH]",
description: "Which theme to use. Specify either 'apple' (default), "\
- "'fullwidth', 'jony' or the path to your mustache " \
- 'templates and other assets for a custom theme.',
+ 'one of the other built-in theme names, or the path to '\
+ 'your mustache templates and other assets for a custom '\
+ 'theme.',
default: 'apple',
parse: ->(t) do
- if %w[apple fullwidth].include?(t)
- Pathname(__FILE__).parent + 'themes' + t
+ if BUILTIN_THEMES.include?(t)
+ BUILTIN_THEME_DIR + t
else
expand_path(t)
end
end