Skip to content

Commit

Permalink
Merge pull request buildasaurs#200 from czechboy0/hd/rac_upgrade_4rc1
Browse files Browse the repository at this point in the history
RAC updated to 4.RC1
  • Loading branch information
czechboy0 committed Jan 16, 2016
2 parents e89490f + 28df965 commit abeff2e
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 61 deletions.
18 changes: 9 additions & 9 deletions BuildaKit/Availability.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ public class AvailabilityChecker {
return SignalProducer {
sink, _ in

sendNext(sink, .Checking)
sink.sendNext(.Checking)

NetworkUtils.checkAvailabilityOfXcodeServerWithCurrentSettings(input, completion: { (success, error) -> () in
NSOperationQueue.mainQueue().addOperationWithBlock({ () -> Void in
if success {
sendNext(sink, .Succeeded)
sink.sendNext(.Succeeded)
} else {
sendNext(sink, .Failed(error))
sink.sendNext(.Failed(error))
}
sendCompleted(sink)
sink.sendCompleted()
})
})
}
Expand All @@ -42,13 +42,13 @@ public class AvailabilityChecker {

return SignalProducer { sink, _ in

sendNext(sink, .Checking)
sink.sendNext(.Checking)

var project: Project!
do {
project = try Project(config: input)
} catch {
sendNext(sink, .Failed(error))
sink.sendNext(.Failed(error))
return
}

Expand All @@ -57,11 +57,11 @@ public class AvailabilityChecker {
NSOperationQueue.mainQueue().addOperationWithBlock({ () -> Void in

if success {
sendNext(sink, .Succeeded)
sink.sendNext(.Succeeded)
} else {
sendNext(sink, .Failed(error))
sink.sendNext(.Failed(error))
}
sendCompleted(sink)
sink.sendCompleted()
})
})
}
Expand Down
12 changes: 6 additions & 6 deletions BuildaKit/RACUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ public func flattenArray<T, E>(inProducer: SignalProducer<[T], E>) -> SignalProd

return inProducer.flatMap(.Merge) { (vals: [T]) -> SignalProducer<T, E> in
return SignalProducer { sink, _ in
vals.forEach { sendNext(sink, $0) }
sendCompleted(sink)
vals.forEach { sink.sendNext($0) }
sink.sendCompleted()
}
}
}

extension SignalProducer {

public func ignoreErrors(action: ((E) -> ())? = nil) -> SignalProducer<T, NoError> {
public func ignoreErrors(action: ((Error) -> ())? = nil) -> SignalProducer<Value, NoError> {
return self.flatMapError {
action?($0)
return SignalProducer<T, NoError> { _, _ in }
return SignalProducer<Value, NoError> { _, _ in }
}
}

//only sends values when condition has value true
public func forwardIf(condition: SignalProducer<Bool, E>) -> SignalProducer<T, E> {
return combineLatest(self, condition).map { (value: T, condition: Bool) -> T? in
public func forwardIf(condition: SignalProducer<Bool, Error>) -> SignalProducer<Value, Error> {
return combineLatest(self, condition).map { (value: Value, condition: Bool) -> Value? in
return condition ? value : nil
}.ignoreNil()
}
Expand Down
17 changes: 9 additions & 8 deletions Buildasaur/BranchWatchingViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ class BranchWatchingViewController: NSViewController, NSTableViewDelegate, NSTab
}
}

showables.start(Event.sink(error: { (error) -> () in
UIUtils.showAlertWithError(error)
showables.start(Observer(
failed: { (error) -> () in
UIUtils.showAlertWithError(error)
}, completed: { [weak self] () -> () in
self?.branchActivityIndicator.stopAnimation(nil)
}, next: { [weak self] (branches) -> () in
Expand All @@ -85,10 +86,10 @@ class BranchWatchingViewController: NSViewController, NSTableViewDelegate, NSTab

sself.syncer.github.getBranchesOfRepo(repoName) { (branches, error) -> () in
if let error = error {
sendError(sink, error)
sink.sendFailed(error)
} else {
sendNext(sink, branches!)
sendCompleted(sink)
sink.sendNext(branches!)
sink.sendCompleted()
}
}
}.observeOn(UIScheduler())
Expand All @@ -103,10 +104,10 @@ class BranchWatchingViewController: NSViewController, NSTableViewDelegate, NSTab

sself.syncer.github.getOpenPullRequests(repoName) { (prs, error) -> () in
if let error = error {
sendError(sink, error)
sink.sendFailed(error)
} else {
sendNext(sink, prs!)
sendCompleted(sink)
sink.sendNext(prs!)
sink.sendCompleted()
}
}
}.observeOn(UIScheduler())
Expand Down
22 changes: 11 additions & 11 deletions Buildasaur/BuildTemplateViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ class BuildTemplateViewController: ConfigEditViewController, NSTableViewDataSour

do {
let platformType = try XcodeDeviceParser.parseDeviceTypeFromProjectUrlAndScheme(sself.project.value.url, scheme: scheme).toPlatformType()
sendNext(sink, platformType)
sendCompleted(sink)
sink.sendNext(platformType)
sink.sendCompleted()
} catch {
UIUtils.showAlertWithError(error)
}
Expand All @@ -232,7 +232,7 @@ class BuildTemplateViewController: ConfigEditViewController, NSTableViewDataSour
let scheme = schemes[index]
sself.selectedScheme.value = scheme.name
}
sendCompleted(sink)
sink.sendCompleted()
}
let action = Action { (_: AnyObject?) in handler }
self.schemesPopup.rac_command = toRACCommand(action)
Expand Down Expand Up @@ -267,7 +267,7 @@ class BuildTemplateViewController: ConfigEditViewController, NSTableViewDataSour

sself.selectedSchedule.value = schedule
}
sendCompleted(sink)
sink.sendCompleted()
}
let action = Action { (_: AnyObject?) in handler }
self.schedulePopup.rac_command = toRACCommand(action)
Expand All @@ -292,7 +292,7 @@ class BuildTemplateViewController: ConfigEditViewController, NSTableViewDataSour
let policy = policies[index]
sself.cleaningPolicy.value = policy
}
sendCompleted(sink)
sink.sendCompleted()
}
let action = Action { (_: AnyObject?) in handler }
self.cleaningPolicyPopup.rac_command = toRACCommand(action)
Expand Down Expand Up @@ -344,7 +344,7 @@ class BuildTemplateViewController: ConfigEditViewController, NSTableViewDataSour
let filter = filters[index]
sself.deviceFilter.value = filter
}
sendCompleted(sink)
sink.sendCompleted()
}
let action = Action { (_: AnyObject?) in handler }
self.deviceFilterPopup.rac_command = toRACCommand(action)
Expand Down Expand Up @@ -426,16 +426,16 @@ class BuildTemplateViewController: ConfigEditViewController, NSTableViewDataSour

