Class: Jazzy::Config
- Inherits:
-
Object
- Object
- Jazzy::Config
- Defined in:
- lib/jazzy/config.rb
Overview
rubocop:disable Metrics/ClassLength
Defined Under Namespace
Modules: Mixin
Singleton collapse
-
.instance ⇒ Config
The current config instance creating one if needed.
Instance Attribute Summary collapse
-
#author_name ⇒ Object
Returns the value of attribute author_name.
-
#author_url ⇒ Object
Returns the value of attribute author_url.
-
#clean ⇒ Object
Returns the value of attribute clean.
-
#dash_url ⇒ Object
Returns the value of attribute dash_url.
-
#docset_icon ⇒ Object
Returns the value of attribute docset_icon.
-
#docset_path ⇒ Object
Returns the value of attribute docset_path.
-
#docset_platform ⇒ Object
Returns the value of attribute docset_platform.
-
#excluded_files ⇒ Object
Returns the value of attribute excluded_files.
-
#github_file_prefix ⇒ Object
Returns the value of attribute github_file_prefix.
-
#github_url ⇒ Object
Returns the value of attribute github_url.
-
#min_acl ⇒ Object
Returns the value of attribute min_acl.
-
#module_name ⇒ Object
Returns the value of attribute module_name.
-
#output ⇒ Object
Returns the value of attribute output.
-
#podspec ⇒ Object
Returns the value of attribute podspec.
-
#readme_path ⇒ Object
Returns the value of attribute readme_path.
-
#root_url ⇒ Object
Returns the value of attribute root_url.
-
#skip_undocumented ⇒ Object
Returns the value of attribute skip_undocumented.
-
#source_directory ⇒ Object
Returns the value of attribute source_directory.
-
#sourcekitten_sourcefile ⇒ Object
Returns the value of attribute sourcekitten_sourcefile.
-
#swift_version ⇒ Object
Returns the value of attribute swift_version.
-
#template_directory ⇒ Object
Returns the value of attribute template_directory.
-
#version ⇒ Object
Returns the value of attribute version.
-
#xcodebuild_arguments ⇒ Object
Returns the value of attribute xcodebuild_arguments.
Class Method Summary collapse
-
.parse! ⇒ Object
rubocop:disable Metrics/MethodLength.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/jazzy/config.rb', line 36 def initialize PodspecDocumenter.configure(self, Dir['*.podspec{,.json}'].first) self.output = Pathname('docs') self.xcodebuild_arguments = [] self. = '' self.module_name = '' self. = URI('') self.clean = false self.docset_platform = 'jazzy' self.version = '1.0' self.min_acl = SourceDeclaration::AccessControlLevel.public self.skip_undocumented = false self.source_directory = Pathname.pwd self.excluded_files = [] self.template_directory = Pathname(__FILE__).parent + 'templates' self.swift_version = '1.2' end |
Class Attribute Details
.instance ⇒ Config
Returns the current config instance creating one if needed.
213 214 215 |
# File 'lib/jazzy/config.rb', line 213 def self.instance @instance ||= new end |
Instance Attribute Details
#author_name ⇒ Object
Returns the value of attribute author_name.
14 15 16 |
# File 'lib/jazzy/config.rb', line 14 def @author_name end |
#author_url ⇒ Object
Returns the value of attribute author_url.
18 19 20 |
# File 'lib/jazzy/config.rb', line 18 def @author_url end |
#clean ⇒ Object
Returns the value of attribute clean.
21 22 23 |
# File 'lib/jazzy/config.rb', line 21 def clean @clean end |
#dash_url ⇒ Object
Returns the value of attribute dash_url.
19 20 21 |
# File 'lib/jazzy/config.rb', line 19 def dash_url @dash_url end |
#docset_icon ⇒ Object
Returns the value of attribute docset_icon.
29 30 31 |
# File 'lib/jazzy/config.rb', line 29 def docset_icon @docset_icon end |
#docset_path ⇒ Object
Returns the value of attribute docset_path.
30 31 32 |
# File 'lib/jazzy/config.rb', line 30 def docset_path @docset_path end |
#docset_platform ⇒ Object
Returns the value of attribute docset_platform.
23 24 25 |
# File 'lib/jazzy/config.rb', line 23 def docset_platform @docset_platform end |
#excluded_files ⇒ Object
Returns the value of attribute excluded_files.
32 33 34 |
# File 'lib/jazzy/config.rb', line 32 def excluded_files @excluded_files end |
#github_file_prefix ⇒ Object
Returns the value of attribute github_file_prefix.
17 18 19 |
# File 'lib/jazzy/config.rb', line 17 def github_file_prefix @github_file_prefix end |
#github_url ⇒ Object
Returns the value of attribute github_url.
16 17 18 |
# File 'lib/jazzy/config.rb', line 16 def github_url @github_url end |
#min_acl ⇒ Object
Returns the value of attribute min_acl.
26 27 28 |
# File 'lib/jazzy/config.rb', line 26 def min_acl @min_acl end |
#module_name ⇒ Object
Returns the value of attribute module_name.
15 16 17 |
# File 'lib/jazzy/config.rb', line 15 def module_name @module_name end |
#output ⇒ Object
Returns the value of attribute output.
12 13 14 |
# File 'lib/jazzy/config.rb', line 12 def output @output end |
#podspec ⇒ Object
Returns the value of attribute podspec.
28 29 30 |
# File 'lib/jazzy/config.rb', line 28 def podspec @podspec end |
#readme_path ⇒ Object
Returns the value of attribute readme_path.
22 23 24 |
# File 'lib/jazzy/config.rb', line 22 def readme_path @readme_path end |
#root_url ⇒ Object
Returns the value of attribute root_url.
24 25 26 |
# File 'lib/jazzy/config.rb', line 24 def root_url @root_url end |
#skip_undocumented ⇒ Object
Returns the value of attribute skip_undocumented.
27 28 29 |
# File 'lib/jazzy/config.rb', line 27 def skip_undocumented @skip_undocumented end |
#source_directory ⇒ Object
Returns the value of attribute source_directory.
31 32 33 |
# File 'lib/jazzy/config.rb', line 31 def source_directory @source_directory end |
#sourcekitten_sourcefile ⇒ Object
Returns the value of attribute sourcekitten_sourcefile.
20 21 22 |
# File 'lib/jazzy/config.rb', line 20 def sourcekitten_sourcefile @sourcekitten_sourcefile end |
#swift_version ⇒ Object
Returns the value of attribute swift_version.
34 35 36 |
# File 'lib/jazzy/config.rb', line 34 def swift_version @swift_version end |
#template_directory ⇒ Object
Returns the value of attribute template_directory.
33 34 35 |
# File 'lib/jazzy/config.rb', line 33 def template_directory @template_directory end |
#version ⇒ Object
Returns the value of attribute version.
25 26 27 |
# File 'lib/jazzy/config.rb', line 25 def version @version end |
#xcodebuild_arguments ⇒ Object
Returns the value of attribute xcodebuild_arguments.
13 14 15 |
# File 'lib/jazzy/config.rb', line 13 def xcodebuild_arguments @xcodebuild_arguments end |
Class Method Details
.parse! ⇒ Object
rubocop:disable Metrics/MethodLength
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/jazzy/config.rb', line 64 def self.parse! config = new OptionParser.new do |opt| opt. = 'Usage: jazzy' opt.separator '' opt.separator 'Options' opt.on('-o', '--output FOLDER', 'Folder to output the HTML docs to') do |output| config.output = Pathname(output) end opt.on('-c', '--[no-]clean', 'Delete contents of output directory before running.', 'WARNING: If --output is set to ~/Desktop, this will delete the \ ~/Desktop directory.') do |clean| config.clean = clean end opt.on('-x', '--xcodebuild-arguments arg1,arg2,…argN', Array, 'Arguments to forward to xcodebuild') do |args| config.xcodebuild_arguments = args end opt.on('-a', '--author AUTHOR_NAME', 'Name of author to attribute in docs (i.e. Realm)') do |a| config. = a end opt.on('-u', '--author_url URL', 'Author URL of this project (i.e. http://realm.io)') do |u| config. = URI(u) end opt.on('-m', '--module MODULE_NAME', 'Name of module being documented. (i.e. RealmSwift)') do |m| config.module_name = m end opt.on('-d', '--dash_url URL', 'Location of the dash XML feed \ (i.e. http://realm.io/docsets/realm.xml') do |d| config.dash_url = URI(d) end opt.on('-g', '--github_url URL', 'GitHub URL of this project (i.e. \ https://github.com/realm/realm-cocoa)') do |g| config.github_url = URI(g) end opt.on('--github-file-prefix PREFIX', 'GitHub URL file prefix of this project (i.e. \ https://github.com/realm/realm-cocoa/tree/v0.87.1)') do |g| config.github_file_prefix = g end opt.on('-s', '--sourcekitten-sourcefile FILEPATH', 'File generated from sourcekitten output to parse') do |s| config.sourcekitten_sourcefile = Pathname(s) end opt.on('-r', '--root-url URL', 'Absolute URL root where these docs will be stored') do |r| config.root_url = URI(r) if !config.dash_url && config.root_url config.dash_url = URI.join(r, "docsets/#{config.module_name}.xml") end end opt.on('--module-version VERSION', 'module version. will be used when generating docset') do |mv| config.version = mv end opt.on('--min-acl [private | internal | public]', 'minimum access control level to document \ (default is public)') do |acl| if acl == 'private' config.min_acl = SourceDeclaration::AccessControlLevel.private elsif acl == 'internal' config.min_acl = SourceDeclaration::AccessControlLevel.internal end end opt.on('--[no-]skip-undocumented', "Don't document declarations that have no documentation \ comments.", ) do |skip_undocumented| config.skip_undocumented = skip_undocumented end opt.on('--podspec FILEPATH') do |podspec| config.podspec = Pathname(podspec) end opt.on('--docset-icon FILEPATH') do |docset_icon| config.docset_icon = Pathname(docset_icon) end opt.on('--docset-path DIRPATH', 'The relative path for the generated ' \ 'docset') do |docset_path| config.docset_path = docset_path end opt.on('--source-directory DIRPATH', 'The directory that contains ' \ 'the source to be documented') do |source_directory| config.source_directory = Pathname(source_directory) end opt.on('t', '--template-directory DIRPATH', 'The directory that ' \ 'contains the mustache templates to use') do |template_directory| config.template_directory = Pathname(template_directory) end opt.on('--swift-version VERSION') do |swift_version| config.swift_version = swift_version end opt.on('--readme FILEPATH', 'The path to a markdown README file') do |readme| config.readme_path = Pathname(readme) end opt.on('-e', '--exclude file1,file2,…fileN', Array, 'Files to be excluded from documentation') do |files| config.excluded_files = files end opt.on('-v', '--version', 'Print version number') do puts 'jazzy version: ' + Jazzy::VERSION exit end opt.on('-h', '--help', 'Print this help message') do puts opt exit end end.parse! config end |