GBApplicationSettingsProvider Class Reference
| Inherits from | NSObject |
| Declared in | GBApplicationSettingsProvider.h GBApplicationSettingsProvider.m |
Overview
Main application settings provider.
This object implements GBApplicationStringsProviding interface and is used by GBAppledocApplication to prepare application-wide settings including factory defaults, global and session values. The main purpose of the class is to simplify GBAppledocApplication class by decoupling it from the actual settings providing implementation.
To create a new setting use the following check list to update GBApplicationSettingsProvider:
- Create the property here (don't forget about
@synthetize!). - Set default value in initializer.
If the setting should be mapped to command line switch also do the following in GBAppledocApplication:
- Create a new global string as
static NSStringcontaining the command line switch name. - Register the switch to
DDCli(add negated switch if it's a boolean). - Add unit test in
GBAppledocApplicationTesting.mthat validates the switch is properly mapped to setting property (note that boolean switches require testing normal and negated variants!). - Add KVC setter and map to corresponding property to make the test pass (again booleans require two setters).
- If the switch value uses template placeholders, add unit test in
GBApplicationSettingsProviderTesting.mthat validates the switch is handled. - If previous point was used, add the code to
replaceAllOccurencesOfPlaceholderStringsInSettingsValuesto make the test pass. - Add the switch value printout to
printSettingsAndArguments:. - Add the switch help printout to
printHelp.
Tasks
Initialization & disposal
-
+ providerReturns autoreleased instance of the class.
Project values handling
-
projectNameHuman readable name of the project. property -
projectCompanyHuman readable name of the project company. property -
projectVersionHuman readable version of the project. property -
companyIdentifierCompany unique identifier, ussualy in the form of reverse domain like com.company. property -
projectIdentifierProject identifier which is derived by normalizingprojectName. property -
versionIdentifierVersion identifier which is derived by normalizingprojectVersion. property
Documentation set handling
-
docsetBundleIdentifierDocumentation set bundle identifier. property -
docsetBundleNameDocumentation set bundle name. property -
docsetCertificateIssuerDocumentation set certificate issuer. property -
docsetCertificateSignerDocumentation set certificate signer. property -
docsetDescriptionDocumentation set description. property -
docsetFallbackURLDocumentation set fallback URL. property -
docsetFeedNameDocumentation set feed name. property -
docsetFeedURLDocumentation set feed URL. property -
docsetPackageURLDocumentation set package URL. property -
docsetMinimumXcodeVersionDocumentation set minimum Xcode version. property -
docsetPlatformFamilyDocumentation set platform family. property -
docsetPublisherIdentifierDocumentation set publisher identifier. property -
docsetPublisherNameDocumentation set publisher name. property -
docsetCopyrightMessageDocumentation set human readble copyright message. property -
docsetBundleFilenameThe name of the documentation set installed bundle. The folder is generated indocsetInstallPath. property -
docsetAtomFilenameThe name of the documentation set atom file when generating publishing files. The file is generated inoutputPath. property -
docsetPackageFilenameThe name of the documentation set compressed package file when generating publishing files. The file is generated inoutputPath. property
Paths handling
-
templatesPathThe base path to template files used for generating various output files. property -
outputPathThe base path of the generated files. property -
docsetInstallPathThe path to which documentation set is to be installed. property -
docsetUtilPathThe path todocsetutiltool, including tool filename. property -
ignoredPathsThe list of all full or partial paths to be ignored. property -
createHTML@name Behavior handling property -
createDocSetSpecifies whether documentation set should be created from the HTML files. property -
installDocSetSpecifies whether the documentation set should be installed or not. property -
publishDocSetSpecifies whether the documentation set should be prepared for publishing or not. property -
keepIntermediateFilesSpecifies whether intermediate files should be kept inoutputPathor not. property -
repeatFirstParagraphForMemberDescriptionIndicates whether the first paragraph needs to be repeated within method and property description or not. property -
findUndocumentedMembersDocumentationSpecifies whether undocumented inherited methods or properties should be searched for in known places. property -
mergeCategoriesToClassesIndicates whether categories should be merges to classes they extend or not. property -
keepMergedCategoriesSectionsIndicates whether category or extension sections should be preserved when merging into extended class. property -
prefixMergedCategoriesSectionsWithCategoryNameIndicates whether merged section names from categories should be prefixed with category name. property
Warnings handling
-
warnOnMissingOutputPathArgumentIndicates whether appledoc will warn if--outputargument is not given. property -
warnOnMissingCompanyIdentifierIndicates whether appledoc will warn if--company-idargument is not given. property -
warnOnUndocumentedObjectIndicates whether appledoc will warn if it encounters an undocumented class, category or protocol. property -
warnOnUndocumentedMemberIndicates whether appledoc will warn if it encounters an undocumented method or property. property -
warnOnEmptyDescriptionIndicates whether appledoc will warn if it encounters an empty description (@bug, @warning, example section etc.). property -
warnOnUnknownDirectiveIndicates whether appledoc will warn if it encounters unknown directive or styling element. property -
warnOnInvalidCrossReferenceIndicates whether invalid cross reference should result in warning or not. property -
warnOnMissingMethodArgumentIndicates whether missing method argument descriptions in comments should result in warnings or not. property
Application-wide HTML helpers
-
– stringByEscapingHTML:Returns a new string by escaping the given HTML. -
– htmlReferenceNameForObject:Returns HTML reference name for the given object. -
– htmlReferenceForObject:fromSource:Returns relative HTML reference to the given object from the context of the given source object. -
– htmlReferenceForObjectFromIndex:Returns relative HTML reference to the given object from the context of index file. -
htmlExtensionThe file extension for html files. property
Helper methods
-
– replaceAllOccurencesOfPlaceholderStringsInSettingsValuesReplaces all occurences of placeholder strings in all related values of the receiver. -
– stringByReplacingOccurencesOfPlaceholdersInString:Replaces all placeholders occurences in the given string.
Helper classes
-
commentComponentsReturns theGBCommentComponentsProviderobject that identifies comment components. property -
stringTemplatesReturns theGBApplicationStringsProviderobject that specifies all string templates used for output generation. property
Properties
commentComponents
Returns the GBCommentComponentsProvider object that identifies comment components.
@property (retain) GBCommentComponentsProvider *commentComponentsDeclared In
GBApplicationSettingsProvider.hcompanyIdentifier
Company unique identifier, ussualy in the form of reverse domain like com.company.
@property (copy) NSString *companyIdentifierDeclared In
GBApplicationSettingsProvider.hcreateDocSet
Specifies whether documentation set should be created from the HTML files.
@property (assign) BOOL createDocSetDiscussion
If YES, HTML files from html subdirectory in outputPath are moved to proper subdirectory within docset output files, then helper files are generated from parsed data. Documentation set files are also indexed. If NO, HTML files are left in the output path.
Declared In
GBApplicationSettingsProvider.hcreateHTML
@name Behavior handling
@property (assign) BOOL createHTMLDeclared In
GBApplicationSettingsProvider.hdocsetAtomFilename
The name of the documentation set atom file when generating publishing files. The file is generated in outputPath.
@property (copy) NSString *docsetAtomFilenameDeclared In
GBApplicationSettingsProvider.hdocsetBundleFilename
The name of the documentation set installed bundle. The folder is generated in docsetInstallPath.
@property (copy) NSString *docsetBundleFilenameDeclared In
GBApplicationSettingsProvider.hdocsetBundleIdentifier
Documentation set bundle identifier.
@property (copy) NSString *docsetBundleIdentifierDeclared In
GBApplicationSettingsProvider.hdocsetBundleName
Documentation set bundle name.
@property (copy) NSString *docsetBundleNameDeclared In
GBApplicationSettingsProvider.hdocsetCertificateIssuer
Documentation set certificate issuer.
@property (copy) NSString *docsetCertificateIssuerDeclared In
GBApplicationSettingsProvider.hdocsetCertificateSigner
Documentation set certificate signer.
@property (copy) NSString *docsetCertificateSignerDeclared In
GBApplicationSettingsProvider.hdocsetCopyrightMessage
Documentation set human readble copyright message.
@property (copy) NSString *docsetCopyrightMessageDeclared In
GBApplicationSettingsProvider.hdocsetDescription
Documentation set description.
@property (copy) NSString *docsetDescriptionDeclared In
GBApplicationSettingsProvider.hdocsetFallbackURL
Documentation set fallback URL.
@property (copy) NSString *docsetFallbackURLDeclared In
GBApplicationSettingsProvider.hdocsetFeedName
Documentation set feed name.
@property (copy) NSString *docsetFeedNameDeclared In
GBApplicationSettingsProvider.hdocsetFeedURL
Documentation set feed URL.
@property (copy) NSString *docsetFeedURLDeclared In
GBApplicationSettingsProvider.hdocsetInstallPath
The path to which documentation set is to be installed.
@property (copy) NSString *docsetInstallPathDeclared In
GBApplicationSettingsProvider.hdocsetMinimumXcodeVersion
Documentation set minimum Xcode version.
@property (copy) NSString *docsetMinimumXcodeVersionDeclared In
GBApplicationSettingsProvider.hdocsetPackageFilename
The name of the documentation set compressed package file when generating publishing files. The file is generated in outputPath.
@property (copy) NSString *docsetPackageFilenameDeclared In
GBApplicationSettingsProvider.hdocsetPackageURL
Documentation set package URL.
@property (copy) NSString *docsetPackageURLDeclared In
GBApplicationSettingsProvider.hdocsetPlatformFamily
Documentation set platform family.
@property (copy) NSString *docsetPlatformFamilyDeclared In
GBApplicationSettingsProvider.hdocsetPublisherIdentifier
Documentation set publisher identifier.
@property (copy) NSString *docsetPublisherIdentifierDeclared In
GBApplicationSettingsProvider.hdocsetPublisherName
Documentation set publisher name.
@property (copy) NSString *docsetPublisherNameDeclared In
GBApplicationSettingsProvider.hdocsetUtilPath
The path to docsetutil tool, including tool filename.
@property (copy) NSString *docsetUtilPathDeclared In
GBApplicationSettingsProvider.hfindUndocumentedMembersDocumentation
Specifies whether undocumented inherited methods or properties should be searched for in known places.
@property (assign) BOOL findUndocumentedMembersDocumentationDiscussion
If YES, any undocumented overriden method or property is searched for in known super classes and adopted protocols and if documentation is found there, it is copied over. This works great for objects which would otherwise only show class documentation and no member. It's also how Apple documentation uses. Defaults to YES.
Note: This property works together with keepUndocumentedObjects and keepUndocumentedMembers. To understand how they are used, read documentation for keepUndocumentedObjects.
Declared In
GBApplicationSettingsProvider.hhtmlExtension
The file extension for html files.
@property (readonly) NSString *htmlExtensionDeclared In
GBApplicationSettingsProvider.hignoredPaths
The list of all full or partial paths to be ignored.
@property (retain) NSMutableArray *ignoredPathsDiscussion
It's recommended to check if a path string ends with any of the given paths before processing it. This should catch directory and file names properly as directories are processed first.
Declared In
GBApplicationSettingsProvider.hinstallDocSet
Specifies whether the documentation set should be installed or not.
@property (assign) BOOL installDocSetDiscussion
If YES, temporary files used for indexing and removed, then documentation set bundle is created from the files from docset output path and is moved to docsetInstallPath. If NO, all documentation set files are left in output path.
Declared In
GBApplicationSettingsProvider.hkeepIntermediateFiles
Specifies whether intermediate files should be kept in outputPath or not.
@property (assign) BOOL keepIntermediateFilesDiscussion
If YES, all intermediate files (i.e. HTML files and documentation set files) are kept in output path. If NO, only final results are kept. This setting not only affects how the files are being handled, it also affects performance. If intermediate files are not kept, appledoc moves files between various generation phases, otherwise it copies them. So it's prefferable to leave this option to NO. This option only affects output files, input source files are always left intact!
Declared In
GBApplicationSettingsProvider.hkeepMergedCategoriesSections
Indicates whether category or extension sections should be preserved when merging into extended class.
@property (assign) BOOL keepMergedCategoriesSectionsDiscussion
If YES, all the sections from category or extension documentation are preserved. In such case, prefixMergedCategoriesSectionsWithCategoryName may optionally be used to prefix section name with category name or not. If NO, category or extension sections are ignored and a single section with category name is created in the class.
Default value is NO. If you use many sections within the categories, you should probably leave this option unchanged as preserving all category sections might yield fragmented class documentation. Experiment a bit to see what works best for you.
Note: This option is ignored unless mergeCategoriesToClasses is used.
See Also
Declared In
GBApplicationSettingsProvider.hmergeCategoriesToClasses
Indicates whether categories should be merges to classes they extend or not.
@property (assign) BOOL mergeCategoriesToClassesDiscussion
If YES, all methods from categories and extensions are merged to their classes. If NO, categories are left as independent objects in generated output. This is the main categories merging on/off switch, it merely enables or disables merging, other category merging settings define how exactly the methods from categories and extensions are merged into their classes.
Default value is YES and should be left so as this seems to be the way Apple has it's documentation generated.
Important: Only categories for known project classes are merged. Categories to other framework classes, such as Foundation, AppKit or UIKit are not merged. In other words: only if the class source code is available on any of the given input paths, and is properly documented, it gets it's categories and extension methods merged! Also note that this option affects your documentation links - if any link is pointing to category that's going to be merged, it will be considered invalid link, so it's best to decide whther to merge categories of nor in advance and then consistently use properly formatted links.
See Also
Declared In
GBApplicationSettingsProvider.houtputPath
The base path of the generated files.
@property (copy) NSString *outputPathDeclared In
GBApplicationSettingsProvider.hprefixMergedCategoriesSectionsWithCategoryName
Indicates whether merged section names from categories should be prefixed with category name.
@property (assign) BOOL prefixMergedCategoriesSectionsWithCategoryNameDiscussion
If YES, all merged section names from categories are prefixed with category name to make them more easily identifiable. If NO, section names are not changed. The first option is useful in case end users of your code are aware of different categories (if you're writting a framework for example). On the other hand, if you're using categories mostly as a way to split class definition to multiple files, you might want to keep this option off.
Note: This option is ignored unless mergeCategoriesToClasses and keepMergedCategoriesSections is used. The option is also ignored for extensions; only section names are used for extensions!
Declared In
GBApplicationSettingsProvider.hprojectCompany
Human readable name of the project company.
@property (copy) NSString *projectCompanyDeclared In
GBApplicationSettingsProvider.hprojectIdentifier
Project identifier which is derived by normalizing projectName.
@property (readonly) NSString *projectIdentifierDeclared In
GBApplicationSettingsProvider.hprojectName
Human readable name of the project.
@property (copy) NSString *projectNameDeclared In
GBApplicationSettingsProvider.hprojectVersion
Human readable version of the project.
@property (copy) NSString *projectVersionDeclared In
GBApplicationSettingsProvider.hpublishDocSet
Specifies whether the documentation set should be prepared for publishing or not.
@property (assign) BOOL publishDocSetDiscussion
If YES, installed documentation set is packaged for publishing - an atom feed is created and documentation set is archived. If the atom feed file is alreay found, it is updated with new information. Both, the feed and archived docset files are located within outputPath. If NO, documentation set is not prepared for publishing.
Declared In
GBApplicationSettingsProvider.hrepeatFirstParagraphForMemberDescription
Indicates whether the first paragraph needs to be repeated within method and property description or not.
@property (assign) BOOL repeatFirstParagraphForMemberDescriptionDiscussion
If YES, first paragraph is repeated in members description, otherwise not.
Declared In
GBApplicationSettingsProvider.hstringTemplates
Returns the GBApplicationStringsProvider object that specifies all string templates used for output generation.
@property (retain) GBApplicationStringsProvider *stringTemplatesDeclared In
GBApplicationSettingsProvider.htemplatesPath
The base path to template files used for generating various output files.
@property (copy) NSString *templatesPathDeclared In
GBApplicationSettingsProvider.hversionIdentifier
Version identifier which is derived by normalizing projectVersion.
@property (readonly) NSString *versionIdentifierDeclared In
GBApplicationSettingsProvider.hwarnOnEmptyDescription
Indicates whether appledoc will warn if it encounters an empty description (@bug, @warning, example section etc.).
@property (assign) BOOL warnOnEmptyDescriptionDeclared In
GBApplicationSettingsProvider.hwarnOnInvalidCrossReference
Indicates whether invalid cross reference should result in warning or not.
@property (assign) BOOL warnOnInvalidCrossReferenceDeclared In
GBApplicationSettingsProvider.hwarnOnMissingCompanyIdentifier
Indicates whether appledoc will warn if --company-id argument is not given.
@property (assign) BOOL warnOnMissingCompanyIdentifierDiscussion
Although appledoc deducts this information from other values, it's better to warn the user as deducted information doesn't necessarily produce correct results.
Note that the warning is only issued if documentation set creation is requested.
Declared In
GBApplicationSettingsProvider.hwarnOnMissingMethodArgument
Indicates whether missing method argument descriptions in comments should result in warnings or not.
@property (assign) BOOL warnOnMissingMethodArgumentDeclared In
GBApplicationSettingsProvider.hwarnOnMissingOutputPathArgument
Indicates whether appledoc will warn if --output argument is not given.
@property (assign) BOOL warnOnMissingOutputPathArgumentDiscussion
Although appledoc still generates output in current directory, it's better to warn the user as in most cases this is not what she wants (for example if appledoc is invoked from Xcode build script, current working directory might point to some unpredicted location). appledoc also writes the exact path that will be used for generating output.
Note that in case documentation set is installed to Xcode, setting output path is irrelevant as all files from output are moved to locations Xcode uses for finding documentation sets.
Declared In
GBApplicationSettingsProvider.hwarnOnUndocumentedMember
Indicates whether appledoc will warn if it encounters an undocumented method or property.
@property (assign) BOOL warnOnUndocumentedMemberSee Also
Declared In
GBApplicationSettingsProvider.hInstance Methods
htmlReferenceForObject:fromSource:
Returns relative HTML reference to the given object from the context of the given source object.
- (NSString *)htmlReferenceForObject:(GBModelBase *)object fromSource:(GBModelBase *)sourceParameters
- object
- The object for which to generate the reference to.
- source
- The source object from which to generate the reference from or
nilfor index to object reference.
Return Value
Returns the reference string.
Discussion
This is useful for generating hrefs from one object HTML file to another. This is the swiss army knife king of a method for all hrefs generation. It works for any kind of links:
- Index to top-level object (if source is
nil). - Index to a member of a top-level object (if source is
nil). - Top-level object to same top-level object.
- Top-level object to a different top-level object.
- Top-level object to one of it's members.
- Member object to it's top-level object.
- Member object to another top-level object.
- Member object to another member of the same top-level object.
- Member object to a member of another top-level object.
Exceptions
- NSException
- Thrown if object is
nil.
Declared In
GBApplicationSettingsProvider.hhtmlReferenceForObjectFromIndex:
Returns relative HTML reference to the given object from the context of index file.
- (NSString *)htmlReferenceForObjectFromIndex:(GBModelBase *)objectParameters
- object
- The object for which to generate the reference to.
Return Value
Returns the reference string.
Discussion
This is simply a helper method for htmlReferenceForObject:fromSource:, passing the given object as object parameter and nil as source.
Exceptions
- NSException
- Thrown if object is
nil.
Declared In
GBApplicationSettingsProvider.hhtmlReferenceNameForObject:
Returns HTML reference name for the given object.
- (NSString *)htmlReferenceNameForObject:(GBModelBase *)objectParameters
- object
- The object for which to return reference name.
Return Value
Returns the reference name of the object.
Discussion
This should only be used for creating anchors that need to be referenced from other parts of the same HTML file. The method works for top-level objects as well as their members.
Exceptions
- NSException
- Thrown if the given object is
nil.
Declared In
GBApplicationSettingsProvider.hreplaceAllOccurencesOfPlaceholderStringsInSettingsValues
Replaces all occurences of placeholder strings in all related values of the receiver.
- (void)replaceAllOccurencesOfPlaceholderStringsInSettingsValuesDiscussion
This message should be sent once all the values have been set. It is a convenience method that prepares all values that can use placeholder strings. From this point on, the rest of the application can simply use properties to get final values instead of sending stringByReplacingOccurencesOfPlaceholdersInString: all the time.
Note that stringByReplacingOccurencesOfPlaceholdersInString: is still available for cases where placeholder strings may be used elsewhere (template files for example).
Declared In
GBApplicationSettingsProvider.hstringByEscapingHTML:
Returns a new string by escaping the given HTML.
- (NSString *)stringByEscapingHTML:(NSString *)stringParameters
- string
- HTML string to escape.
Return Value
Returns escaped HTML string.
Declared In
GBApplicationSettingsProvider.hstringByReplacingOccurencesOfPlaceholdersInString:
Replaces all placeholders occurences in the given string.
- (NSString *)stringByReplacingOccurencesOfPlaceholdersInString:(NSString *)stringParameters
- string
- The string to replace placeholder occurences in.
Return Value
Returns new string with all placeholder occurences replaced.
Discussion
This method provides application-wide string placeholders replacement functionality. It replaces all known placeholders with actual values from the receiver. Placeholders are identified by a dollar mark, followed by placeholder name. The following placeholders are supported (note that case is important!):
%PROJECT: Replaced byprojectNamevalue.%PROJECTID: Replaced byprojectIdentifiervalue.%COMPANY: Replaced byprojectCompanyvalue.%COMPANYID: Replaced bycompanyIdentifiervalue.%VERSION: Replaced byprojectVersionvalue.%VERSIONID: Replaced byversionIdentifiervalue.%DOCSETBUNDLEFILENAME: Replaced bydocsetBundleFilenamevalue.%DOCSETATOMFILENAME: Replaced bydocsetAtomFilenamevalue.%DOCSETPACKAGEFILENAME: Replaced bydocsetPackageFilenamevalue.%YEAR: Replaced by current year as four digit string.%UPDATEDATE: Replaced by current date in the form of year, month and day with formatYYYY-MM-DD. For example2010-11-30.
Declared In
GBApplicationSettingsProvider.h