Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to reuse trigger in different templates; #285

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions BuildaKit/CommonExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@ extension NSDictionary {
}
}

extension Dictionary {

public mutating func merge<S: SequenceType where S.Generator.Element == (Key,Value)> (other: S) {
for (key, value) in other {
self[key] = value
}
}
}

extension Array {

public func dictionarifyWithKey(key: (item: Element) -> String) -> [String: Element] {
Expand Down
23 changes: 23 additions & 0 deletions BuildaKitTests/ExtensionTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// ExtensionTests.swift
// Buildasaur
//
// Created by Anton Domashnev on 25/06/16.
// Copyright © 2016 Honza Dvorsky. All rights reserved.
//

import XCTest

class ExtensionTests: XCTestCase {

func testMergeShouldMergeTwoDictionaries() {
var dictionary1: [String: String] = ["A": "B", "A1": "B1", "A2": "B2" ]
let dictionary2: [String: String] = ["A2": "B2", "A3": "B3", "A4": "B4" ]
let expectedMergedDictionary: [String: String] = ["A": "B", "A1": "B1", "A2": "B2", "A3": "B3", "A4": "B4" ]

dictionary1.merge(dictionary2)

XCTAssertEqual(dictionary1, expectedMergedDictionary)
}

}
8 changes: 8 additions & 0 deletions Buildasaur.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@
3AED13151C52A1A300E3B7FF /* SecurePersistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AED13141C52A1A300E3B7FF /* SecurePersistence.swift */; };
3AF090B81B1134AA0058567F /* BranchWatchingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AF090B71B1134AA0058567F /* BranchWatchingViewController.swift */; };
3AF1B1241AAC7CA500917EF3 /* SyncerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AF1B1231AAC7CA500917EF3 /* SyncerViewController.swift */; };
6DF2EAFA1D1C6DDF006FC52B /* SelectTriggerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DF2EAF91D1C6DDF006FC52B /* SelectTriggerViewController.swift */; };
6DF2EB301D1EB0F0006FC52B /* ExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DF2EB2F1D1EB0F0006FC52B /* ExtensionTests.swift */; };
775501D89C0E4D209E6EE5D0 /* Pods_BuildaGitServer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9139F7877761955F17C535E /* Pods_BuildaGitServer.framework */; };
785688011CDD4843009EEB72 /* WorkspaceMetadataTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 785688001CDD4843009EEB72 /* WorkspaceMetadataTests.swift */; };
D59A4C6EEE903468E69AEA81 /* Pods_BuildaKitTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4EC43508E8A4F9D6E5ED0126 /* Pods_BuildaKitTests.framework */; };
Expand Down Expand Up @@ -382,6 +384,8 @@
4A4FCE02D4B5A180AAF85C12 /* Pods-BuildaGitServer.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BuildaGitServer.debug.xcconfig"; path = "Pods/Target Support Files/Pods-BuildaGitServer/Pods-BuildaGitServer.debug.xcconfig"; sourceTree = "<group>"; };
4EC43508E8A4F9D6E5ED0126 /* Pods_BuildaKitTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_BuildaKitTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
6A0C42D6343BC2A4C4C899AB /* Pods-BuildaHeartbeatKit.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BuildaHeartbeatKit.release.xcconfig"; path = "Pods/Target Support Files/Pods-BuildaHeartbeatKit/Pods-BuildaHeartbeatKit.release.xcconfig"; sourceTree = "<group>"; };
6DF2EAF91D1C6DDF006FC52B /* SelectTriggerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SelectTriggerViewController.swift; sourceTree = "<group>"; };
6DF2EB2F1D1EB0F0006FC52B /* ExtensionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExtensionTests.swift; sourceTree = "<group>"; };
7827BDC6B1752C193A0EAA05 /* Pods_BuildaKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_BuildaKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
785688001CDD4843009EEB72 /* WorkspaceMetadataTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WorkspaceMetadataTests.swift; sourceTree = "<group>"; };
8176576B54DB918274B10F51 /* Pods-Buildasaur.testing.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Buildasaur.testing.xcconfig"; path = "Pods/Target Support Files/Pods-Buildasaur/Pods-Buildasaur.testing.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -639,6 +643,7 @@
3ACBADDA1B5ADE1400204457 /* SyncerTests.swift */,
3ACBADDB1B5ADE1400204457 /* SyncPair_PR_Bot_Tests.swift */,
785688001CDD4843009EEB72 /* WorkspaceMetadataTests.swift */,
6DF2EB2F1D1EB0F0006FC52B /* ExtensionTests.swift */,
3A9D741E1BCBF86900DCA23C /* Migration */,
);
path = BuildaKitTests;
Expand Down Expand Up @@ -779,6 +784,7 @@
3AF1B1231AAC7CA500917EF3 /* SyncerViewController.swift */,
3AF090B71B1134AA0058567F /* BranchWatchingViewController.swift */,
3A5B04AF1AB5144700F60536 /* ManualBotManagementViewController.swift */,
6DF2EAF91D1C6DDF006FC52B /* SelectTriggerViewController.swift */,
);
name = Editables;
sourceTree = "<group>";
Expand Down Expand Up @@ -1460,6 +1466,7 @@
buildActionMask = 2147483647;
files = (
3A9109BF1BC29E0A00C2AECA /* EditorViewControllerFactory.swift in Sources */,
6DF2EAFA1D1C6DDF006FC52B /* SelectTriggerViewController.swift in Sources */,
3A0FF5A01BBFDA7E00FB8051 /* RACUIExtensions.swift in Sources */,
3AE0AB2B1BB991AB00A52D20 /* SyncerViewModel.swift in Sources */,
3AAA1B761AAC504700FA1598 /* XcodeServerViewController.swift in Sources */,
Expand Down Expand Up @@ -1564,6 +1571,7 @@
3ACBADDE1B5ADE1400204457 /* SyncerTests.swift in Sources */,
3ACBADDF1B5ADE1400204457 /* SyncPair_PR_Bot_Tests.swift in Sources */,
3ACBADDC1B5ADE1400204457 /* Mocks.swift in Sources */,
6DF2EB301D1EB0F0006FC52B /* ExtensionTests.swift in Sources */,
3A9D74201BCBF87900DCA23C /* MigrationTests.swift in Sources */,
3A7F0CC81BC1508C0079A511 /* GeneralTests.swift in Sources */,
);
Expand Down
Loading