Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed document links detection.

To allow detecting documents properly, `[GBStore documentWithName:]` now accepts either name with or without `-template` prefix. Using both options within GBStore speeds up checking during processing.
  • Loading branch information...
commit 90839c29830439845aef003d9dfc550d5cea244a 1 parent 3b3cfab
@tomaz authored
View
2  Application/GBAppledocApplication.h
@@ -11,8 +11,6 @@
/** The appledoc application handler.
- Let's make some hrefs to Document1 and Document2.
-
This is the principal tool class. It represents the entry point for the application. The main promises of the class are parsing and validating of command line arguments and initiating documentation generation. Generation is divided into several distinct phases:
1. Parsing data from source files: This is the initial phase where input directories and files are parsed into a memory representation (i.e. objects) suitable for subsequent handling. This is where the source code files are parsed and validated for possible file or object-level incosistencies. This step is driven by `GBParser` class.
View
2  Model/GBStore.h
@@ -83,7 +83,7 @@
/** Registers the given static document to the store data.
- If store doesn't yet have the given document instance registered, the object is added to `documents` list. If the same instance is already regsitered, nothing happens.
+ If store doesn't yet have the given document instance registered, the object is added to `documents` list. If the same instance is already regsitered, nothing happens. The document is also made available through `documentWithName` after being registered; to simplify the rest of the code, `-template` prefix can be ommited when seaching!
@warning *Note:* If another instance of the document with the same path is registered, an exception is thrown.
View
1  Model/GBStore.m
@@ -107,6 +107,7 @@ - (void)registerDocument:(GBDocumentData *)document {
}
[_documents addObject:document];
[_documentsByName setObject:document forKey:name];
+ [_documentsByName setObject:document forKey:[name stringByReplacingOccurrencesOfString:@"-template" withString:@""]];
}
- (void)unregisterTopLevelObject:(id)object {
View
5 Testing/GBStoreTesting.m
@@ -264,13 +264,14 @@ - (void)testRegisterDocument_shouldIgnoreSameInstance {
- (void)testDocumentWithName_shouldReturnProperInstanceOrNil {
// setup
GBStore *store = [[GBStore alloc] init];
- GBDocumentData *document1 = [GBDocumentData documentDataWithContents:@"contents" path:@"path1/document.txt"];
+ GBDocumentData *document1 = [GBDocumentData documentDataWithContents:@"contents" path:@"path1/document1.txt"];
GBDocumentData *document2 = [GBDocumentData documentDataWithContents:@"contents" path:@"path2/document-template.txt"];
[store registerDocument:document1];
[store registerDocument:document2];
// execute & verify
- assertThat([store documentWithName:@"document"], is(document1));
+ assertThat([store documentWithName:@"document1"], is(document1));
assertThat([store documentWithName:@"document-template"], is(document2));
+ assertThat([store documentWithName:@"document"], is(document2));
assertThat([store documentWithName:@"something"], is(nil));
assertThat([store documentWithName:@""], is(nil));
assertThat([store documentWithName:nil], is(nil));
Please sign in to comment.
Something went wrong with that request. Please try again.