Skip to content

Commit

Permalink
Modularization of block assemblies.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasper Blues committed Nov 8, 2013
1 parent bba6a70 commit 8cbdece
Show file tree
Hide file tree
Showing 20 changed files with 2,467 additions and 2,432 deletions.
10 changes: 9 additions & 1 deletion Source/Factory/Block/TyphoonAssembly.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,15 @@ + (BOOL)shouldProvideDynamicImplementationFor:(SEL)sel;

+ (BOOL)selectorReserved:(SEL)selector
{
return [reservedSelectorsAsStrings containsObject:NSStringFromSelector(selector)];
if ([reservedSelectorsAsStrings containsObject:NSStringFromSelector(selector)])
{
return YES;
}
else if ([NSStringFromSelector(selector) hasPrefix:@"set"])
{
return YES;
}
return NO;
}

+ (void)provideDynamicImplementationToConstructDefinitionForSEL:(SEL)sel;
Expand Down
3 changes: 2 additions & 1 deletion Tests/Factory/Block/ExtendedMiddleAgesAssembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@

#import <Foundation/Foundation.h>
#import "TyphoonAssembly.h"
#import "QuestLocator.h"

@class MiddleAgesAssembly;


@interface ExtendedMiddleAgesAssembly : TyphoonAssembly

@property (nonatomic, strong, readonly) MiddleAgesAssembly* middleAgesAssembly;
@property (nonatomic, strong, readwrite) id<QuestLocator> questLocator;

- (id)knightWithExternalQuest;

Expand Down
13 changes: 5 additions & 8 deletions Tests/Factory/Block/ExtendedMiddleAgesAssembly.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,18 @@

@implementation ExtendedMiddleAgesAssembly

- (id)init
+ (instancetype)assembly
{
self = [super init];
if (self)
{
_middleAgesAssembly = [TyphoonCollaboratingAssemblyProxy proxy];
}
return self;
ExtendedMiddleAgesAssembly* assembly = [super assembly];
[assembly setQuestLocator:[TyphoonCollaboratingAssemblyProxy proxy]];
return assembly;
}

- (id)knightWithExternalQuest
{
return [TyphoonDefinition withClass:[Knight class] properties:^(TyphoonDefinition* definition)
{
[definition injectProperty:@selector(quest) withDefinition:[_middleAgesAssembly defaultQuest]];
[definition injectProperty:@selector(quest) withDefinition:[_questLocator environmentDependentQuest]];
}];
}

Expand Down
5 changes: 4 additions & 1 deletion Tests/Factory/Block/MiddleAgesAssembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,21 @@

#import <Foundation/Foundation.h>
#import "TyphoonAssembly.h"
#import "QuestLocator.h"

@class TyphoonDefinition;


@interface MiddleAgesAssembly : TyphoonAssembly
@interface MiddleAgesAssembly : TyphoonAssembly<QuestLocator>

- (id)knight;

- (id)cavalryMan;

- (id)defaultQuest;

- (id)environmentDependentQuest;

- (id)anotherKnight;

- (id)yetAnotherKnight;
Expand Down
5 changes: 5 additions & 0 deletions Tests/Factory/Block/MiddleAgesAssembly.m
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ - (id)defaultQuest
return [TyphoonDefinition withClass:[CampaignQuest class]];
}

- (id)environmentDependentQuest
{
return [TyphoonDefinition withClass:[CampaignQuest class]];
}

- (id)serviceUrl;
{
return [TyphoonDefinition withClass:[NSURL class] initialization:^(TyphoonInitializer* initializer)
Expand Down
18 changes: 18 additions & 0 deletions Tests/Factory/Block/QuestLocator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
////////////////////////////////////////////////////////////////////////////////
//
// 58 NORTH
// Copyright 2013 58 North
// All Rights Reserved.
//
// NOTICE: This software is the proprietary information of 58 North
// Use is subject to license terms.
//
////////////////////////////////////////////////////////////////////////////////

#import <Foundation/Foundation.h>

@protocol QuestLocator <NSObject>

- (id)environmentDependentQuest;

@end
4,818 changes: 2,409 additions & 2,409 deletions Tests/Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Tests/Tests.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@
B1C044F0F19E4B448A36BEFB /* Pods-ios.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ios.xcconfig"; path = "Pods/Pods-ios.xcconfig"; sourceTree = SOURCE_ROOT; };
B90D396911F743468FF96BB5 /* libPods-iOS Tests (Cocoapods).a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-iOS Tests (Cocoapods).a"; sourceTree = BUILT_PRODUCTS_DIR; };
BA79833897B7E0F78B3AF30D /* ExtendedMiddleAgesAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtendedMiddleAgesAssembly.h; sourceTree = "<group>"; };
BA79850B811499A37FBE9BEC /* QuestLocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuestLocator.h; sourceTree = "<group>"; };
BA79854F29FE8A327A82E8BC /* TyphoonStringUtilsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TyphoonStringUtilsTests.m; sourceTree = "<group>"; };
BA79870B653F1DB13DCE8543 /* ExtendedMiddleAgesAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExtendedMiddleAgesAssembly.m; sourceTree = "<group>"; };
BA7988D3F261F1B68761BEF2 /* TyphoonUIColorConverterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TyphoonUIColorConverterTests.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -598,6 +599,7 @@
4656F7AA17DB635700EDDC23 /* InfrastructureComponentsAssembly.m */,
BA79870B653F1DB13DCE8543 /* ExtendedMiddleAgesAssembly.m */,
BA79833897B7E0F78B3AF30D /* ExtendedMiddleAgesAssembly.h */,
BA79850B811499A37FBE9BEC /* QuestLocator.h */,
);
path = Block;
sourceTree = "<group>";
Expand Down
3 changes: 2 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
<target name="--test.cocoapods">
<property name="tests.report" value="${reports.dir}/tests/test-results.txt"/>
<exec executable="xcodebuild" failonerror="false" outputproperty="unit.tests.output">
<arg line="-workspace ${workspace} -scheme '${tests.ios.scheme.name}' test -destination OS=${module.sdk.version},name=iPad"/> <!-- TODO: move out of derived data -->
<!-- TODO: move out of derived data -->
<arg line="-workspace ${workspace} -scheme '${tests.ios.scheme.name}' test -destination OS=${module.sdk.version},name=iPad"/>
</exec>
</target>

Expand Down

0 comments on commit 8cbdece

Please sign in to comment.