Skip to content

Commit

Permalink
Merge pull request #3 from qutheory/preview-2
Browse files Browse the repository at this point in the history
swift 3 preview 2
  • Loading branch information
tanner0101 authored Jul 12, 2016
2 parents c1787df + 545c0ad commit d4bf284
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 19 deletions.
3 changes: 2 additions & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
DEVELOPMENT-SNAPSHOT-2016-06-20-a
3.0-PREVIEW-2

7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ sudo: required
dist: trusty
osx_image: xcode8
install:
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/02090c7ede5a637b76e6df1710e83cd0bbe7dcdf/swiftenv-install.sh)"
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/02090c7ede5a637b76e6df1710e83cd0bbe7dcdf/swiftenv-install.sh)"; fi
script:
# Build Console
- swift build;
- swift build --configuration release;
- swift build -Xswiftc -DSimple
- swift build --configuration release -Xswiftc -DSimple
# Test Console
- swift test

8 changes: 7 additions & 1 deletion Sources/Console/Bar/Bar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ public class Bar {

let message = message ?? "Done"

collapseBar(message: message, style: .success)
#if Simple
prepareLine()
console.output(title, style: titleStyle, newLine: false)
console.output(" [\(message)]", style: .success)
#else
collapseBar(message: message, style: .success)
#endif
}

func collapseBar(message: String, style: ConsoleStyle) {
Expand Down
16 changes: 9 additions & 7 deletions Sources/Console/Bar/Loading/LoadingBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,17 @@ public class LoadingBar: Bar {
}

public func start() {
do {
thread = try Strand { [weak self] in
while true {
self?.update()
#if !Simple
do {
thread = try Strand { [weak self] in
while true {
self?.update()
}
}
} catch {
console.info("[Loading]")
}
} catch {
console.info("Loading...")
}
#endif
}

deinit {
Expand Down
2 changes: 2 additions & 0 deletions Sources/Console/Bar/Progress/ProgressBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
public class ProgressBar: Bar {
public var progress: Double {
didSet {
#if !Simple
update()
#endif
}
}

Expand Down
6 changes: 3 additions & 3 deletions Sources/Console/Terminal/Terminal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public class Terminal: Console {
}

public func execute(_ command: String) throws {
let input = FileHandle.standardInput()
let output = FileHandle.standardOutput()
let error = FileHandle.standardError()
let input = FileHandle.withStandardInput
let output = FileHandle.withStandardOutput
let error = FileHandle.withStandardError

try execute(command, input: input, output: output, error: error)
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/Console/Utilities/LinuxFixes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ extension Data {
}

extension FileHandle {
static func standardError() -> FileHandle {
static var withStandardError: FileHandle {
return fileHandleWithStandardError()
}

static func standardOutput() -> FileHandle {
static var withStandardOutput: FileHandle {
return fileHandleWithStandardOutput()
}

static func standardInput() -> FileHandle {
static var withStandardInput: FileHandle {
return fileHandleWithStandardInput()
}
}
Expand Down

0 comments on commit d4bf284

Please sign in to comment.