sself.xcodeServer.value.getDevices { (devices, error) -> () in
if let error = error {
sendError(sink, error)
sink.sendFailed(error)
} else {
sendNext(sink, devices!)
sink.sendNext(devices!)
}
sendCompleted(sink)
sink.sendCompleted()
}
}
.observeOn(UIScheduler())
.start(Event.sink(
error: { UIUtils.showAlertWithError($0) },
.start(Observer(
failed: { UIUtils.showAlertWithError($0) },
completed: completion,
next: { [weak self] (devices) -> () in
let processed = BuildTemplateViewController
Expand Down
4 changes: 2 additions & 2 deletions Buildasaur/DashboardViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class DashboardViewController: PresentableViewController {
let anySyncerStateChanged = self.syncerViewModels.producer.flatMap(.Merge) { newViewModels -> SignalProducer<SignalProducer<Bool, NoError>, NoError> in

return SignalProducer { sink, _ in
newViewModels.forEach { sendNext(sink, $0.syncer.activeSignalProducer.producer) }
sendCompleted(sink)
newViewModels.forEach { sink.sendNext($0.syncer.activeSignalProducer.producer) }
sink.sendCompleted()
}
}.flatten(.Merge)

Expand Down
4 changes: 2 additions & 2 deletions Buildasaur/EditableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ class EditableViewController: NSViewController {
//and force user to fix the problem.

final func goNext(animated animated: Bool = false) {
sendNext(self.sinkNext, animated)
self.sinkNext.sendNext(animated)
}

final func goPrevious() {
sendNext(self.sinkPrevious, ())
self.sinkPrevious.sendNext(())
}

//for overriding
Expand Down
2 changes: 1 addition & 1 deletion Buildasaur/EmptyBuildTemplateViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class EmptyBuildTemplateViewController: EditableViewController {
let index = sself.existingBuildTemplatesPopup.indexOfSelectedItem
sself.selectItemAtIndex(index)
}
sendCompleted(sink)
sink.sendCompleted()
}
let action = Action { (_: AnyObject?) in handler }
self.existingBuildTemplatesPopup.rac_command = toRACCommand(action)
Expand Down
2 changes: 1 addition & 1 deletion Buildasaur/EmptyProjectViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class EmptyProjectViewController: EditableViewController {
let index = sself.existingProjectsPopup.indexOfSelectedItem
sself.selectItemAtIndex(index)
}
sendCompleted(sink)
sink.sendCompleted()
}
let action = Action { (_: AnyObject?) in handler }
self.existingProjectsPopup.rac_command = toRACCommand(action)
Expand Down
2 changes: 1 addition & 1 deletion Buildasaur/EmptyXcodeServerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class EmptyXcodeServerViewController: EditableViewController {
let index = sself.existingXcodeServersPopup.indexOfSelectedItem
sself.selectItemAtIndex(index)
}
sendCompleted(sink)
sink.sendCompleted()
}
let action = Action { (_: AnyObject?) in handler }
self.existingXcodeServersPopup.rac_command = toRACCommand(action)
Expand Down
2 changes: 1 addition & 1 deletion Buildasaur/RACUIExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ extension NSButton {
let button = input as! NSButton
return SignalProducer { sink, _ in
on.value = button.on
sendCompleted(sink)
sink.sendCompleted()
}
}

Expand Down
2 changes: 1 addition & 1 deletion Buildasaur/SyncerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class SyncerViewController: ConfigEditViewController {
sself.syncInterval.value = value
}
}
sendCompleted(sink)
sink.sendCompleted()
}
let action = Action { (_: AnyObject?) in handler }
self.syncIntervalStepper.rac_command = toRACCommand(action)
Expand Down
4 changes: 2 additions & 2 deletions Buildasaur/TriggerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class TriggerViewController: NSViewController {
let all = sself.kinds.value
sself.selectedKind.value = all[index]
}
sendCompleted(sink)
sink.sendCompleted()
}
let action = Action { (_: AnyObject?) in handler }
self.kindPopup.rac_command = toRACCommand(action)
Expand All @@ -185,7 +185,7 @@ class TriggerViewController: NSViewController {
let all = sself.phases.value
sself.selectedPhase.value = all[index]
}
sendCompleted(sink)
sink.sendCompleted()
}
let action = Action { (_: AnyObject?) in handler }
self.phasePopup.rac_command = toRACCommand(action)
Expand Down
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def pods_for_errbody
end

