diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/SwiftShell.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/SwiftShell.xcscheme new file mode 100644 index 0000000..3a6d60a --- /dev/null +++ b/.swiftpm/xcode/xcshareddata/xcschemes/SwiftShell.xcscheme @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sources/SwiftShell/Bash.swift b/Sources/SwiftShell/Bash.swift index 553ec49..e72b9fd 100644 --- a/Sources/SwiftShell/Bash.swift +++ b/Sources/SwiftShell/Bash.swift @@ -5,8 +5,6 @@ * */ -#if !(os(iOS) || os(tvOS) || os(watchOS)) - import Foundation // MARK: Bash @@ -97,5 +95,3 @@ Runs bash command and prints output and errors. public func runAndPrint(bash bashcommand: String) throws { return try main.runAndPrint(bash: bashcommand) } - -#endif diff --git a/Sources/SwiftShell/Command.swift b/Sources/SwiftShell/Command.swift index 3ddccf0..e3431f9 100755 --- a/Sources/SwiftShell/Command.swift +++ b/Sources/SwiftShell/Command.swift @@ -5,8 +5,6 @@ * */ -#if !(os(iOS) || os(tvOS) || os(watchOS)) - import Foundation import Dispatch @@ -471,5 +469,3 @@ Runs executable and prints output and errors. public func runAndPrint(_ executable: String, _ args: Any ...) throws { return try main.runAndPrint(executable, args) } - -#endif diff --git a/Sources/SwiftShell/Context.swift b/Sources/SwiftShell/Context.swift index cd90776..496b591 100755 --- a/Sources/SwiftShell/Context.swift +++ b/Sources/SwiftShell/Context.swift @@ -5,8 +5,6 @@ * */ -#if !(os(iOS) || os(tvOS) || os(watchOS)) - import Foundation public protocol Context: CustomDebugStringConvertible { @@ -140,5 +138,3 @@ public final class MainContext: Context, CommandRunning { } public let main = MainContext() - -#endif diff --git a/Sources/SwiftShell/Files.swift b/Sources/SwiftShell/Files.swift index d14cbf5..81c9aed 100755 --- a/Sources/SwiftShell/Files.swift +++ b/Sources/SwiftShell/Files.swift @@ -5,8 +5,6 @@ * */ -#if !(os(iOS) || os(tvOS) || os(watchOS)) - import Foundation /** The default FileManager */ @@ -87,5 +85,3 @@ public func open(forWriting path: String, overwrite: Bool = false, encoding: Str let fixedpath = path.hasPrefix("~") ? NSString(string: path).expandingTildeInPath : path return try open(forWriting: URL(fileURLWithPath: fixedpath, isDirectory: false), overwrite: overwrite, encoding: encoding) } - -#endif diff --git a/Sources/SwiftShell/Process.swift b/Sources/SwiftShell/Process.swift index f88dc9b..e635e61 100644 --- a/Sources/SwiftShell/Process.swift +++ b/Sources/SwiftShell/Process.swift @@ -5,8 +5,6 @@ // Created by Kåre Morstøl on 06/04/2018. // -#if !(os(iOS) || os(tvOS) || os(watchOS)) - import Foundation // MARK: Process @@ -146,4 +144,3 @@ extension Process { } } #endif -#endif diff --git a/Sources/SwiftShell/Stream/Stream.swift b/Sources/SwiftShell/Stream/Stream.swift index 81710e0..891707d 100644 --- a/Sources/SwiftShell/Stream/Stream.swift +++ b/Sources/SwiftShell/Stream/Stream.swift @@ -36,7 +36,7 @@ extension FileHandle { extension FileHandle { public func write(_ string: String, encoding: String.Encoding = .utf8) { - #if !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) + #if !(os(macOS) || os(tvOS)) guard !string.isEmpty else { return } #endif guard let data = string.data(using: encoding, allowLossyConversion: false) else { @@ -46,11 +46,6 @@ extension FileHandle { } } -#if os(iOS) || os(tvOS) || os(watchOS) -/// CommandRunning is not available on iOS, tvOS and watchOS. -public protocol CommandRunning {} -#endif - /// A stream of text. Does as much as possible lazily. public protocol ReadableStream: class, TextOutputStreamable, CommandRunning { var encoding: String.Encoding {get set} @@ -85,13 +80,11 @@ extension ReadableStream { while let text = self.readSome() { target.write(text) } } - #if !(os(iOS) || os(tvOS) || os(watchOS)) public var context: Context { var context = CustomContext(main) context.stdin = self return context } - #endif /// All the data the stream contains so far. /// If the source is a file this will read everything at once. @@ -111,7 +104,6 @@ extension ReadableStream { } } -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) extension ReadableStream { /// Sets code to be executed whenever there is new output available. /// - Note: if the stream is read from outside of `handler`, or more than once inside @@ -133,7 +125,6 @@ extension ReadableStream { } } } -#endif /// An output stream, like standard output or a writeable file. public protocol WritableStream: class, TextOutputStream { diff --git a/Sources/SwiftShell/String.swift b/Sources/SwiftShell/String.swift index 7c71945..04afb56 100644 --- a/Sources/SwiftShell/String.swift +++ b/Sources/SwiftShell/String.swift @@ -5,8 +5,6 @@ * */ -#if !(os(iOS) || os(tvOS) || os(watchOS)) - import Foundation /// Lets String run commands using itself as stdin. @@ -22,8 +20,6 @@ extension String: CommandRunning { } } -#endif - extension String { /// Splits text into lines (as separated by newlines). public func lines() -> [String] { diff --git a/SwiftShell.podspec b/SwiftShell.podspec index dc88f06..411f847 100644 --- a/SwiftShell.podspec +++ b/SwiftShell.podspec @@ -9,5 +9,4 @@ Pod::Spec.new do |s| s.source = { git: 'https://github.com/kareman/SwiftShell.git', tag: s.version.to_s } s.source_files = 'Sources/SwiftShell/*.swift','Sources/SwiftShell/*/*.swift' s.osx.deployment_target = '10.11' - s.ios.deployment_target = '9.0' end diff --git a/Tests/StreamTests/Stream_Tests.swift b/Tests/StreamTests/Stream_Tests.swift index 48bbd57..0c86859 100755 --- a/Tests/StreamTests/Stream_Tests.swift +++ b/Tests/StreamTests/Stream_Tests.swift @@ -39,7 +39,6 @@ public class Stream_Tests: XCTestCase { XCTAssertEqual(reader.readData(), data.base64EncodedData()) } -#if !(os(iOS) || os(tvOS) || os(watchOS)) func testReadableStreamRun() { let (writer,reader) = streams() @@ -57,7 +56,6 @@ public class Stream_Tests: XCTestCase { XCTAssertEqual(reader.runAsync("cat").stdout.read(), "one") } -#endif func testPrintStream() { let (writer,reader) = streams() @@ -104,14 +102,11 @@ public class Stream_Tests: XCTestCase { XCTAssertEqual(reader.readSome(), text) } -#if !(os(iOS) || os(tvOS) || os(watchOS)) func testWriteStreamToAnotherStreamCompiles() { var file = try! open(forWriting: "/tmp/testWriteStreamToAnotherStreamCompiles.txt") runAsync("echo", "arg1").stdout.runAsync("wc").stdout.write(to: &file) } -#endif -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) func testOnOutput() { let (writer,reader) = streams() @@ -136,10 +131,9 @@ public class Stream_Tests: XCTestCase { writer.write("hi") waitForExpectations(timeout: 0.5, handler: nil) } -#endif } -#if !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) +#if !(os(macOS) || os(tvOS)) extension Stream_Tests { public static var allTests = [ ("testStreams", testStreams),