Permalink
Browse files

Fixed `--merge-category-comment` option. Closes #422.

  • Loading branch information...
1 parent 9fa8f40 commit ce1960bf9e62c09504f3e4e0e00d0d0a07a86bc7 @tomaz committed Jan 16, 2014
Showing with 19 additions and 17 deletions.
  1. +19 −17 Application/GBAppledocApplication.m
@@ -183,12 +183,12 @@ - (int)application:(DDCliApplication *)app runWithArguments:(NSArray *)arguments
if (self.printSettings) [self printSettingsAndArguments:inputs];
kGBLogBasedResult = GBEXIT_SUCCESS;
- @try {
+ @try {
[self initializeLoggingSystem];
[self deleteContentsOfOutputPath];
GBLogNormal(@"Initializing...");
- GBStore *store = [[GBStore alloc] init];
+ GBStore *store = [[GBStore alloc] init];
GBAbsoluteTime startTime = GetCurrentTime();
GBLogNormal(@"Parsing source files...");
@@ -214,7 +214,7 @@ - (int)application:(DDCliApplication *)app runWithArguments:(NSArray *)arguments
NSUInteger timeForGeneration = SubtractTime(generateTime, processTime) * 1000.0;
GBLogInfo(@"Finished generating in %ldms.\n", timeForGeneration);
- NSUInteger timeForEverything = timeForParsing + timeForProcessing + timeForGeneration;
+ NSUInteger timeForEverything = timeForParsing + timeForProcessing + timeForGeneration;
GBLogNormal(@"Finished in %ldms.", timeForEverything);
GBLogInfo(@"Parsing: %ldms (%ld%%)", timeForParsing, timeForParsing * 100 / timeForEverything);
GBLogInfo(@"Processing: %ldms (%ld%%)", timeForProcessing, timeForProcessing * 100 / timeForEverything);
@@ -294,16 +294,18 @@ - (void)application:(DDCliApplication *)app willParseOptions:(DDGetoptLongParser
{ GBNoArg(kGBArgPrintInformationBlockTitles), 0, DDGetoptNoArgument },
{ kGBArgUseSingleStar, 0, DDGetoptNoArgument },
{ kGBArgMergeCategoriesToClasses, 0, DDGetoptNoArgument },
+ { kGBArgMergeCategoryComment, 0, DDGetoptNoArgument },
{ kGBArgKeepMergedCategoriesSections, 0, DDGetoptNoArgument },
{ kGBArgPrefixMergedCategoriesSectionsWithCategoryName, 0, DDGetoptNoArgument },
- { kGBArgUseCodeOrder, 0, DDGetoptNoArgument },
+ { kGBArgUseCodeOrder, 0, DDGetoptNoArgument },
{ kGBArgExitCodeThreshold, 0, DDGetoptRequiredArgument },
{ GBNoArg(kGBArgKeepIntermediateFiles), 0, DDGetoptNoArgument },
{ GBNoArg(kGBArgKeepUndocumentedObjects), 0, DDGetoptNoArgument },
{ GBNoArg(kGBArgKeepUndocumentedMembers), 0, DDGetoptNoArgument },
{ GBNoArg(kGBArgFindUndocumentedMembersDocumentation), 0, DDGetoptNoArgument },
{ GBNoArg(kGBArgRepeatFirstParagraph), 0, DDGetoptNoArgument },
{ GBNoArg(kGBArgMergeCategoriesToClasses), 0, DDGetoptNoArgument },
+ { GBNoArg(kGBArgMergeCategoryComment), 0, DDGetoptNoArgument },
{ GBNoArg(kGBArgKeepMergedCategoriesSections), 0, DDGetoptNoArgument },
{ GBNoArg(kGBArgPrefixMergedCategoriesSectionsWithCategoryName), 0, DDGetoptNoArgument },
{ GBNoArg(kGBArgUseCodeOrder), 0, DDGetoptNoArgument },
@@ -497,7 +499,7 @@ - (BOOL)validateTemplatesPath:(NSString *)path error:(NSError **)error {
*error = [NSError errorWithCode:GBErrorTemplatePathDoesntExist description:desc reason:nil];
}
return NO;
- }
+ }
if (!isDirectory) {
if (error) {
NSString *desc = [NSString stringWithFormat:@"Template path '%@' is not directory!", standardized];
@@ -564,7 +566,7 @@ - (void)injectGlobalSettingsFromArguments:(NSArray *)arguments {
while ([opt hasPrefix:@"-"]) opt = [opt substringFromIndex:1];
if ([opt isEqualToString:@"t"] || [opt isEqualToString:kGBArgTemplatesPath]) {
NSError *error = nil;
- if (![self validateTemplatesPath:path error:&error]) [NSException raiseWithError:error format:@"Path '%@' from %@ is not valid!", path, option];
+ if (![self validateTemplatesPath:path error:&error]) [NSException raiseWithError:error format:@"Path '%@' from %@ is not valid!", path, option];
[self overrideSettingsWithGlobalSettingsFromPath:path];
self.templatesFound = YES;
*stop = YES;
@@ -584,7 +586,7 @@ - (void)injectGlobalSettingsFromArguments:(NSArray *)arguments {
self.settings.templatesPath = path;
self.templatesFound = YES;
return;
- }
+ }
}
path = @"~/.appledoc";
@@ -639,7 +641,7 @@ - (void)injectProjectSettingsFromArguments:(NSArray *)arguments {
// If we have a plist file, handle it. Note that we need to handle --templates cmd line switch separately so that it's properly accepted by the application!
if ([[filename pathExtension] isEqualToString:@"plist"]) {
// Prepare the directory path to the plist file. We'll use it for preparing relative paths.
- if (!dir) [self.ignoredInputPaths addObject:argument];
+ if (!dir) [self.ignoredInputPaths addObject:argument];
NSString *plistPath = [filename stringByDeletingLastPathComponent];
// In the first pass, we need to handle --templates option. We need to handle these before any other option from the project settings to prevent global settings overriding project settings! Note how we prevent handling of every option except --templates; we leave that option through to get it set to application settings (that's all the KVC setter does).
@@ -697,14 +699,14 @@ - (void)injectSettingsFromSettingsFile:(NSString *)path usingBlock:(BOOL (^)(NSS
NSError* error = nil;
NSData* data = [NSData dataWithContentsOfFile:path options:0 error:&error];
- if (!data) [NSException raise:@"Failed reading settings from '%@'!", path];
+ if (!data) [NSException raise:@"Failed reading settings from '%@'!", path];
NSDictionary *theSettings = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListImmutable format:NULL error:&error];
if (!theSettings) [NSException raiseWithError:error format:@"Failed reading settings plist from '%@'!", path];
// We first pass each option and it's value to the block. The block can return YES to allow handling it, NO otherwise. It can also pass back a different value (we're passing a pointer to the value!).
[theSettings enumerateKeysAndObjectsUsingBlock:^(NSString *option, id value, BOOL *stop) {
while ([option hasPrefix:@"-"]) option = [option substringFromIndex:1];
- NSString *key = [DDGetoptLongParser keyFromOption:option];
+ NSString *key = [DDGetoptLongParser keyFromOption:option];
if (!block(option, &value, stop)) return;
// If the value is an array, send as many messages as there are values.
@@ -748,16 +750,16 @@ - (void)setProjectCompany:(NSString *)value { self.settings.projectCompany = val
- (void)setCompanyId:(NSString *)value { self.settings.companyIdentifier = value; }
- (void)setCleanOutput:(BOOL)value { self.settings.cleanupOutputPathBeforeRunning = value; }
-- (void)setCreateHtml:(BOOL)value {
- self.settings.createHTML = value;
+- (void)setCreateHtml:(BOOL)value {
+ self.settings.createHTML = value;
if (!value) {
self.settings.createDocSet = NO;
self.settings.finalizeDocSet = NO;
self.settings.installDocSet = NO;
self.settings.publishDocSet = NO;
}
}
-- (void)setCreateDocset:(BOOL)value {
+- (void)setCreateDocset:(BOOL)value {
self.settings.createDocSet = value;
if (value) {
self.settings.createHTML = YES;
@@ -778,8 +780,8 @@ - (void)setFinalizeDocset:(BOOL)value {
// self.settings.publishDocSet = NO;
}
}
-- (void)setInstallDocset:(BOOL)value {
- self.settings.installDocSet = value;
+- (void)setInstallDocset:(BOOL)value {
+ self.settings.installDocSet = value;
if (value) {
self.settings.createHTML = YES;
self.settings.createDocSet = YES;
@@ -789,8 +791,8 @@ - (void)setInstallDocset:(BOOL)value {
// self.settings.publishDocSet = NO;
}
}
-- (void)setPublishDocset:(BOOL)value {
- self.settings.publishDocSet = value;
+- (void)setPublishDocset:(BOOL)value {
+ self.settings.publishDocSet = value;
if (value) {
self.settings.createHTML = YES;
self.settings.createDocSet = YES;

0 comments on commit ce1960b

Please sign in to comment.