def rac
pod 'ReactiveCocoa', '~> 4.0.4-alpha-1'
pod 'ReactiveCocoa', '=4.0.0-RC.1'
end

def also_xcode_pods
Expand Down
30 changes: 15 additions & 15 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PODS:
- Alamofire (2.0.0-beta.3)
- BuildaUtils (0.2.4)
- CryptoSwift (0.1.1)
- CryptoSwift (0.2.2)
- ekgclient (0.3.0):
- Alamofire (= 2.0.0-beta.3)
- Ji (1.2.0):
Expand All @@ -10,18 +10,18 @@ PODS:
- Ji/Ji-libxml
- Ji/Ji-libxml (1.2.0)
- Nimble (3.0.0)
- ReactiveCocoa (4.0.4-alpha-1):
- ReactiveCocoa/UI (= 4.0.4-alpha-1)
- Result (~> 0.6-beta.1)
- ReactiveCocoa/Core (4.0.4-alpha-1):
- ReactiveCocoa (4.0.0-RC.1):
- ReactiveCocoa/UI (= 4.0.0-RC.1)
- Result (~> 1.0)
- ReactiveCocoa/Core (4.0.0-RC.1):
- ReactiveCocoa/no-arc
- Result (~> 0.6-beta.1)
- ReactiveCocoa/no-arc (4.0.4-alpha-1):
- Result (~> 0.6-beta.1)
- ReactiveCocoa/UI (4.0.4-alpha-1):
- Result (~> 1.0)
- ReactiveCocoa/no-arc (4.0.0-RC.1):
- Result (~> 1.0)
- ReactiveCocoa/UI (4.0.0-RC.1):
- ReactiveCocoa/Core
- Result (~> 0.6-beta.1)
- Result (0.6.0-beta.6)
- Result (~> 1.0)
- Result (1.0.1)
- XcodeServerSDK (0.5.4):
- BuildaUtils (~> 0.2.3)

Expand All @@ -31,18 +31,18 @@ DEPENDENCIES:
- ekgclient (~> 0.3.0)
- Ji (~> 1.2.0)
- Nimble (~> 3.0.0)
- ReactiveCocoa (~> 4.0.4-alpha-1)
- ReactiveCocoa (= 4.0.0-RC.1)
- XcodeServerSDK (~> 0.5.4)

SPEC CHECKSUMS:
Alamofire: 39dddb7d3725d1771b1d2f7099c8bd45bd83ffbb
BuildaUtils: c509ce20402656700006eb5ab80c735fbf2b3864
CryptoSwift: c11640d3d66107efc8333e4131a5173f072b1d61
CryptoSwift: d382228d6301c09474132417878a741c2a2e68cd
ekgclient: 40f5d347e2ede450b3e50ac7c6bd84d96e7b84ad
Ji: ddebb22f9ac445db6e884b66f78ea74fb135fdb7
Nimble: 4c353d43735b38b545cbb4cb91504588eb5de926
ReactiveCocoa: 618a2fc13d4ed80e380aa6fa56547cef43c7341d
Result: dc390d0b58f9ec43fcd536f1ebdd130803cc6cbc
ReactiveCocoa: 2b0f654beb7642b82cfd3fdb845205ae9889422c
Result: caef80340451e1f07492fa1e89117f83613bce24
XcodeServerSDK: 38c2bbdbc8e1387480adde299c0dc4455f0af11b

COCOAPODS: 0.39.0

0 comments on commit abeff2e

Please sign in to comment.