diff --git a/.gitignore b/.gitignore index 422fad7..ce4df9b 100644 --- a/.gitignore +++ b/.gitignore @@ -171,4 +171,5 @@ crashlytics-build.properties Examples/Rome/ TestPackage/.build .build/ -SwiftlineTests/Carthage/Checkouts \ No newline at end of file +SwiftlineTests/Carthage/Checkouts +.DS_STORE \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 288b1e8..9fe47fb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ install: script: +- make generate - make test - pod lib lint --quick diff --git a/Examples/ColorizeExample.swift b/Examples/ColorizeExample.swift deleted file mode 100755 index 1482bc9..0000000 --- a/Examples/ColorizeExample.swift +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env xcrun swift -F ./Rome/ -framework Swiftline - -import Swiftline - - -// To change the text color, use either string.f or string.foreground: -print("Red String".f.Red) -print("Blue String".foreground.Blue) - - -// To change the text background color, use either string.b or string.background: -print("I have a white background".b.White) -print("My background color is green".background.Green) - - -// To change the text background color, use either string.s or string.style: -print("I am a bold string".s.Bold) -print("I have an underline".style.Underline) - - -// You can compose foreground, background, and style: -print("I am an underlined red on white string".s.Underline.f.Red.b.White) diff --git a/Examples/EnvAndArgs.swift b/Examples/EnvAndArgs.swift deleted file mode 100644 index 559b22c..0000000 --- a/Examples/EnvAndArgs.swift +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env xcrun swift -F ./Rome/ -framework Swiftline - -import Swiftline - - -// print(Env.get("PWD")!) -print("All Environment Variables") -print(Env.keys.joinWithSeparator("\n")) - -print("\nPrinting value of PWD") -print(Env.get("PWD")!) - -print("\nPrint all Arguments") -print(Args.all) - -print("\nPrint parsed Arguments") -print(Args.parsed.flags["target"]!) -print(Args.parsed.flags["framework"]!) -print(Args.parsed.parameters) diff --git a/Examples/Package.swift b/Examples/Package.swift new file mode 100644 index 0000000..6dff7b5 --- /dev/null +++ b/Examples/Package.swift @@ -0,0 +1,7 @@ +import PackageDescription + +let package = Package(name: "Example", + dependencies: [ + .Package(url: "../", majorVersion: 0), + ] +) diff --git a/Examples/Podfile b/Examples/Podfile deleted file mode 100644 index 9ebb516..0000000 --- a/Examples/Podfile +++ /dev/null @@ -1,6 +0,0 @@ -platform :osx, '10.10' -plugin 'cocoapods-rome' - -pod 'Swiftline', :path => '../Swiftline.podspec' -pod 'Quick', '~> 0.8.0' -pod 'Nimble', '~> 3.0.0' diff --git a/Examples/Podfile.lock b/Examples/Podfile.lock deleted file mode 100644 index 6488728..0000000 --- a/Examples/Podfile.lock +++ /dev/null @@ -1,20 +0,0 @@ -PODS: - - Nimble (3.0.0) - - Quick (0.8.0) - - Swiftline (0.3.0) - -DEPENDENCIES: - - Nimble (~> 3.0.0) - - Quick (~> 0.8.0) - - Swiftline (from `../Swiftline.podspec`) - -EXTERNAL SOURCES: - Swiftline: - :path: "../Swiftline.podspec" - -SPEC CHECKSUMS: - Nimble: 4c353d43735b38b545cbb4cb91504588eb5de926 - Quick: 563d0f6ec5f72e394645adb377708639b7dd38ab - Swiftline: ce5af5788d6dbbbd4a54ae76d0f5f1f2f3edccec - -COCOAPODS: 0.39.0 diff --git a/Examples/Readme.md b/Examples/Readme.md index bc3978a..e7d9f7a 100644 --- a/Examples/Readme.md +++ b/Examples/Readme.md @@ -1,18 +1,11 @@ To run examples -Install [cocoapods-rome](https://github.com/neonichu/Rome) +Run `swift build` - $ gem install cocoapods-rome -Run `pod install` +This will build all the examples that can be found in `.build`: ---- -To run any example: - - chmod a+x Example.swift - ./Example.swift - - -For example to run `ColorizeExample.swift` - - chmod a+x ColorizeExample.swift - ./ColorizeExample.swift +- `agree_example` shows the `agree` functionality +- `args_example` shows the `args` parsing functionality +- `ask_example` shows the `ask` functionality +- `choose_example` shows the `choose` functionality +- `colorize_example` shows the `colorize` functionality \ No newline at end of file diff --git a/Examples/RunnerExample.swift b/Examples/RunnerExample.swift deleted file mode 100755 index 5258f3f..0000000 --- a/Examples/RunnerExample.swift +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env xcrun swift -F ./Rome/ -framework Swiftline - -import Swiftline - - -// Simpler runner -let result1 = run("ls -all") -print("Result \n\(result1.stdout)\n") - -// Run with arguments -let result2 = run("ls", args: "-all") -print("Result \n\(result2.stdout)\n") - - -// Costumize run -let result3 = run("ls -all") { settings in - settings.dryRun = true - settings.echo = [.Stdout, .Stderr, .Command] - settings.interactive = false -} -print("Result \n\(result3.stdout)\n") diff --git a/Examples/AgreeExample.swift b/Examples/src/agree_example/main.swift similarity index 59% rename from Examples/AgreeExample.swift rename to Examples/src/agree_example/main.swift index 1b9cee6..48557d0 100755 --- a/Examples/AgreeExample.swift +++ b/Examples/src/agree_example/main.swift @@ -1,5 +1,3 @@ -#!/usr/bin/env xcrun swift -F ./Rome/ -framework Swiftline - import Swiftline let answer = agree("Are you shwifty?") diff --git a/Examples/src/args_example/main.swift b/Examples/src/args_example/main.swift new file mode 100644 index 0000000..0ae7b29 --- /dev/null +++ b/Examples/src/args_example/main.swift @@ -0,0 +1,9 @@ +import Swiftline + +print("\nPrint all Arguments") +print(Args.all) + +print("\nPrint parsed Arguments") +print("Target = \(Args.parsed.flags["target"] ?? "")") +print("Framework = \(Args.parsed.flags["framework"] ?? "")") +print(Args.parsed.parameters) diff --git a/Examples/AskExample.swift b/Examples/src/ask_example/main.swift similarity index 72% rename from Examples/AskExample.swift rename to Examples/src/ask_example/main.swift index 8ef4d4a..7f92589 100755 --- a/Examples/AskExample.swift +++ b/Examples/src/ask_example/main.swift @@ -1,5 +1,3 @@ -#!/usr/bin/env xcrun swift -F ./Rome/ -framework Swiftline - import Swiftline // Ask for a String @@ -14,10 +12,11 @@ print("\nYour age is \(age)\n") // Ask with validation let name = ask("Who are you?") { settings in - settings.addInvalidCase("Snuffles is not allowed") { value in - value.containsString("Snuffles") - } + settings.addInvalidCase("Snuffles is not allowed") { value in + return value == "snuffles" + } } + print("\nYour are \(name)\n") diff --git a/Examples/ChooseExample.swift b/Examples/src/choose_example/main.swift similarity index 89% rename from Examples/ChooseExample.swift rename to Examples/src/choose_example/main.swift index c6c7567..edb1aab 100755 --- a/Examples/ChooseExample.swift +++ b/Examples/src/choose_example/main.swift @@ -1,5 +1,3 @@ -#!/usr/bin/env xcrun swift -F ./Rome/ -framework Swiftline - import Swiftline @@ -24,7 +22,7 @@ let choice3 = choose("Whats your favorite programming language? ", type: String. //choice value will be set to BAD settings.addChoice("Java") { "BAD" } - settings.index = .Letters + settings.index = .letters settings.indexSuffix = " ----> " } print("Your choice is \(choice3)") diff --git a/Examples/src/colorize_example/main.swift b/Examples/src/colorize_example/main.swift new file mode 100755 index 0000000..63ca68d --- /dev/null +++ b/Examples/src/colorize_example/main.swift @@ -0,0 +1,20 @@ +import Swiftline + + +// To change the text color, use either string.f or string.foreground: +print("Red String".f.red) +print("Blue String".foreground.blue) + + +// To change the text background color, use either string.b or string.background: +print("I have a white background".b.white) +print("My background color is green".background.green) + + +// To change the text background color, use either string.s or string.style: +print("I am a bold string".s.bold) +print("I have an underline".style.underline) + + +// You can compose foreground, background, and style: +print("I am an underlined red on white string".s.underline.f.red.b.white) diff --git a/Makefile b/Makefile index f01d2b2..f5b41b7 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,23 @@ -build_help: - cd SwiftlineTests && jazzy \ - --clean \ - --author NSOmar \ - --author_url https://nsomar.com \ - --github_url https://github.com/swiftline/swiftline \ - --github-file-prefix https://github.com/swiftline/swiftline \ - --module-version 0.2.0 \ +test: + xcodebuild -project Swiftline.xcodeproj -scheme Swiftline build test + +coverage: + slather coverage Swiftline.xcodeproj + +generate: + swift package generate-xcodeproj --enable-code-coverage + +doc: + rm -rf docs + make generate + + jazzy \ + --author "Omar Abdelhafith" \ + --author_url http://swifline.com \ + --github_url https://github.com/oarrabi/Swiftline/tree/master \ --xcodebuild-arguments -scheme,Swiftline \ - --module Swiftline \ + --github-file-prefix https://github.com/oarrabi/Swiftline \ + --theme fullwidth --output ../../Docs/swift_output git stash git checkout gh-pages @@ -20,14 +30,3 @@ build_help: git push origin gh-pages --force git co - - git stash pop - -test: - cd SwiftlineTests; xcodebuild -project Swiftline.xcodeproj -scheme Swiftline clean build test -sdk macosx GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES - -test-spm: - cd TestPackage && rm -rf .build - cd TestPackage && swift build - -build-spm: - rm -rf .build - swift build diff --git a/Package.swift b/Package.swift index 496ee80..874a6f4 100644 --- a/Package.swift +++ b/Package.swift @@ -1,5 +1,6 @@ import PackageDescription let package = Package( - name: "Swiftline" + name: "Swiftline", + dependencies: [.Package(url: "https://github.com/oarrabi/StringScanner", majorVersion: 0)] ) diff --git a/Readme.md b/Readme.md index fe23936..697824c 100644 --- a/Readme.md +++ b/Readme.md @@ -5,21 +5,43 @@ [![Build Status](https://travis-ci.org/oarrabi/Swiftline.svg?branch=master)](https://travis-ci.org/oarrabi/Swiftline) [![Platform](https://img.shields.io/badge/platform-osx-lightgrey.svg)](https://travis-ci.org/Swiftline/Swiftline) [![Language: Swift](https://img.shields.io/badge/language-swift-orange.svg)](https://travis-ci.org/Swiftline/Swiftline) -[![CocoaPods](https://img.shields.io/cocoapods/v/Swiftline.svg)](https://cocoapods.org/pods/Swiftline) -[![Carthage](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![GITTER: join chat](https://img.shields.io/badge/GITTER-join%20chat-00D06F.svg)](https://gitter.im/Swiftline?utm_source=share-link&utm_medium=link&utm_campaign=share-link) [![GITTER: join chat](https://img.shields.io/badge/license-MIT-000000.svg)](https://github.com/Swiftline/Swiftline/blob/oarrabi/adding-env-and-args/LICENCE)
-Swiftline is a set of tools to help you create command line applications. Swiftline is inspired by [highline](https://github.com/JEG2/highline) +Swiftline is a set of tools to help you create cross platform (Mac and Linux) command line applications. Swiftline is inspired by [highline](https://github.com/JEG2/highline)
Swiftline contains the following: - Colorize: Helps adding colors to strings written to the terminal - Ask , Choose and agree: Easily create prompt for asking the user more info -- Run: A quick way to run an external command and read its standard output and standard error. -- Env: Read and write environment variables [ruby-flavored](http://ruby-doc.org/core-2.2.0/ENV.html) +- Run: A quick way to run an external command and read its standard output and standard error. (Note: moved out to its own repo [https://github.com/oarrabi/Process](https://github.com/oarrabi/Process)) +- Env: Read and write environment variables [ruby-flavored](http://ruby-doc.org/core-2.2.0/ENV.html) (Note: moved out to its own repo [https://github.com/oarrabi/Env](https://github.com/oarrabi/Env)) - Args: Parses command line arguments and return a hash of the passed flags +## 🆕 Note on deprecation and the future of Swiftline +In order to keep improving on `Swiftline` some functionality has been moved to seperate projects. +Environment reading and external command execution has been removed from `Swiftline` and promoted to their own projects. +- External command execution (Runner 🏃) can be found here [https://github.com/oarrabi/Process](https://github.com/oarrabi/Process) +- Environment reading (Env) can now be found here [https://github.com/oarrabi/Env](https://github.com/oarrabi/Env) + +You can add these functionalities again to your project: +- Open your `Package.swift` +- Add `Env` and `Process` as 2 new dependencies + +The updated `Package.swift` should look like: + +```swift +import PackageDescription + +let package = Package(name: "Example", + dependencies: [ + .Package(url: "https://github.com/oarrabi/Swiftline", majorVersion: 0), + .Package(url: "https://github.com/oarrabi/Env", majorVersion: 0), + .Package(url: "https://github.com/oarrabi/Process", majorVersion: 0), + ] +) +``` + ## Contents [Usage](#usage) [Installation](#installation) @@ -36,27 +58,28 @@ Colorize works by extending `String` struct to add styling to it. To change the text color, use either `string.f` or `string.foreground`: ```swift - print("Red String".f.Red) - print("Blue String".foreground.Blue) +print("Red String".f.Red) +print("Blue String".foreground.Blue) ``` To change the text background color, use either `string.b` or `string.background`: ```swift - print("I have a white background".b.White) - print("My background color is green".background.Green) +print("I have a white background".b.White) +print("My background color is green".background.Green) ``` To change the text background style, use either `string.s` or `string.style`: ```swift - print("I am a bold string".s.Bold) - print("I have an underline".style.Underline) +print("I am a bold string".s.Bold) +print("I have an underline".style.Underline) ``` You can compose foreground, background, and style: + ```swift - print("I am an underlined red on white string".s.Underline.f.Red.b.White) +print("I am an underlined red on white string".s.Underline.f.Red.b.White) ``` ## Ask, Choose, Agree ❓ @@ -64,194 +87,155 @@ Ask, Choose and Agree are used to prompt the user for more information. ### Ask Ask presents the user with a prompt and waits for the user input. + ```swift - let userName = ask("Enter user name?") +let userName = ask("Enter user name?") ``` + `userName` will contain the name entered by the user Ask can be used to ask for value of Int, Double or Float types, to ask for an integer for example: ```swift - let age = ask("How old are you?", type: Int.self) +let age = ask("How old are you?", type: Int.self) ``` + If the user prints something thats not convertible to integer, a new prompt is displayed to him, this prompt will keep displaying until the user enters an Int: - How old are you? - None - You must enter a valid Integer. - ? Error - You must enter a valid Integer. - ? 5 - 5 +``` +How old are you? +None +You must enter a valid Integer. +? Error +You must enter a valid Integer. +? 5 +5 +``` + Validations are added by calling `addInvalidCase` on `AskSettings`. ```swift - let name = ask("Who are you?") { settings in - settings.addInvalidCase("Snuffles is not allowed") { value in - value.containsString("Snuffles") - } +let name = ask("Who are you?") { settings in + settings.addInvalidCase("Snuffles is not allowed") { value in + value.containsString("Snuffles") } +} ``` -If the user entered `Snuffles` ask will keep displaying the invalid message passed to `addInvalidCase` - Who are you? - Snuffles - Snuffles is not allowed - ? Snuffles - Snuffles is not allowed - ? Snowball +If the user entered `Snuffles` ask will keep displaying the invalid message passed to `addInvalidCase` - Your name is Snowball +``` +Who are you? +Snuffles +Snuffles is not allowed +? Snuffles +Snuffles is not allowed +? Snowball + +Your name is Snowball +``` `AskSettings.confirm` will ask the user to confirm his choice after entering it ```swift - let name = ask("Who are you?") { settings in - settings.confirm = true - } +let name = ask("Who are you?") { settings in + settings.confirm = true +} ``` The above will output: - Who are you? - Snuffles - Are you sure? YES +``` +Who are you? +Snuffles +Are you sure? YES + +Your name is Snuffles +``` - Your name is Snuffles ### Choose Choose is used to prompt the user to select an item between several possible items. To display a choice of programming lanaugage for example: + ```swift - let choice = choose("Whats your favorite programming language? ", - choices: "Swift", "Objective C", "Ruby", "Python", "Java :S") +let choice = choose("Whats your favorite programming language? ", + choices: "Swift", "Objective C", "Ruby", "Python", "Java :S") ``` This will print: - 1. Swift - 2. Objective C - 3. Ruby - 4. Python - 5. Java :S - Whats your favorite programming language? +``` +1. Swift +2. Objective C +3. Ruby +4. Python +5. Java :S +Whats your favorite programming language? +``` The user can either choose the numbers (1..5) or the item itself. If the user enters a wrong input. A prompt will keep showing until the user makes a correct choice - Whats your favorite programming language? JavaScript - You must choose one of [1, 2, 3, 4, 5, Swift, Objective C, Ruby, Python, Java :S]. - ? BBB - You must choose one of [1, 2, 3, 4, 5, Swift, Objective C, Ruby, Python, Java :S]. - ? Swift +``` +Whats your favorite programming language? JavaScript +You must choose one of [1, 2, 3, 4, 5, Swift, Objective C, Ruby, Python, Java :S]. +? BBB +You must choose one of [1, 2, 3, 4, 5, Swift, Objective C, Ruby, Python, Java :S]. +? Swift - You selected Swift, good choice! +You selected Swift, good choice! +``` You can customize the return value for each choice element. For example if you want to get an Int from the choice, you would do this ```swift - let choice = choose("Whats your favorite programming language? ", type: Int.self) { settings in - settings.addChoice("Swift") { 42 } - settings.addChoice("Objective C") { 20 } - } +let choice = choose("Whats your favorite programming language? ", type: Int.self) { settings in + settings.addChoice("Swift") { 42 } + settings.addChoice("Objective C") { 20 } +} ``` The number on the left can be changed to letters, here is how you could do that: ```siwft - let choice = choose("Whats your favorite programming language? ", type: String.self) { settings in - //choice value will be set to GOOD - settings.addChoice("Swift") { "GOOD" } +let choice = choose("Whats your favorite programming language? ", type: String.self) { settings in + //choice value will be set to GOOD + settings.addChoice("Swift") { "GOOD" } - //choice value will be set to BAD - settings.addChoice("Java") { "BAD" } + //choice value will be set to BAD + settings.addChoice("Java") { "BAD" } - settings.index = .Letters - settings.indexSuffix = " ----> " - } + settings.index = .Letters + settings.indexSuffix = " ----> " +} ``` That will print: - a ----> Swift - b ----> Java - Whats your favorite programming language? +``` +a ----> Swift +b ----> Java +Whats your favorite programming language? +``` ### Agree Agree is used to ask a user for a Yes/No question. It returns a boolean representing the user input. ```swift - let choice = agree("Are you sure you want to `rm -rf /` ?") +let choice = agree("Are you sure you want to `rm -rf /` ?") ``` If the user enters any invalid input, agree will keep prompting him for a Yes/No question - Are you sure you want to `rm -rf /` ? What! - Please enter "yes" or "no". - Are you sure you want to `rm -rf /` ? Wait - Please enter "yes" or "no". - Are you sure you want to `rm -rf /` ? No - - You entered false - -## Run 🏃 -Run provides a quick, concise way to run an external command and read its standard output and standard error. - -To execute a simple command you would do: - -```swift - let result = run("ls -all") - print(result.stdout) -``` -`result` type is `RunResults`, it contains: - -- `exitStatus`: The command exit status -- `stdout`: The standard output for the command executed -- `stderr`: The standard error for the command executed - -While `run("command")` can split the arguments by spaces. Some times argument splitting is not trivial. If you have multiple argument to pass to the command to execute, you should use `run(command: String, args: String...)`. The above translates to: - -```swift - let result = run("ls", args: "-all") ``` +Are you sure you want to `rm -rf /` ? What! +Please enter "yes" or "no". +Are you sure you want to `rm -rf /` ? Wait +Please enter "yes" or "no". +Are you sure you want to `rm -rf /` ? No -To customize the run function, you can pass in a customization block: - -```swift - let result = run("ls -all") { settings in - settings.dryRun = true - settings.echo = [.Stdout, .Stderr, .Command] - settings.interactive = false - } -``` - -`settings` is an instance of RunSettings, which contains the following variables: - -- `settings.dryRun`: defaults to false. If false, the command is actually run. If true, the command is logged to the stdout paramter of result -- `settings.echo`: Customize the message printed to stdout, `echo` can contain any of the following: - - `EchoSettings.Stdout`: The stdout returned from running the command will be printed to the terminal - - `EchoSettings.Stderr`: The stderr returned from running the command will be printed to the terminal - - `EchoSettings.Command`: The command executed will be printed to the terminal -- `settings.interactive`: defaults to false. If set to true the command will be executed using `system` kernel function and only the exit status will be captured. If set to false, the command will be executed using `NSTask` and both stdout and stderr will be captured. -Set `interactive` to true if you expect the launched command to ask input from the user through the stdin. - -`runWithoutCapture("command")` is a quick way to run a command in interactive mode. The return value is the exit code of that command. - -## Env -Env is used to read and write the environment variables passed to the script -```swift -// Set enviroment variable -Env.set("key1", "value1") - -// Get environment variable -Env.get("SomeKey") - -// Clear all variables -Env.clear() - -// Get all keys and values -Env.keys() -Env.values() +You entered false ``` ## Args @@ -268,39 +252,29 @@ Returns the arguments passed to the script. For example when calling `script -f1 `Args.parsed.command` returns the name of the executable itself `"script"` -## Installation -You can install Swiftline using CocoaPods, carthage and Swift package manager +## Run 🏃 +The run/execution functionality has been split out of swiftline to its own project. If you want to lanunch an external process you can use Process library [https://github.com/oarrabi/Process](https://github.com/oarrabi/Process) -### CocoaPods - use_frameworks! - pod 'Swiftline' +## Env +The environment reading and writing functionality has been split out of swiftline to its own project. Find it here [https://github.com/oarrabi/Env](https://github.com/oarrabi/Env) -### Carthage - github 'swiftline/swiftline' +## Installation +You can install Swiftline using Swift package manager: -### Swift Package Manager Add swiftline as dependency in your `Package.swift` -``` - import PackageDescription +```swift +import PackageDescription - let package = Package(name: "YourPackage", - dependencies: [ - .Package(url: "https://github.com/Swiftline/Swiftline.git", majorVersion: 0, minor: 3), - ] - ) +let package = Package(name: "YourPackage", +dependencies: [ + .Package(url: "https://github.com/oarrabi/Swiftline.git", majorVersion: 0, minor: 3), +] +) ``` -### CocoaPods + Rome plugin -If you want to use swiftline in a script you can use [Rome](https://github.com/neonichu/Rome) CocoaPods plugin. This plugin builds the framework from the pod file and place them in a Rome directory. - - platform :osx, '10.10' - plugin 'cocoapods-rome' - - pod 'Swiftline' - ### Manual -To install Swiftline manually, add `Pod/Swiftline` directory to your project. +To install Swiftline manually, copy the `src` directory from this repo to your project. ## Examples A list of examples can be found [here](https://github.com/oarrabi/Swiftline/tree/master/Examples) @@ -314,8 +288,6 @@ Documentation can be found [here](http://swiftline.github.io/docs/index.html) ## Future Improvement - Add gather (from [highline](https://github.com/JEG2/highline)) to ask function -- Figure out a way to eliminate the need of `interactive` -- Add Glob handling - Better documentation ## Credits diff --git a/Source/CommandExecutor.swift b/Source/CommandExecutor.swift deleted file mode 100644 index b3002b9..0000000 --- a/Source/CommandExecutor.swift +++ /dev/null @@ -1,106 +0,0 @@ -// -// CommandExecutor.swift -// CommandExecutor -// -// Created by Omar Abdelhafith on 05/11/2015. -// Copyright © 2015 Omar Abdelhafith. All rights reserved. -// - -import Foundation - - -typealias ExecutorReturnValue = (status: Int, standardOutput: TaskPipe, standardError: TaskPipe) - -class CommandExecutor { - - static var currentTaskExecutor: TaskExecutor = ActualTaskExecutor() - - class func execute(_ commandParts: [String]) -> ExecutorReturnValue { - return currentTaskExecutor.execute(commandParts) - } -} - - -protocol TaskExecutor { - func execute(_ commandParts: [String]) -> ExecutorReturnValue -} - -class DryTaskExecutor: TaskExecutor { - - func execute(_ commandParts: [String]) -> ExecutorReturnValue { - let command = commandParts.joined(separator: " ") - PromptSettings.print("Executed command '\(command)'") - return (0, - Dryipe(dataToReturn: "".data(using: String.Encoding.utf8)!), - Dryipe(dataToReturn: "".data(using: String.Encoding.utf8)!)) - } -} - -class ActualTaskExecutor: TaskExecutor { - - func execute(_ commandParts: [String]) -> ExecutorReturnValue { - let task = Process() - - task.launchPath = "/usr/bin/env" - task.arguments = commandParts - - let stdoutPipe = Pipe() - let stderrPipe = Pipe() - - task.standardOutput = stdoutPipe - task.standardError = stderrPipe - task.launch() - task.waitUntilExit() - - return (Int(task.terminationStatus), stdoutPipe, stderrPipe) - } -} - -class InteractiveTaskExecutor: TaskExecutor { - - func execute(_ commandParts: [String]) -> ExecutorReturnValue { - - let argv: [UnsafeMutablePointer?] = commandParts.map{ $0.withCString(strdup) } - defer { for case let arg? in argv { free(arg) } } - - var childFDActions: posix_spawn_file_actions_t? = nil - var outputPipe: [Int32] = [-1, -1] - - posix_spawn_file_actions_init(&childFDActions) - posix_spawn_file_actions_adddup2(&childFDActions, outputPipe[1], 1) - posix_spawn_file_actions_adddup2(&childFDActions, outputPipe[1], 2) - posix_spawn_file_actions_addclose(&childFDActions, outputPipe[0]) - posix_spawn_file_actions_addclose(&childFDActions, outputPipe[1]) - - - var pid: pid_t = 0 - let result = posix_spawn(&pid, argv[0], &childFDActions, nil, argv + [nil], nil) - - let emptyPipe = Dryipe(dataToReturn: "".data(using: String.Encoding.utf8)!) - return (Int(result), emptyPipe, emptyPipe) - } -} - -class DummyTaskExecutor: TaskExecutor { - - var commandsExecuted: [String] = [] - let statusCodeToReturn: Int - - let errorToReturn: String - let outputToReturn: String - - init(status: Int, output: String, error: String) { - statusCodeToReturn = status - outputToReturn = output - errorToReturn = error - } - - func execute(_ commandParts: [String]) -> ExecutorReturnValue { - let command = commandParts.joined(separator: " ") - commandsExecuted.append(command) - - return (statusCodeToReturn, - Dryipe(dataToReturn: outputToReturn.data(using: String.Encoding.utf8)!), - Dryipe(dataToReturn: errorToReturn.data(using: String.Encoding.utf8)!)) - } -} diff --git a/Source/Env.swift b/Source/Env.swift deleted file mode 100644 index c09189c..0000000 --- a/Source/Env.swift +++ /dev/null @@ -1,95 +0,0 @@ -// -// Env.swift -// Swiftline -// -// Created by Omar Abdelhafith on 24/11/2015. -// Copyright © 2015 Omar Abdelhafith. All rights reserved. -// - -import Darwin - - -public class Env { - - /// Return the list of all the enviromenment keys passed to the script - public static var keys: [String] { - let keyValues = run("env").stdout.components(separatedBy: "\n") - let keys = keyValues.map { $0.components(separatedBy: "=").first! }.filter { !$0.isEmpty } - return keys - } - - /// Return the list of all the enviromenment values passed to the script - public static var values: [String] { - return self.keys.map { self.get($0)! } - } - - /** - Return the enviromenment for the provided key - - - parameter key: The enviromenment variable key - - - returns: The enviromenment variable value - */ - public static func get(_ key: String) -> String? { - guard let value = getenv(key) else { return nil } - return String(cString: value) - } - - /** - Set a new value for the enviromenment variable - - - parameter key: The enviromenment variable key - - parameter value: The enviromenment variable value - */ - public static func set(_ key: String, _ value: String?) { - if let newValue = value { - setenv(key, newValue, 1) - } else { - unsetenv(key) - } - } - - - /** - Clear all the enviromenment variables - */ - public static func clear() { - self.keys - .map { String($0) } - .filter { $0 != nil } - .forEach{ self.set($0!, nil) } - } - - /** - Check if the enviromenment variable key exists - - - parameter key: The enviromenment variable key - - - returns: true if exists false otherwise - */ - public static func hasKey(_ key: String) -> Bool { - return self.keys.contains(key) - } - - - /** - Check if the enviromenment variable value exists - - - parameter key: The enviromenment variable value - - - returns: true if exists false otherwise - */ - public static func hasValue(_ value: String) -> Bool { - return self.values.contains(value) - } - - /** - Iterate through the list of enviromenment variables - - - parameter callback: callback to call on each key/value pair - */ - public static func eachPair(_ callback: (_ key: String, _ value: String) -> ()) { - zip(self.keys, self.values).forEach(callback) - } - -} diff --git a/Source/Glob.swift b/Source/Glob.swift deleted file mode 100644 index 392e57d..0000000 --- a/Source/Glob.swift +++ /dev/null @@ -1,33 +0,0 @@ -// -// Glob.swift -// Swiftline -// -// Created by Omar Abdelhafith on 30/11/2015. -// Copyright © 2015 Omar Abdelhafith. All rights reserved. -// - -import Foundation -import Darwin - -class Glob { - - static func expand(_ pattern: String) -> [String] { - var files = [String]() - var gt: glob_t = glob_t() - - if (glob(pattern.cString(using: String.Encoding.utf8)!, 0, nil, >) == 0) { - - for i in (0..(x)! - let s = String.init(cString: c) - files.append(s) - } - - } - - globfree(>); - return files - } - -} diff --git a/Source/ProcessInfo.swift b/Source/ProcessInfo.swift deleted file mode 100644 index fdd75a2..0000000 --- a/Source/ProcessInfo.swift +++ /dev/null @@ -1,48 +0,0 @@ -// -// ProcessInfo.swift -// Swiftline -// -// Created by Omar Abdelhafith on 26/11/2015. -// Copyright © 2015 Omar Abdelhafith. All rights reserved. -// - -import Foundation - - -protocol ProcessInfoType { - var arguments: [String] { get } - var cacheResults: Bool { get } -} - -extension Foundation.ProcessInfo: ProcessInfoType { - var cacheResults: Bool { return true } -} - -class DummyProcessInfo: ProcessInfoType { - - var argsToReturn: [String] - - init(_ argsToReturn: String...) { - self.argsToReturn = argsToReturn - } - - var arguments: [String] { - return argsToReturn - } - - var cacheResults: Bool { return false } -} - -class ProcessInfo { - - static var internalProcessInfo: ProcessInfoType = Foundation.ProcessInfo() - - static var arguments: [String] { - return internalProcessInfo.arguments - } - - static var cacheResults: Bool { - return internalProcessInfo.cacheResults - } - -} diff --git a/Source/RunResults.swift b/Source/RunResults.swift deleted file mode 100644 index a3b0e87..0000000 --- a/Source/RunResults.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// RunResult.swift -// RunResults -// -// Created by Omar Abdelhafith on 05/11/2015. -// Copyright © 2015 Omar Abdelhafith. All rights reserved. -// - -import Foundation - - -/** - * Structure to hold results from run - */ -public struct RunResults { - - /// Command exit status - public let exitStatus: Int - - /// Command output stdout - public let stdout: String - - /// Command output stderr - public let stderr: String -} - -// MARK:- Internal - -func splitCommandToArgs(_ command: String) -> [String] { - if command.contains(" ") { - return command.components(separatedBy: " ") - } - - return [command] -} - -func readPipe(_ pipe: TaskPipe) -> String { - let data = pipe.read() - return NSString(data: data as Data, encoding: String.Encoding.utf8.rawValue) as? String ?? "" -} diff --git a/Source/Runner.swift b/Source/Runner.swift deleted file mode 100644 index 9d2603f..0000000 --- a/Source/Runner.swift +++ /dev/null @@ -1,115 +0,0 @@ -// -// Runner.swift -// 🏃 -// -// Created by Omar Abdelhafith on 02/11/2015. -// Copyright © 2015 Omar Abdelhafith. All rights reserved. -// - -import Foundation - - -class 🏃{ - - class func runWithoutCapture(_ command: String) -> Int { - let initalSettings = RunSettings() - initalSettings.interactive = true - return run(command, args: [], settings: initalSettings).exitStatus - } - - class func run(_ command: String, args: String...) -> RunResults { - return run(command, args: args as [String]) - } - - class func run(_ command: String, args: [String]) -> RunResults { - let settings = RunSettings() - return run(command, args: args, settings: settings) - } - - class func run(_ command: String, settings: ((RunSettings) -> Void)) -> RunResults { - let initalSettings = RunSettings() - settings(initalSettings) - - return run(command, args: [], settings: initalSettings) - } - - class func run(_ command: String, args: [String], settings: ((RunSettings) -> Void)) -> RunResults { - let initalSettings = RunSettings() - settings(initalSettings) - - return run(command, args: args, settings: initalSettings) - } - - class func run(_ command: String, echo: EchoSettings) -> RunResults { - let initalSettings = RunSettings() - initalSettings.echo = echo - return run(command, args: [], settings: initalSettings) - } - - class func run(_ command: String, args: [String], settings: RunSettings) -> RunResults { - - let commandParts = commandToRun(command, args: args) - - let result: RunResults - - echoCommand(commandParts, settings: settings) - - if settings.dryRun { - result = executeDryCommand(commandParts) - } else if settings.interactive { - result = executeIneractiveCommand(commandParts) - } else { - result = executeActualCommand(commandParts) - } - - echoResult(result, settings: settings) - - return result - } - - fileprivate class func executeDryCommand(_ commandParts: [String]) -> RunResults { - return execute(commandParts, withExecutor: DryTaskExecutor()) - } - - fileprivate class func executeIneractiveCommand(_ commandParts: [String]) -> RunResults { - return execute(commandParts, withExecutor: InteractiveTaskExecutor()) - } - - fileprivate class func executeActualCommand(_ commandParts: [String]) -> RunResults { - return execute(commandParts, withExecutor: CommandExecutor.currentTaskExecutor) - } - - fileprivate class func execute(_ commandParts: [String], withExecutor executor: TaskExecutor) -> RunResults { - let (status, stdoutPipe, stderrPipe) = executor.execute(commandParts) - - let stdout = readPipe(stdoutPipe).trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) - let stderr = readPipe(stderrPipe).trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) - return RunResults(exitStatus: status, stdout: stdout, stderr: stderr) - } - - fileprivate class func commandToRun(_ command: String, args: [String]) -> [String] { - return splitCommandToArgs(command) + args - } - - fileprivate class func echoCommand(_ command: [String], settings: RunSettings) { - if settings.echo.contains(.Command) { - echoStringIfNotEmpty("Command", string: command.joined(separator: " ")) - } - } - - fileprivate class func echoResult(_ result: RunResults, settings: RunSettings) { - if settings.echo.contains(.Stdout) { - echoStringIfNotEmpty("Stdout", string: result.stdout) - } - - if settings.echo.contains(.Stderr) { - echoStringIfNotEmpty("Stderr", string: result.stderr) - } - } - - fileprivate class func echoStringIfNotEmpty(_ title: String, string: String) { - if !string.isEmpty { - PromptSettings.print("\(title): \n\(string)") - } - } -} diff --git a/Source/RunnerSettings.swift b/Source/RunnerSettings.swift deleted file mode 100644 index ae43ca8..0000000 --- a/Source/RunnerSettings.swift +++ /dev/null @@ -1,44 +0,0 @@ -// -// RunSettings.swift -// RunSettings -// -// Created by Omar Abdelhafith on 05/11/2015. -// Copyright © 2015 Omar Abdelhafith. All rights reserved. -// - - -/// Settings to costumize the run function -public class RunSettings { - - /// If set to true, the command wont be run on the system, the stdout will contain the command executed - public var dryRun = false - - /// Which parts of the command to be echoed during execution - public var echo = EchoSettings.None - - /// Run the command in interactive mode; output wont be captured - public var interactive = false -} - - -/// Echo settings -public struct EchoSettings: OptionSet { - - public let rawValue: Int - - public init(rawValue: Int) { - self.rawValue = rawValue - } - - /// Dont echo anything, this is the default settings - public static var None = EchoSettings(rawValue: 0) - - /// Echo the stdout from the run command to the terminal - public static let Stdout = EchoSettings(rawValue: 1 << 0) - - /// Echo the stderr from the run command to the terminal - public static let Stderr = EchoSettings(rawValue: 1 << 1) - - /// Echo the command executed to the terminal - public static let Command = EchoSettings(rawValue: 1 << 2) -} diff --git a/Source/ShortHandRunner.swift b/Source/ShortHandRunner.swift deleted file mode 100644 index a9fed5b..0000000 --- a/Source/ShortHandRunner.swift +++ /dev/null @@ -1,99 +0,0 @@ -// -// ShortHandRunner.swift -// ShortHandRunner - -// -// Created by Omar Abdelhafith on 05/11/2015. -// Copyright © 2015 Omar Abdelhafith. All rights reserved. -// - - -/** - Executes a command and captures its output - - - parameter command: the command to execute - - parameter args: the parameters to pass to the command - - - returns: RunResults describing the command results - */ -public func run(_ command: String, args: String...) -> RunResults { - return 🏃.run(command, args: args as [String]) -} - - -/** - Executes a command and captures its output - - - parameter command: the command to execute - - parameter argString: the arguments passed as a single string - - - returns: RunResults describing the command results - */ -public func run(_ command: String, argsString: String) -> RunResults { - let args = argsString.components(separatedBy: " ").filter { !$0.isEmpty } - return 🏃.run(command, args: args) -} - - -/** - Executes a command and captures its output - - - parameter command: the command to execute - - parameter args: the parameters to pass to the command - - - returns: RunResults describing the command results - */ -public func run(_ command: String, args: [String]) -> RunResults { - return 🏃.run(command, args: args) -} - - -/** - Executes a command and captures its output - - - parameter command: the command to execute - - parameter settingsBlock: block that receives the settings to costumize the behavior of run - - - returns: RunResults describing the command results - */ -public func run(_ command: String, settingsBlock: ((RunSettings) -> Void)) -> RunResults { - return 🏃.run(command, settings: settingsBlock) -} - - -/** - Executes a command and captures its output - - - parameter command: the command to execute - - parameter args: the parameters to pass to the command - - parameter settingsBlock: block that receives the settings to costumize the behavior of run - - - returns: RunResults describing the command results - */ -public func run(_ command: String, args: [String], settings: ((RunSettings) -> Void)) -> RunResults { - return 🏃.run(command, args: args, settings: settings) -} - - -/** - Executes a command and captures its output - - - parameter command: the command to execute - - parameter echo: echo settings that describe what parts of the command to print - -- returns: RunResults describing the command results - */ -func run(_ command: String, echo: EchoSettings) -> RunResults { - return 🏃.run(command, echo: echo) -} - -/** - Execute a command in interactive mode, output won't be captured - - - parameter command: the command to execute - -- returns: executed command exit code - */ -public func runWithoutCapture(_ command: String) -> Int { - return 🏃.runWithoutCapture(command) -} diff --git a/Source/TaskPipe.swift b/Source/TaskPipe.swift deleted file mode 100644 index 3762aab..0000000 --- a/Source/TaskPipe.swift +++ /dev/null @@ -1,29 +0,0 @@ -// -// TaskPipe.swift -// TaskPipe -// -// Created by Omar Abdelhafith on 05/11/2015. -// Copyright © 2015 Omar Abdelhafith. All rights reserved. -// - -import Foundation - - -protocol TaskPipe { - func read() -> Data -} - -extension Pipe: TaskPipe { - func read() -> Data { - return fileHandleForReading.readDataToEndOfFile() - } -} - -struct Dryipe: TaskPipe { - - let dataToReturn: Data - - func read() -> Data { - return dataToReturn - } -} diff --git a/Source/Agree.swift b/Sources/Agree.swift similarity index 100% rename from Source/Agree.swift rename to Sources/Agree.swift diff --git a/Source/AgreeSettings.swift b/Sources/AgreeSettings.swift similarity index 100% rename from Source/AgreeSettings.swift rename to Sources/AgreeSettings.swift diff --git a/Source/ArgConvertible.swift b/Sources/ArgConvertible.swift similarity index 100% rename from Source/ArgConvertible.swift rename to Sources/ArgConvertible.swift diff --git a/Source/Args.swift b/Sources/Args.swift similarity index 70% rename from Source/Args.swift rename to Sources/Args.swift index c70c564..040104c 100644 --- a/Source/Args.swift +++ b/Sources/Args.swift @@ -11,8 +11,8 @@ public class Args { /// Return the list of arguments passed to the script - open static var all: [String] { - return ProcessInfo.arguments + public static var all: [String] { + return CommandLine.arguments } static var cachedResults: ParsedArgs? @@ -21,15 +21,20 @@ public class Args { /// The flags are recognized as short flags `-f` or long flags `--force` /// The flag value will be the argument that follows the flag /// `--` is used to mark the terminatin of the flags - open static var parsed: ParsedArgs { - - if let result = cachedResults , ProcessInfo.cacheResults { + public static var parsed: ParsedArgs { + let result = parse(argumens: all, cachedResults: cachedResults) + cachedResults = result + return result + } + + static func parse(argumens: [String], cachedResults: ParsedArgs?) -> ParsedArgs { + if let result = cachedResults { return result } - + var parsedFlags = [String: String]() - let parsedArgs = ArgsParser.parseFlags(all) - + let parsedArgs = ArgsParser.parseFlags(argumens) + parsedArgs.0.forEach { parsedFlags[$0.argument.name] = $0.value ?? "" } @@ -39,13 +44,13 @@ public class Args { // the first argument is always the executable's name var commandName = "" if let firstArgument = arguments.first { // just in case! - commandName = firstArgument - arguments.removeFirst(1) + commandName = firstArgument + arguments.removeFirst(1) } - cachedResults = ParsedArgs(command: commandName, flags: parsedFlags, parameters: arguments) - return cachedResults! + return ParsedArgs(command: commandName, flags: parsedFlags, parameters: arguments) } + } diff --git a/Source/ArgsParser.swift b/Sources/ArgsParser.swift similarity index 100% rename from Source/ArgsParser.swift rename to Sources/ArgsParser.swift diff --git a/Source/Argument.swift b/Sources/Argument.swift similarity index 65% rename from Source/Argument.swift rename to Sources/Argument.swift index 59187c0..5aa8f59 100644 --- a/Source/Argument.swift +++ b/Sources/Argument.swift @@ -5,8 +5,7 @@ // Created by Omar Abdelhafith on 26/11/2015. // Copyright © 2015 Omar Abdelhafith. All rights reserved. // - -import Foundation +import StringScanner struct Option { @@ -39,9 +38,9 @@ struct Argument { if argument == "--" { self = .flagsTerminator - } else if argument.hasPrefix("--") { + } else if argument.isPrefixed(by: "--") { self = .longFlag - } else if argument.hasPrefix("-") { + } else if argument.isPrefixed(by: "-") { self = .shortFlag } else { self = .notAFlag @@ -70,27 +69,12 @@ struct Argument { case .notAFlag: return argument case .shortFlag: - return argument[1..) -> String { - let length = self.lengthOfBytes(using: String.Encoding.utf8) - - var distanceFromEndIndex = length - range.upperBound - if distanceFromEndIndex < 0 { - distanceFromEndIndex = 0 - } - - let actualRange = (characters.index(startIndex, offsetBy: range.lowerBound) ..< characters.index(endIndex, offsetBy: -distanceFromEndIndex)) - - return self[actualRange] - } -} diff --git a/Source/Ask.swift b/Sources/Ask.swift similarity index 100% rename from Source/Ask.swift rename to Sources/Ask.swift diff --git a/Source/AskSettings.swift b/Sources/AskSettings.swift similarity index 100% rename from Source/AskSettings.swift rename to Sources/AskSettings.swift diff --git a/Source/AskerValidator.swift b/Sources/AskerValidator.swift similarity index 100% rename from Source/AskerValidator.swift rename to Sources/AskerValidator.swift diff --git a/Source/Choose.swift b/Sources/Choose.swift similarity index 100% rename from Source/Choose.swift rename to Sources/Choose.swift diff --git a/Source/ChooseSettings.swift b/Sources/ChooseSettings.swift similarity index 100% rename from Source/ChooseSettings.swift rename to Sources/ChooseSettings.swift diff --git a/Source/Colorizer.swift b/Sources/Colorizer.swift similarity index 100% rename from Source/Colorizer.swift rename to Sources/Colorizer.swift diff --git a/Source/PromptPrinter.swift b/Sources/PromptPrinter.swift similarity index 100% rename from Source/PromptPrinter.swift rename to Sources/PromptPrinter.swift diff --git a/Source/PromptReader.swift b/Sources/PromptReader.swift similarity index 100% rename from Source/PromptReader.swift rename to Sources/PromptReader.swift diff --git a/Source/PromptSettings.swift b/Sources/PromptSettings.swift similarity index 100% rename from Source/PromptSettings.swift rename to Sources/PromptSettings.swift diff --git a/Source/StringBackgroundColorizer.swift b/Sources/StringBackgroundColorizer.swift similarity index 80% rename from Source/StringBackgroundColorizer.swift rename to Sources/StringBackgroundColorizer.swift index eb9ae72..3998e88 100644 --- a/Source/StringBackgroundColorizer.swift +++ b/Sources/StringBackgroundColorizer.swift @@ -13,35 +13,35 @@ extension String { let string: String - public var Black: String { + public var black: String { return Colorizer(string: string, color: BackgroundColor.black).description } - public var Red: String { + public var red: String { return Colorizer(string: string, color: BackgroundColor.red).description } - public var Green: String { + public var green: String { return Colorizer(string: string, color: BackgroundColor.green).description } - public var Yellow: String { + public var yellow: String { return Colorizer(string: string, color: BackgroundColor.yellow).description } - public var Blue: String { + public var blue: String { return Colorizer(string: string, color: BackgroundColor.blue).description } - public var Magenta: String { + public var magenta: String { return Colorizer(string: string, color: BackgroundColor.magenta).description } - public var Cyan: String { + public var cyan: String { return Colorizer(string: string, color: BackgroundColor.cyan).description } - public var White: String { + public var white: String { return Colorizer(string: string, color: BackgroundColor.white).description } } diff --git a/Source/StringForegroundColorizer.swift b/Sources/StringForegroundColorizer.swift similarity index 80% rename from Source/StringForegroundColorizer.swift rename to Sources/StringForegroundColorizer.swift index ab57bf9..880b131 100644 --- a/Source/StringForegroundColorizer.swift +++ b/Sources/StringForegroundColorizer.swift @@ -13,35 +13,35 @@ extension String { let string: String - public var Black: String { + public var black: String { return Colorizer(string: string, color: ForegroundColor.black).description } - public var Red: String { + public var red: String { return Colorizer(string: string, color: ForegroundColor.red).description } - public var Green: String { + public var green: String { return Colorizer(string: string, color: ForegroundColor.green).description } - public var Yellow: String { + public var yellow: String { return Colorizer(string: string, color: ForegroundColor.yellow).description } - public var Blue: String { + public var blue: String { return Colorizer(string: string, color: ForegroundColor.blue).description } - public var Magenta: String { + public var magenta: String { return Colorizer(string: string, color: ForegroundColor.magenta).description } - public var Cyan: String { + public var cyan: String { return Colorizer(string: string, color: ForegroundColor.cyan).description } - public var White: String { + public var white: String { return Colorizer(string: string, color: ForegroundColor.white).description } } diff --git a/Source/StringStyle.swift b/Sources/StringStyle.swift similarity index 69% rename from Source/StringStyle.swift rename to Sources/StringStyle.swift index 4864460..90dd6c7 100644 --- a/Source/StringStyle.swift +++ b/Sources/StringStyle.swift @@ -5,15 +5,13 @@ // Created by Omar Abdelhafith on 31/10/2015. // Copyright © 2015 Omar Abdelhafith. All rights reserved. // - -import Foundation +import StringScanner let startOfCode = "\u{001B}[" let endOfCode = "m" let codesSeperators = ";" - protocol StringStyle { var rawValue: Int { get } func colorize(string: String) -> String @@ -50,20 +48,21 @@ extension StringStyle { } fileprivate func hasAnyStyleCode(_ string: String) -> Bool { - return string.contains(startOfCode) + return string.find(string: startOfCode) != nil } fileprivate func addCommandSeperators(_ string: String) -> String { var rangeWithInset = (string.characters.index(after: string.startIndex) ..< string.characters.index(before: string.endIndex)) - let newString = string.replacingOccurrences(of: startOfCode, with: ";", options: .literal, range: rangeWithInset) + + let newString = string.replacing(subString: startOfCode, withString: ";", inRange: rangeWithInset) rangeWithInset = (newString.characters.index(after: newString.startIndex) ..< newString.characters.index(before: newString.endIndex)) - return newString.replacingOccurrences(of: "m;", with: ";", options: .literal, range: rangeWithInset) + return newString.replacing(subString: "m;", withString: ";", inRange: rangeWithInset) } fileprivate func removeEndingCode(_ string: String) -> String { let rangeWithInset = (string.characters.index(after: string.startIndex) ..< string.endIndex) - return string.replacingOccurrences(of: endingColorCode(), with: "", options: .literal, range: rangeWithInset) + return string.replacing(subString: endingColorCode(), withString: "", inRange: rangeWithInset) } fileprivate func endingColorCode() -> String { @@ -71,6 +70,30 @@ extension StringStyle { } } +// TODO: think about the performance of these functions +extension String { + + func replacing(subString: String, withString: String) -> String { + var mutableStr = self + + while let startIndex = mutableStr.find(string: subString) { + let endIndex = mutableStr.index(startIndex, offsetBy: subString.characters.count) + mutableStr.replaceSubrange(startIndex..) -> String { + let beforeString = self[self.startIndex.. "o.arrabi@me.com" } - s.source = { :git => "https://github.com/oarrabi/Swiftline.git", :tag => s.version.to_s } - - s.platform = :osx, '10.9' - s.requires_arc = true - - s.source_files = 'Source/**/*' -end diff --git a/Swiftline.xcodeproj/StringScanner_Info.plist b/Swiftline.xcodeproj/StringScanner_Info.plist new file mode 100644 index 0000000..57ada9f --- /dev/null +++ b/Swiftline.xcodeproj/StringScanner_Info.plist @@ -0,0 +1,25 @@ + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/Swiftline.xcodeproj/SwiftlineTests_Info.plist b/Swiftline.xcodeproj/SwiftlineTests_Info.plist new file mode 100644 index 0000000..7c23420 --- /dev/null +++ b/Swiftline.xcodeproj/SwiftlineTests_Info.plist @@ -0,0 +1,25 @@ + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/Swiftline.xcodeproj/project.pbxproj b/Swiftline.xcodeproj/project.pbxproj index 618abca..77f8fbe 100644 --- a/Swiftline.xcodeproj/project.pbxproj +++ b/Swiftline.xcodeproj/project.pbxproj @@ -7,260 +7,485 @@ objects = { /* Begin PBXBuildFile section */ - __src_cc_ref_Source/Agree.swift /* Agree.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/Agree.swift /* Agree.swift */; }; - __src_cc_ref_Source/AgreeSettings.swift /* AgreeSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/AgreeSettings.swift /* AgreeSettings.swift */; }; - __src_cc_ref_Source/ArgConvertible.swift /* ArgConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/ArgConvertible.swift /* ArgConvertible.swift */; }; - __src_cc_ref_Source/Args.swift /* Args.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/Args.swift /* Args.swift */; }; - __src_cc_ref_Source/ArgsParser.swift /* ArgsParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/ArgsParser.swift /* ArgsParser.swift */; }; - __src_cc_ref_Source/Argument.swift /* Argument.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/Argument.swift /* Argument.swift */; }; - __src_cc_ref_Source/Ask.swift /* Ask.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/Ask.swift /* Ask.swift */; }; - __src_cc_ref_Source/AskSettings.swift /* AskSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/AskSettings.swift /* AskSettings.swift */; }; - __src_cc_ref_Source/AskerValidator.swift /* AskerValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/AskerValidator.swift /* AskerValidator.swift */; }; - __src_cc_ref_Source/Choose.swift /* Choose.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/Choose.swift /* Choose.swift */; }; - __src_cc_ref_Source/ChooseSettings.swift /* ChooseSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/ChooseSettings.swift /* ChooseSettings.swift */; }; - __src_cc_ref_Source/Colorizer.swift /* Colorizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/Colorizer.swift /* Colorizer.swift */; }; - __src_cc_ref_Source/CommandExecutor.swift /* CommandExecutor.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/CommandExecutor.swift /* CommandExecutor.swift */; }; - __src_cc_ref_Source/Env.swift /* Env.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/Env.swift /* Env.swift */; }; - __src_cc_ref_Source/Glob.swift /* Glob.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/Glob.swift /* Glob.swift */; }; - __src_cc_ref_Source/ProcessInfo.swift /* ProcessInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/ProcessInfo.swift /* ProcessInfo.swift */; }; - __src_cc_ref_Source/PromptPrinter.swift /* PromptPrinter.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/PromptPrinter.swift /* PromptPrinter.swift */; }; - __src_cc_ref_Source/PromptReader.swift /* PromptReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/PromptReader.swift /* PromptReader.swift */; }; - __src_cc_ref_Source/PromptSettings.swift /* PromptSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/PromptSettings.swift /* PromptSettings.swift */; }; - __src_cc_ref_Source/RunResults.swift /* RunResults.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/RunResults.swift /* RunResults.swift */; }; - __src_cc_ref_Source/Runner.swift /* Runner.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/Runner.swift /* Runner.swift */; }; - __src_cc_ref_Source/RunnerSettings.swift /* RunnerSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/RunnerSettings.swift /* RunnerSettings.swift */; }; - __src_cc_ref_Source/ShortHandRunner.swift /* ShortHandRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/ShortHandRunner.swift /* ShortHandRunner.swift */; }; - __src_cc_ref_Source/StringBackgroundColorizer.swift /* StringBackgroundColorizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/StringBackgroundColorizer.swift /* StringBackgroundColorizer.swift */; }; - __src_cc_ref_Source/StringForegroundColorizer.swift /* StringForegroundColorizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/StringForegroundColorizer.swift /* StringForegroundColorizer.swift */; }; - __src_cc_ref_Source/StringStyle.swift /* StringStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/StringStyle.swift /* StringStyle.swift */; }; - __src_cc_ref_Source/StringStyleColorizer.swift /* StringStyleColorizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/StringStyleColorizer.swift /* StringStyleColorizer.swift */; }; - __src_cc_ref_Source/TaskPipe.swift /* TaskPipe.swift in Sources */ = {isa = PBXBuildFile; fileRef = __PBXFileRef_Source/TaskPipe.swift /* TaskPipe.swift */; }; + OBJ_100 /* ChooseSettingsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_41 /* ChooseSettingsTests.swift */; }; + OBJ_101 /* ChooseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_42 /* ChooseTests.swift */; }; + OBJ_102 /* ColorizerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_43 /* ColorizerTest.swift */; }; + OBJ_103 /* StringExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_44 /* StringExtensionTests.swift */; }; + OBJ_105 /* StringScanner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = OBJ_49 /* StringScanner.framework */; }; + OBJ_106 /* Swiftline.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = OBJ_50 /* Swiftline.framework */; }; + OBJ_57 /* CharacterSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_9 /* CharacterSet.swift */; }; + OBJ_58 /* Regex.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_10 /* Regex.swift */; }; + OBJ_59 /* ScannerResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_11 /* ScannerResult.swift */; }; + OBJ_60 /* StringExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_12 /* StringExtension.swift */; }; + OBJ_61 /* StringScanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_13 /* StringScanner.swift */; }; + OBJ_68 /* Agree.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_15 /* Agree.swift */; }; + OBJ_69 /* AgreeSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_16 /* AgreeSettings.swift */; }; + OBJ_70 /* ArgConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_17 /* ArgConvertible.swift */; }; + OBJ_71 /* Args.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_18 /* Args.swift */; }; + OBJ_72 /* ArgsParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_19 /* ArgsParser.swift */; }; + OBJ_73 /* Argument.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_20 /* Argument.swift */; }; + OBJ_74 /* Ask.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_21 /* Ask.swift */; }; + OBJ_75 /* AskerValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_22 /* AskerValidator.swift */; }; + OBJ_76 /* AskSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_23 /* AskSettings.swift */; }; + OBJ_77 /* Choose.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_24 /* Choose.swift */; }; + OBJ_78 /* ChooseSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_25 /* ChooseSettings.swift */; }; + OBJ_79 /* Colorizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_26 /* Colorizer.swift */; }; + OBJ_80 /* PromptPrinter.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_27 /* PromptPrinter.swift */; }; + OBJ_81 /* PromptReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_28 /* PromptReader.swift */; }; + OBJ_82 /* PromptSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_29 /* PromptSettings.swift */; }; + OBJ_83 /* StringBackgroundColorizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_30 /* StringBackgroundColorizer.swift */; }; + OBJ_84 /* StringForegroundColorizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_31 /* StringForegroundColorizer.swift */; }; + OBJ_85 /* StringStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_32 /* StringStyle.swift */; }; + OBJ_86 /* StringStyleColorizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_33 /* StringStyleColorizer.swift */; }; + OBJ_88 /* StringScanner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = OBJ_49 /* StringScanner.framework */; }; + OBJ_95 /* AgreeSettingsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_36 /* AgreeSettingsTest.swift */; }; + OBJ_96 /* AgreeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_37 /* AgreeTests.swift */; }; + OBJ_97 /* ArgsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_38 /* ArgsTests.swift */; }; + OBJ_98 /* AskSettingsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_39 /* AskSettingsTests.swift */; }; + OBJ_99 /* AskTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_40 /* AskTests.swift */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + D79205B71E42AF2500C4475C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = OBJ_1 /* Project object */; + proxyType = 1; + remoteGlobalIDString = OBJ_52; + remoteInfo = StringScanner; + }; + D79205B81E42AF2500C4475C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = OBJ_1 /* Project object */; + proxyType = 1; + remoteGlobalIDString = OBJ_52; + remoteInfo = StringScanner; + }; + D79205B91E42AF2500C4475C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = OBJ_1 /* Project object */; + proxyType = 1; + remoteGlobalIDString = OBJ_63; + remoteInfo = Swiftline; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXFileReference section */ - __PBXFileRef_Package.swift /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; - __PBXFileRef_Source/Agree.swift /* Agree.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Agree.swift; sourceTree = ""; }; - __PBXFileRef_Source/AgreeSettings.swift /* AgreeSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgreeSettings.swift; sourceTree = ""; }; - __PBXFileRef_Source/ArgConvertible.swift /* ArgConvertible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArgConvertible.swift; sourceTree = ""; }; - __PBXFileRef_Source/Args.swift /* Args.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Args.swift; sourceTree = ""; }; - __PBXFileRef_Source/ArgsParser.swift /* ArgsParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArgsParser.swift; sourceTree = ""; }; - __PBXFileRef_Source/Argument.swift /* Argument.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Argument.swift; sourceTree = ""; }; - __PBXFileRef_Source/Ask.swift /* Ask.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Ask.swift; sourceTree = ""; }; - __PBXFileRef_Source/AskSettings.swift /* AskSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AskSettings.swift; sourceTree = ""; }; - __PBXFileRef_Source/AskerValidator.swift /* AskerValidator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AskerValidator.swift; sourceTree = ""; }; - __PBXFileRef_Source/Choose.swift /* Choose.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Choose.swift; sourceTree = ""; }; - __PBXFileRef_Source/ChooseSettings.swift /* ChooseSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChooseSettings.swift; sourceTree = ""; }; - __PBXFileRef_Source/Colorizer.swift /* Colorizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Colorizer.swift; sourceTree = ""; }; - __PBXFileRef_Source/CommandExecutor.swift /* CommandExecutor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommandExecutor.swift; sourceTree = ""; }; - __PBXFileRef_Source/Env.swift /* Env.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Env.swift; sourceTree = ""; }; - __PBXFileRef_Source/Glob.swift /* Glob.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Glob.swift; sourceTree = ""; }; - __PBXFileRef_Source/ProcessInfo.swift /* ProcessInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProcessInfo.swift; sourceTree = ""; }; - __PBXFileRef_Source/PromptPrinter.swift /* PromptPrinter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromptPrinter.swift; sourceTree = ""; }; - __PBXFileRef_Source/PromptReader.swift /* PromptReader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromptReader.swift; sourceTree = ""; }; - __PBXFileRef_Source/PromptSettings.swift /* PromptSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromptSettings.swift; sourceTree = ""; }; - __PBXFileRef_Source/RunResults.swift /* RunResults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunResults.swift; sourceTree = ""; }; - __PBXFileRef_Source/Runner.swift /* Runner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Runner.swift; sourceTree = ""; }; - __PBXFileRef_Source/RunnerSettings.swift /* RunnerSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerSettings.swift; sourceTree = ""; }; - __PBXFileRef_Source/ShortHandRunner.swift /* ShortHandRunner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShortHandRunner.swift; sourceTree = ""; }; - __PBXFileRef_Source/StringBackgroundColorizer.swift /* StringBackgroundColorizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringBackgroundColorizer.swift; sourceTree = ""; }; - __PBXFileRef_Source/StringForegroundColorizer.swift /* StringForegroundColorizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringForegroundColorizer.swift; sourceTree = ""; }; - __PBXFileRef_Source/StringStyle.swift /* StringStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringStyle.swift; sourceTree = ""; }; - __PBXFileRef_Source/StringStyleColorizer.swift /* StringStyleColorizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringStyleColorizer.swift; sourceTree = ""; }; - __PBXFileRef_Source/TaskPipe.swift /* TaskPipe.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TaskPipe.swift; sourceTree = ""; }; - __PBXFileRef_Swiftline.xcodeproj/Configs/Project.xcconfig /* Swiftline.xcodeproj/Configs/Project.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Swiftline.xcodeproj/Configs/Project.xcconfig; sourceTree = ""; }; - "_____Product_Swiftline" /* Swiftline.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Swiftline.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + OBJ_10 /* Regex.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Regex.swift; sourceTree = ""; }; + OBJ_11 /* ScannerResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScannerResult.swift; sourceTree = ""; }; + OBJ_12 /* StringExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringExtension.swift; sourceTree = ""; }; + OBJ_13 /* StringScanner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringScanner.swift; sourceTree = ""; }; + OBJ_15 /* Agree.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Agree.swift; sourceTree = ""; }; + OBJ_16 /* AgreeSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgreeSettings.swift; sourceTree = ""; }; + OBJ_17 /* ArgConvertible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArgConvertible.swift; sourceTree = ""; }; + OBJ_18 /* Args.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Args.swift; sourceTree = ""; }; + OBJ_19 /* ArgsParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArgsParser.swift; sourceTree = ""; }; + OBJ_20 /* Argument.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Argument.swift; sourceTree = ""; }; + OBJ_21 /* Ask.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Ask.swift; sourceTree = ""; }; + OBJ_22 /* AskerValidator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AskerValidator.swift; sourceTree = ""; }; + OBJ_23 /* AskSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AskSettings.swift; sourceTree = ""; }; + OBJ_24 /* Choose.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Choose.swift; sourceTree = ""; }; + OBJ_25 /* ChooseSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChooseSettings.swift; sourceTree = ""; }; + OBJ_26 /* Colorizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Colorizer.swift; sourceTree = ""; }; + OBJ_27 /* PromptPrinter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromptPrinter.swift; sourceTree = ""; }; + OBJ_28 /* PromptReader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromptReader.swift; sourceTree = ""; }; + OBJ_29 /* PromptSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromptSettings.swift; sourceTree = ""; }; + OBJ_30 /* StringBackgroundColorizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringBackgroundColorizer.swift; sourceTree = ""; }; + OBJ_31 /* StringForegroundColorizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringForegroundColorizer.swift; sourceTree = ""; }; + OBJ_32 /* StringStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringStyle.swift; sourceTree = ""; }; + OBJ_33 /* StringStyleColorizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringStyleColorizer.swift; sourceTree = ""; }; + OBJ_36 /* AgreeSettingsTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgreeSettingsTest.swift; sourceTree = ""; }; + OBJ_37 /* AgreeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgreeTests.swift; sourceTree = ""; }; + OBJ_38 /* ArgsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArgsTests.swift; sourceTree = ""; }; + OBJ_39 /* AskSettingsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AskSettingsTests.swift; sourceTree = ""; }; + OBJ_40 /* AskTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AskTests.swift; sourceTree = ""; }; + OBJ_41 /* ChooseSettingsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChooseSettingsTests.swift; sourceTree = ""; }; + OBJ_42 /* ChooseTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChooseTests.swift; sourceTree = ""; }; + OBJ_43 /* ColorizerTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorizerTest.swift; sourceTree = ""; }; + OBJ_44 /* StringExtensionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringExtensionTests.swift; sourceTree = ""; }; + OBJ_45 /* build */ = {isa = PBXFileReference; lastKnownFileType = folder; path = build; sourceTree = SOURCE_ROOT; }; + OBJ_46 /* DerivedData */ = {isa = PBXFileReference; lastKnownFileType = folder; path = DerivedData; sourceTree = SOURCE_ROOT; }; + OBJ_47 /* Examples */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Examples; sourceTree = SOURCE_ROOT; }; + OBJ_49 /* StringScanner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = StringScanner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + OBJ_50 /* Swiftline.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Swiftline.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + OBJ_51 /* SwiftlineTests.xctest */ = {isa = PBXFileReference; lastKnownFileType = file; path = SwiftlineTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + OBJ_6 /* Package.swift */ = {isa = PBXFileReference; explicitFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; + OBJ_9 /* CharacterSet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CharacterSet.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - "___LinkPhase_Swiftline" /* Frameworks */ = { + OBJ_104 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 0; + files = ( + OBJ_105 /* StringScanner.framework in Frameworks */, + OBJ_106 /* Swiftline.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + OBJ_62 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + OBJ_87 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 0; files = ( + OBJ_88 /* StringScanner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - "___RootGroup_" = { + OBJ_14 /* Swiftline */ = { + isa = PBXGroup; + children = ( + OBJ_15 /* Agree.swift */, + OBJ_16 /* AgreeSettings.swift */, + OBJ_17 /* ArgConvertible.swift */, + OBJ_18 /* Args.swift */, + OBJ_19 /* ArgsParser.swift */, + OBJ_20 /* Argument.swift */, + OBJ_21 /* Ask.swift */, + OBJ_22 /* AskerValidator.swift */, + OBJ_23 /* AskSettings.swift */, + OBJ_24 /* Choose.swift */, + OBJ_25 /* ChooseSettings.swift */, + OBJ_26 /* Colorizer.swift */, + OBJ_27 /* PromptPrinter.swift */, + OBJ_28 /* PromptReader.swift */, + OBJ_29 /* PromptSettings.swift */, + OBJ_30 /* StringBackgroundColorizer.swift */, + OBJ_31 /* StringForegroundColorizer.swift */, + OBJ_32 /* StringStyle.swift */, + OBJ_33 /* StringStyleColorizer.swift */, + ); + name = Swiftline; + path = Sources; + sourceTree = SOURCE_ROOT; + }; + OBJ_34 /* Tests */ = { isa = PBXGroup; children = ( - __PBXFileRef_Package.swift /* Package.swift */, - "_____Configs_" /* Configs */, - "_____Sources_" /* Sources */, - "____Products_" /* Products */, + OBJ_35 /* SwiftlineTests */, ); + path = Tests; sourceTree = ""; }; - "____Products_" /* Products */ = { + OBJ_35 /* SwiftlineTests */ = { isa = PBXGroup; children = ( - "_____Product_Swiftline" /* Swiftline.framework */, + OBJ_36 /* AgreeSettingsTest.swift */, + OBJ_37 /* AgreeTests.swift */, + OBJ_38 /* ArgsTests.swift */, + OBJ_39 /* AskSettingsTests.swift */, + OBJ_40 /* AskTests.swift */, + OBJ_41 /* ChooseSettingsTests.swift */, + OBJ_42 /* ChooseTests.swift */, + OBJ_43 /* ColorizerTest.swift */, + OBJ_44 /* StringExtensionTests.swift */, + ); + name = SwiftlineTests; + path = Tests/SwiftlineTests; + sourceTree = SOURCE_ROOT; + }; + OBJ_48 /* Products */ = { + isa = PBXGroup; + children = ( + OBJ_49 /* StringScanner.framework */, + OBJ_50 /* Swiftline.framework */, + OBJ_51 /* SwiftlineTests.xctest */, ); name = Products; - sourceTree = ""; + sourceTree = BUILT_PRODUCTS_DIR; }; - "_____Configs_" /* Configs */ = { + OBJ_5 /* */ = { isa = PBXGroup; children = ( - __PBXFileRef_Swiftline.xcodeproj/Configs/Project.xcconfig /* Swiftline.xcodeproj/Configs/Project.xcconfig */, + OBJ_6 /* Package.swift */, + OBJ_7 /* Sources */, + OBJ_34 /* Tests */, + OBJ_45 /* build */, + OBJ_46 /* DerivedData */, + OBJ_47 /* Examples */, + OBJ_48 /* Products */, ); - name = Configs; + name = ""; sourceTree = ""; }; - "_____Sources_" /* Sources */ = { + OBJ_7 /* Sources */ = { isa = PBXGroup; children = ( - "_______Group_Swiftline" /* Swiftline */, + OBJ_8 /* StringScanner */, + OBJ_14 /* Swiftline */, ); - name = Sources; + path = Sources; sourceTree = ""; }; - "_______Group_Swiftline" /* Swiftline */ = { + OBJ_8 /* StringScanner */ = { isa = PBXGroup; children = ( - __PBXFileRef_Source/Agree.swift /* Agree.swift */, - __PBXFileRef_Source/AgreeSettings.swift /* AgreeSettings.swift */, - __PBXFileRef_Source/ArgConvertible.swift /* ArgConvertible.swift */, - __PBXFileRef_Source/Args.swift /* Args.swift */, - __PBXFileRef_Source/ArgsParser.swift /* ArgsParser.swift */, - __PBXFileRef_Source/Argument.swift /* Argument.swift */, - __PBXFileRef_Source/Ask.swift /* Ask.swift */, - __PBXFileRef_Source/AskerValidator.swift /* AskerValidator.swift */, - __PBXFileRef_Source/AskSettings.swift /* AskSettings.swift */, - __PBXFileRef_Source/Choose.swift /* Choose.swift */, - __PBXFileRef_Source/ChooseSettings.swift /* ChooseSettings.swift */, - __PBXFileRef_Source/Colorizer.swift /* Colorizer.swift */, - __PBXFileRef_Source/CommandExecutor.swift /* CommandExecutor.swift */, - __PBXFileRef_Source/Env.swift /* Env.swift */, - __PBXFileRef_Source/Glob.swift /* Glob.swift */, - __PBXFileRef_Source/ProcessInfo.swift /* ProcessInfo.swift */, - __PBXFileRef_Source/PromptPrinter.swift /* PromptPrinter.swift */, - __PBXFileRef_Source/PromptReader.swift /* PromptReader.swift */, - __PBXFileRef_Source/PromptSettings.swift /* PromptSettings.swift */, - __PBXFileRef_Source/Runner.swift /* Runner.swift */, - __PBXFileRef_Source/RunnerSettings.swift /* RunnerSettings.swift */, - __PBXFileRef_Source/RunResults.swift /* RunResults.swift */, - __PBXFileRef_Source/ShortHandRunner.swift /* ShortHandRunner.swift */, - __PBXFileRef_Source/StringBackgroundColorizer.swift /* StringBackgroundColorizer.swift */, - __PBXFileRef_Source/StringForegroundColorizer.swift /* StringForegroundColorizer.swift */, - __PBXFileRef_Source/StringStyle.swift /* StringStyle.swift */, - __PBXFileRef_Source/StringStyleColorizer.swift /* StringStyleColorizer.swift */, - __PBXFileRef_Source/TaskPipe.swift /* TaskPipe.swift */, + OBJ_9 /* CharacterSet.swift */, + OBJ_10 /* Regex.swift */, + OBJ_11 /* ScannerResult.swift */, + OBJ_12 /* StringExtension.swift */, + OBJ_13 /* StringScanner.swift */, ); - name = Swiftline; - path = Source; - sourceTree = ""; + name = StringScanner; + path = "Packages/StringScanner-0.2.0/Sources"; + sourceTree = SOURCE_ROOT; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - "______Target_Swiftline" /* Swiftline */ = { + OBJ_52 /* StringScanner */ = { + isa = PBXNativeTarget; + buildConfigurationList = OBJ_53 /* Build configuration list for PBXNativeTarget "StringScanner" */; + buildPhases = ( + OBJ_56 /* Sources */, + OBJ_62 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = StringScanner; + productName = StringScanner; + productReference = OBJ_49 /* StringScanner.framework */; + productType = "com.apple.product-type.framework"; + }; + OBJ_63 /* Swiftline */ = { isa = PBXNativeTarget; - buildConfigurationList = "_______Confs_Swiftline" /* Build configuration list for PBXNativeTarget "Swiftline" */; + buildConfigurationList = OBJ_64 /* Build configuration list for PBXNativeTarget "Swiftline" */; buildPhases = ( - CompilePhase_Swiftline /* Sources */, - "___LinkPhase_Swiftline" /* Frameworks */, + OBJ_67 /* Sources */, + OBJ_87 /* Frameworks */, ); buildRules = ( ); dependencies = ( + OBJ_89 /* PBXTargetDependency */, ); name = Swiftline; productName = Swiftline; - productReference = "_____Product_Swiftline" /* Swiftline.framework */; + productReference = OBJ_50 /* Swiftline.framework */; productType = "com.apple.product-type.framework"; }; + OBJ_90 /* SwiftlineTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = OBJ_91 /* Build configuration list for PBXNativeTarget "SwiftlineTests" */; + buildPhases = ( + OBJ_94 /* Sources */, + OBJ_104 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + OBJ_107 /* PBXTargetDependency */, + OBJ_108 /* PBXTargetDependency */, + ); + name = SwiftlineTests; + productName = SwiftlineTests; + productReference = OBJ_51 /* SwiftlineTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ - __RootObject_ /* Project object */ = { + OBJ_1 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 9999; - TargetAttributes = { - "______Target_Swiftline" = { - LastSwiftMigration = 0800; - }; - }; }; - buildConfigurationList = "___RootConfs_" /* Build configuration list for PBXProject "Swiftline" */; + buildConfigurationList = OBJ_2 /* Build configuration list for PBXProject "Swiftline" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); - mainGroup = "___RootGroup_"; - productRefGroup = "____Products_" /* Products */; + mainGroup = OBJ_5 /* */; + productRefGroup = OBJ_48 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( - "______Target_Swiftline" /* Swiftline */, + OBJ_52 /* StringScanner */, + OBJ_63 /* Swiftline */, + OBJ_90 /* SwiftlineTests */, ); }; /* End PBXProject section */ /* Begin PBXSourcesBuildPhase section */ - CompilePhase_Swiftline /* Sources */ = { + OBJ_56 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 0; files = ( - __src_cc_ref_Source/Agree.swift /* Agree.swift in Sources */, - __src_cc_ref_Source/AgreeSettings.swift /* AgreeSettings.swift in Sources */, - __src_cc_ref_Source/ArgConvertible.swift /* ArgConvertible.swift in Sources */, - __src_cc_ref_Source/Args.swift /* Args.swift in Sources */, - __src_cc_ref_Source/ArgsParser.swift /* ArgsParser.swift in Sources */, - __src_cc_ref_Source/Argument.swift /* Argument.swift in Sources */, - __src_cc_ref_Source/Ask.swift /* Ask.swift in Sources */, - __src_cc_ref_Source/AskerValidator.swift /* AskerValidator.swift in Sources */, - __src_cc_ref_Source/AskSettings.swift /* AskSettings.swift in Sources */, - __src_cc_ref_Source/Choose.swift /* Choose.swift in Sources */, - __src_cc_ref_Source/ChooseSettings.swift /* ChooseSettings.swift in Sources */, - __src_cc_ref_Source/Colorizer.swift /* Colorizer.swift in Sources */, - __src_cc_ref_Source/CommandExecutor.swift /* CommandExecutor.swift in Sources */, - __src_cc_ref_Source/Env.swift /* Env.swift in Sources */, - __src_cc_ref_Source/Glob.swift /* Glob.swift in Sources */, - __src_cc_ref_Source/ProcessInfo.swift /* ProcessInfo.swift in Sources */, - __src_cc_ref_Source/PromptPrinter.swift /* PromptPrinter.swift in Sources */, - __src_cc_ref_Source/PromptReader.swift /* PromptReader.swift in Sources */, - __src_cc_ref_Source/PromptSettings.swift /* PromptSettings.swift in Sources */, - __src_cc_ref_Source/Runner.swift /* Runner.swift in Sources */, - __src_cc_ref_Source/RunnerSettings.swift /* RunnerSettings.swift in Sources */, - __src_cc_ref_Source/RunResults.swift /* RunResults.swift in Sources */, - __src_cc_ref_Source/ShortHandRunner.swift /* ShortHandRunner.swift in Sources */, - __src_cc_ref_Source/StringBackgroundColorizer.swift /* StringBackgroundColorizer.swift in Sources */, - __src_cc_ref_Source/StringForegroundColorizer.swift /* StringForegroundColorizer.swift in Sources */, - __src_cc_ref_Source/StringStyle.swift /* StringStyle.swift in Sources */, - __src_cc_ref_Source/StringStyleColorizer.swift /* StringStyleColorizer.swift in Sources */, - __src_cc_ref_Source/TaskPipe.swift /* TaskPipe.swift in Sources */, + OBJ_57 /* CharacterSet.swift in Sources */, + OBJ_58 /* Regex.swift in Sources */, + OBJ_59 /* ScannerResult.swift in Sources */, + OBJ_60 /* StringExtension.swift in Sources */, + OBJ_61 /* StringScanner.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + OBJ_67 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 0; + files = ( + OBJ_68 /* Agree.swift in Sources */, + OBJ_69 /* AgreeSettings.swift in Sources */, + OBJ_70 /* ArgConvertible.swift in Sources */, + OBJ_71 /* Args.swift in Sources */, + OBJ_72 /* ArgsParser.swift in Sources */, + OBJ_73 /* Argument.swift in Sources */, + OBJ_74 /* Ask.swift in Sources */, + OBJ_75 /* AskerValidator.swift in Sources */, + OBJ_76 /* AskSettings.swift in Sources */, + OBJ_77 /* Choose.swift in Sources */, + OBJ_78 /* ChooseSettings.swift in Sources */, + OBJ_79 /* Colorizer.swift in Sources */, + OBJ_80 /* PromptPrinter.swift in Sources */, + OBJ_81 /* PromptReader.swift in Sources */, + OBJ_82 /* PromptSettings.swift in Sources */, + OBJ_83 /* StringBackgroundColorizer.swift in Sources */, + OBJ_84 /* StringForegroundColorizer.swift in Sources */, + OBJ_85 /* StringStyle.swift in Sources */, + OBJ_86 /* StringStyleColorizer.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + OBJ_94 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 0; + files = ( + OBJ_95 /* AgreeSettingsTest.swift in Sources */, + OBJ_96 /* AgreeTests.swift in Sources */, + OBJ_97 /* ArgsTests.swift in Sources */, + OBJ_98 /* AskSettingsTests.swift in Sources */, + OBJ_99 /* AskTests.swift in Sources */, + OBJ_100 /* ChooseSettingsTests.swift in Sources */, + OBJ_101 /* ChooseTests.swift in Sources */, + OBJ_102 /* ColorizerTest.swift in Sources */, + OBJ_103 /* StringExtensionTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + OBJ_107 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = OBJ_52 /* StringScanner */; + targetProxy = D79205B81E42AF2500C4475C /* PBXContainerItemProxy */; + }; + OBJ_108 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = OBJ_63 /* Swiftline */; + targetProxy = D79205B91E42AF2500C4475C /* PBXContainerItemProxy */; + }; + OBJ_89 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = OBJ_52 /* StringScanner */; + targetProxy = D79205B71E42AF2500C4475C /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin XCBuildConfiguration section */ - _ReleaseConf_Swiftline /* Release */ = { + OBJ_3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_NS_ASSERTIONS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + MACOSX_DEPLOYMENT_TARGET = 10.10; + ONLY_ACTIVE_ARCH = YES; + OTHER_SWIFT_FLAGS = "-DXcode"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = SWIFT_PACKAGE; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; + USE_HEADERMAP = NO; + }; + name = Debug; + }; + OBJ_4 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_OPTIMIZATION_LEVEL = s; + MACOSX_DEPLOYMENT_TARGET = 10.10; + OTHER_SWIFT_FLAGS = "-DXcode"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = SWIFT_PACKAGE; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 3.0; + USE_HEADERMAP = NO; + }; + name = Release; + }; + OBJ_54 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ENABLE_TESTABILITY = YES; - FRAMEWORK_SEARCH_PATHS = "$(PLATFORM_DIR)/Developer/Library/Frameworks"; - INFOPLIST_FILE = Swiftline.xcodeproj/Swiftline_Info.plist; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PLATFORM_DIR)/Developer/Library/Frameworks", + ); + HEADER_SEARCH_PATHS = "$(inherited)"; + INFOPLIST_FILE = Swiftline.xcodeproj/StringScanner_Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; OTHER_LDFLAGS = "$(inherited)"; OTHER_SWIFT_FLAGS = "$(inherited)"; - PRODUCT_BUNDLE_IDENTIFIER = Swiftline; + PRODUCT_BUNDLE_IDENTIFIER = StringScanner; PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SWIFT_VERSION = 3.0; + TARGET_NAME = StringScanner; + }; + name = Debug; + }; + OBJ_55 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ENABLE_TESTABILITY = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PLATFORM_DIR)/Developer/Library/Frameworks", + ); + HEADER_SEARCH_PATHS = "$(inherited)"; + INFOPLIST_FILE = Swiftline.xcodeproj/StringScanner_Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; + OTHER_LDFLAGS = "$(inherited)"; + OTHER_SWIFT_FLAGS = "$(inherited)"; + PRODUCT_BUNDLE_IDENTIFIER = StringScanner; + PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + TARGET_NAME = StringScanner; }; name = Release; }; - "___DebugConf_Swiftline" /* Debug */ = { + OBJ_65 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ENABLE_TESTABILITY = YES; - FRAMEWORK_SEARCH_PATHS = "$(PLATFORM_DIR)/Developer/Library/Frameworks"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PLATFORM_DIR)/Developer/Library/Frameworks", + ); + HEADER_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = Swiftline.xcodeproj/Swiftline_Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; OTHER_LDFLAGS = "$(inherited)"; @@ -268,47 +493,104 @@ PRODUCT_BUNDLE_IDENTIFIER = Swiftline; PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + TARGET_NAME = Swiftline; }; name = Debug; }; - "_____Release_" /* Release */ = { + OBJ_66 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = __PBXFileRef_Swiftline.xcodeproj/Configs/Project.xcconfig /* Swiftline.xcodeproj/Configs/Project.xcconfig */; buildSettings = { + ENABLE_TESTABILITY = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PLATFORM_DIR)/Developer/Library/Frameworks", + ); + HEADER_SEARCH_PATHS = "$(inherited)"; + INFOPLIST_FILE = Swiftline.xcodeproj/Swiftline_Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; + OTHER_LDFLAGS = "$(inherited)"; + OTHER_SWIFT_FLAGS = "$(inherited)"; + PRODUCT_BUNDLE_IDENTIFIER = Swiftline; + PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + TARGET_NAME = Swiftline; }; name = Release; }; - "_______Debug_" /* Debug */ = { + OBJ_92 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = __PBXFileRef_Swiftline.xcodeproj/Configs/Project.xcconfig /* Swiftline.xcodeproj/Configs/Project.xcconfig */; buildSettings = { + EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PLATFORM_DIR)/Developer/Library/Frameworks", + ); + HEADER_SEARCH_PATHS = "$(inherited)"; + INFOPLIST_FILE = Swiftline.xcodeproj/SwiftlineTests_Info.plist; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks"; + OTHER_LDFLAGS = "$(inherited)"; + OTHER_SWIFT_FLAGS = "$(inherited)"; + TARGET_NAME = SwiftlineTests; }; name = Debug; }; + OBJ_93 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PLATFORM_DIR)/Developer/Library/Frameworks", + ); + HEADER_SEARCH_PATHS = "$(inherited)"; + INFOPLIST_FILE = Swiftline.xcodeproj/SwiftlineTests_Info.plist; + LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks"; + OTHER_LDFLAGS = "$(inherited)"; + OTHER_SWIFT_FLAGS = "$(inherited)"; + TARGET_NAME = SwiftlineTests; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - "___RootConfs_" /* Build configuration list for PBXProject "Swiftline" */ = { + OBJ_2 /* Build configuration list for PBXProject "Swiftline" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + OBJ_3 /* Debug */, + OBJ_4 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + OBJ_53 /* Build configuration list for PBXNativeTarget "StringScanner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + OBJ_54 /* Debug */, + OBJ_55 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + OBJ_64 /* Build configuration list for PBXNativeTarget "Swiftline" */ = { isa = XCConfigurationList; buildConfigurations = ( - "_______Debug_" /* Debug */, - "_____Release_" /* Release */, + OBJ_65 /* Debug */, + OBJ_66 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; - "_______Confs_Swiftline" /* Build configuration list for PBXNativeTarget "Swiftline" */ = { + OBJ_91 /* Build configuration list for PBXNativeTarget "SwiftlineTests" */ = { isa = XCConfigurationList; buildConfigurations = ( - "___DebugConf_Swiftline" /* Debug */, - _ReleaseConf_Swiftline /* Release */, + OBJ_92 /* Debug */, + OBJ_93 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; /* End XCConfigurationList section */ }; - rootObject = __RootObject_ /* Project object */; + rootObject = OBJ_1 /* Project object */; } diff --git a/Swiftline.xcodeproj/xcshareddata/xcschemes/Swiftline.xcscheme b/Swiftline.xcodeproj/xcshareddata/xcschemes/Swiftline.xcscheme index e5bbd68..b27c980 100644 --- a/Swiftline.xcodeproj/xcshareddata/xcschemes/Swiftline.xcscheme +++ b/Swiftline.xcodeproj/xcshareddata/xcschemes/Swiftline.xcscheme @@ -14,7 +14,21 @@ buildForAnalyzing = "YES"> + + + + @@ -28,6 +42,16 @@ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> + + + + @@ -45,9 +69,9 @@ diff --git a/SwiftlineTests/.ruby-version b/SwiftlineTests/.ruby-version deleted file mode 100644 index 399088b..0000000 --- a/SwiftlineTests/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -2.1.6 diff --git a/SwiftlineTests/Cartfile b/SwiftlineTests/Cartfile deleted file mode 100644 index e95f845..0000000 --- a/SwiftlineTests/Cartfile +++ /dev/null @@ -1,2 +0,0 @@ -github "Quick/Quick" -github "Quick/Nimble" \ No newline at end of file diff --git a/SwiftlineTests/Cartfile.resolved b/SwiftlineTests/Cartfile.resolved deleted file mode 100644 index 06a76c1..0000000 --- a/SwiftlineTests/Cartfile.resolved +++ /dev/null @@ -1,2 +0,0 @@ -github "Quick/Nimble" "v5.0.0" -github "Quick/Quick" "v0.10.0" diff --git a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework.dSYM/Contents/Info.plist b/SwiftlineTests/Carthage/Build/Mac/Nimble.framework.dSYM/Contents/Info.plist deleted file mode 100644 index fb341f1..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework.dSYM/Contents/Info.plist +++ /dev/null @@ -1,20 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleIdentifier - com.apple.xcode.dsym.net.jeffhui.Nimble - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - dSYM - CFBundleSignature - ???? - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework.dSYM/Contents/Resources/DWARF/Nimble b/SwiftlineTests/Carthage/Build/Mac/Nimble.framework.dSYM/Contents/Resources/DWARF/Nimble deleted file mode 100644 index 54591ce..0000000 Binary files a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework.dSYM/Contents/Resources/DWARF/Nimble and /dev/null differ diff --git a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Headers b/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Headers deleted file mode 120000 index a177d2a..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Headers +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/Headers \ No newline at end of file diff --git a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Modules b/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Modules deleted file mode 120000 index 5736f31..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Modules +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/Modules \ No newline at end of file diff --git a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Nimble b/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Nimble deleted file mode 120000 index fb3238e..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Nimble +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/Nimble \ No newline at end of file diff --git a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Resources b/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Resources deleted file mode 120000 index 953ee36..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Resources +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/Resources \ No newline at end of file diff --git a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Headers/DSL.h b/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Headers/DSL.h deleted file mode 100644 index a499059..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Headers/DSL.h +++ /dev/null @@ -1,145 +0,0 @@ -#import - -@class NMBExpectation; -@class NMBObjCBeCloseToMatcher; -@class NMBObjCRaiseExceptionMatcher; -@protocol NMBMatcher; - - -#define NIMBLE_EXPORT FOUNDATION_EXPORT - -#ifdef NIMBLE_DISABLE_SHORT_SYNTAX -#define NIMBLE_SHORT(PROTO, ORIGINAL) -#else -#define NIMBLE_SHORT(PROTO, ORIGINAL) FOUNDATION_STATIC_INLINE PROTO { return (ORIGINAL); } -#endif - -NIMBLE_EXPORT NMBExpectation *NMB_expect(id(^actualBlock)(), NSString *file, NSUInteger line); -NIMBLE_EXPORT NMBExpectation *NMB_expectAction(void(^actualBlock)(), NSString *file, NSUInteger line); - -NIMBLE_EXPORT id NMB_equal(id expectedValue); -NIMBLE_SHORT(id equal(id expectedValue), - NMB_equal(expectedValue)); - -NIMBLE_EXPORT id NMB_haveCount(id expectedValue); -NIMBLE_SHORT(id haveCount(id expectedValue), - NMB_haveCount(expectedValue)); - -NIMBLE_EXPORT NMBObjCBeCloseToMatcher *NMB_beCloseTo(NSNumber *expectedValue); -NIMBLE_SHORT(NMBObjCBeCloseToMatcher *beCloseTo(id expectedValue), - NMB_beCloseTo(expectedValue)); - -NIMBLE_EXPORT id NMB_beAnInstanceOf(Class expectedClass); -NIMBLE_SHORT(id beAnInstanceOf(Class expectedClass), - NMB_beAnInstanceOf(expectedClass)); - -NIMBLE_EXPORT id NMB_beAKindOf(Class expectedClass); -NIMBLE_SHORT(id beAKindOf(Class expectedClass), - NMB_beAKindOf(expectedClass)); - -NIMBLE_EXPORT id NMB_beginWith(id itemElementOrSubstring); -NIMBLE_SHORT(id beginWith(id itemElementOrSubstring), - NMB_beginWith(itemElementOrSubstring)); - -NIMBLE_EXPORT id NMB_beGreaterThan(NSNumber *expectedValue); -NIMBLE_SHORT(id beGreaterThan(NSNumber *expectedValue), - NMB_beGreaterThan(expectedValue)); - -NIMBLE_EXPORT id NMB_beGreaterThanOrEqualTo(NSNumber *expectedValue); -NIMBLE_SHORT(id beGreaterThanOrEqualTo(NSNumber *expectedValue), - NMB_beGreaterThanOrEqualTo(expectedValue)); - -NIMBLE_EXPORT id NMB_beIdenticalTo(id expectedInstance); -NIMBLE_SHORT(id beIdenticalTo(id expectedInstance), - NMB_beIdenticalTo(expectedInstance)); - -NIMBLE_EXPORT id NMB_be(id expectedInstance); -NIMBLE_SHORT(id be(id expectedInstance), - NMB_be(expectedInstance)); - -NIMBLE_EXPORT id NMB_beLessThan(NSNumber *expectedValue); -NIMBLE_SHORT(id beLessThan(NSNumber *expectedValue), - NMB_beLessThan(expectedValue)); - -NIMBLE_EXPORT id NMB_beLessThanOrEqualTo(NSNumber *expectedValue); -NIMBLE_SHORT(id beLessThanOrEqualTo(NSNumber *expectedValue), - NMB_beLessThanOrEqualTo(expectedValue)); - -NIMBLE_EXPORT id NMB_beTruthy(void); -NIMBLE_SHORT(id beTruthy(void), - NMB_beTruthy()); - -NIMBLE_EXPORT id NMB_beFalsy(void); -NIMBLE_SHORT(id beFalsy(void), - NMB_beFalsy()); - -NIMBLE_EXPORT id NMB_beTrue(void); -NIMBLE_SHORT(id beTrue(void), - NMB_beTrue()); - -NIMBLE_EXPORT id NMB_beFalse(void); -NIMBLE_SHORT(id beFalse(void), - NMB_beFalse()); - -NIMBLE_EXPORT id NMB_beNil(void); -NIMBLE_SHORT(id beNil(void), - NMB_beNil()); - -NIMBLE_EXPORT id NMB_beEmpty(void); -NIMBLE_SHORT(id beEmpty(void), - NMB_beEmpty()); - -NIMBLE_EXPORT id NMB_containWithNilTermination(id itemOrSubstring, ...) NS_REQUIRES_NIL_TERMINATION; -#define NMB_contain(...) NMB_containWithNilTermination(__VA_ARGS__, nil) -#ifndef NIMBLE_DISABLE_SHORT_SYNTAX -#define contain(...) NMB_contain(__VA_ARGS__) -#endif - -NIMBLE_EXPORT id NMB_endWith(id itemElementOrSubstring); -NIMBLE_SHORT(id endWith(id itemElementOrSubstring), - NMB_endWith(itemElementOrSubstring)); - -NIMBLE_EXPORT NMBObjCRaiseExceptionMatcher *NMB_raiseException(void); -NIMBLE_SHORT(NMBObjCRaiseExceptionMatcher *raiseException(void), - NMB_raiseException()); - -NIMBLE_EXPORT id NMB_match(id expectedValue); -NIMBLE_SHORT(id match(id expectedValue), - NMB_match(expectedValue)); - -NIMBLE_EXPORT id NMB_allPass(id matcher); -NIMBLE_SHORT(id allPass(id matcher), - NMB_allPass(matcher)); - -NIMBLE_EXPORT id NMB_satisfyAnyOfWithMatchers(id matchers); -#define NMB_satisfyAnyOf(...) NMB_satisfyAnyOfWithMatchers(@[__VA_ARGS__]) -#ifndef NIMBLE_DISABLE_SHORT_SYNTAX -#define satisfyAnyOf(...) NMB_satisfyAnyOf(__VA_ARGS__) -#endif - -// In order to preserve breakpoint behavior despite using macros to fill in __FILE__ and __LINE__, -// define a builder that populates __FILE__ and __LINE__, and returns a block that takes timeout -// and action arguments. See https://github.com/Quick/Quick/pull/185 for details. -typedef void (^NMBWaitUntilTimeoutBlock)(NSTimeInterval timeout, void (^action)(void (^)(void))); -typedef void (^NMBWaitUntilBlock)(void (^action)(void (^)(void))); - -NIMBLE_EXPORT void NMB_failWithMessage(NSString *msg, NSString *file, NSUInteger line); - -NIMBLE_EXPORT NMBWaitUntilTimeoutBlock NMB_waitUntilTimeoutBuilder(NSString *file, NSUInteger line); -NIMBLE_EXPORT NMBWaitUntilBlock NMB_waitUntilBuilder(NSString *file, NSUInteger line); - -NIMBLE_EXPORT void NMB_failWithMessage(NSString *msg, NSString *file, NSUInteger line); - -#define NMB_waitUntilTimeout NMB_waitUntilTimeoutBuilder(@(__FILE__), __LINE__) -#define NMB_waitUntil NMB_waitUntilBuilder(@(__FILE__), __LINE__) - -#ifndef NIMBLE_DISABLE_SHORT_SYNTAX -#define expect(...) NMB_expect(^id{ return (__VA_ARGS__); }, @(__FILE__), __LINE__) -#define expectAction(BLOCK) NMB_expectAction((BLOCK), @(__FILE__), __LINE__) -#define failWithMessage(msg) NMB_failWithMessage(msg, @(__FILE__), __LINE__) -#define fail() failWithMessage(@"fail() always fails") - - -#define waitUntilTimeout NMB_waitUntilTimeout -#define waitUntil NMB_waitUntil -#endif diff --git a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Headers/NMBExceptionCapture.h b/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Headers/NMBExceptionCapture.h deleted file mode 100644 index e0ec05a..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Headers/NMBExceptionCapture.h +++ /dev/null @@ -1,11 +0,0 @@ -#import -#import - -@interface NMBExceptionCapture : NSObject - -- (nonnull instancetype)initWithHandler:(void(^ _Nullable)(NSException * _Nonnull))handler finally:(void(^ _Nullable)())finally; -- (void)tryBlock:(void(^ _Nonnull)())unsafeBlock NS_SWIFT_NAME(tryBlock(_:)); - -@end - -typedef void(^NMBSourceCallbackBlock)(BOOL successful); diff --git a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Headers/NMBStringify.h b/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Headers/NMBStringify.h deleted file mode 100644 index e5d5ddd..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Headers/NMBStringify.h +++ /dev/null @@ -1,18 +0,0 @@ -@class NSString; - -/** - * Returns a string appropriate for displaying in test output - * from the provided value. - * - * @param value A value that will show up in a test's output. - * - * @return The string that is returned can be - * customized per type by conforming a type to the `TestOutputStringConvertible` - * protocol. When stringifying a non-`TestOutputStringConvertible` type, this - * function will return the value's debug description and then its - * normal description if available and in that order. Otherwise it - * will return the result of constructing a string from the value. - * - * @see `TestOutputStringConvertible` - */ -extern NSString *_Nonnull NMBStringify(id _Nullable anyObject) __attribute__((warn_unused_result)); diff --git a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Headers/Nimble-Swift.h b/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Headers/Nimble-Swift.h deleted file mode 100644 index 7afe81d..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Headers/Nimble-Swift.h +++ /dev/null @@ -1,433 +0,0 @@ -// Generated by Apple Swift version 3.0 (swiftlang-800.0.46.2 clang-800.0.38) -#pragma clang diagnostic push - -#if defined(__has_include) && __has_include() -# include -#endif - -#pragma clang diagnostic ignored "-Wauto-import" -#include -#include -#include -#include - -#if !defined(SWIFT_TYPEDEFS) -# define SWIFT_TYPEDEFS 1 -# if defined(__has_include) && __has_include() -# include -# elif !defined(__cplusplus) || __cplusplus < 201103L -typedef uint_least16_t char16_t; -typedef uint_least32_t char32_t; -# endif -typedef float swift_float2 __attribute__((__ext_vector_type__(2))); -typedef float swift_float3 __attribute__((__ext_vector_type__(3))); -typedef float swift_float4 __attribute__((__ext_vector_type__(4))); -typedef double swift_double2 __attribute__((__ext_vector_type__(2))); -typedef double swift_double3 __attribute__((__ext_vector_type__(3))); -typedef double swift_double4 __attribute__((__ext_vector_type__(4))); -typedef int swift_int2 __attribute__((__ext_vector_type__(2))); -typedef int swift_int3 __attribute__((__ext_vector_type__(3))); -typedef int swift_int4 __attribute__((__ext_vector_type__(4))); -typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2))); -typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3))); -typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4))); -#endif - -#if !defined(SWIFT_PASTE) -# define SWIFT_PASTE_HELPER(x, y) x##y -# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y) -#endif -#if !defined(SWIFT_METATYPE) -# define SWIFT_METATYPE(X) Class -#endif -#if !defined(SWIFT_CLASS_PROPERTY) -# if __has_feature(objc_class_property) -# define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__ -# else -# define SWIFT_CLASS_PROPERTY(...) -# endif -#endif - -#if defined(__has_attribute) && __has_attribute(objc_runtime_name) -# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X))) -#else -# define SWIFT_RUNTIME_NAME(X) -#endif -#if defined(__has_attribute) && __has_attribute(swift_name) -# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X))) -#else -# define SWIFT_COMPILE_NAME(X) -#endif -#if defined(__has_attribute) && __has_attribute(objc_method_family) -# define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X))) -#else -# define SWIFT_METHOD_FAMILY(X) -#endif -#if !defined(SWIFT_CLASS_EXTRA) -# define SWIFT_CLASS_EXTRA -#endif -#if !defined(SWIFT_PROTOCOL_EXTRA) -# define SWIFT_PROTOCOL_EXTRA -#endif -#if !defined(SWIFT_ENUM_EXTRA) -# define SWIFT_ENUM_EXTRA -#endif -#if !defined(SWIFT_CLASS) -# if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted) -# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA -# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA -# else -# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA -# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA -# endif -#endif - -#if !defined(SWIFT_PROTOCOL) -# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA -# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA -#endif - -#if !defined(SWIFT_EXTENSION) -# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__) -#endif - -#if !defined(OBJC_DESIGNATED_INITIALIZER) -# if defined(__has_attribute) && __has_attribute(objc_designated_initializer) -# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) -# else -# define OBJC_DESIGNATED_INITIALIZER -# endif -#endif -#if !defined(SWIFT_ENUM) -# define SWIFT_ENUM(_type, _name) enum _name : _type _name; enum SWIFT_ENUM_EXTRA _name : _type -# if defined(__has_feature) && __has_feature(generalized_swift_name) -# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_EXTRA _name : _type -# else -# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME) SWIFT_ENUM(_type, _name) -# endif -#endif -#if !defined(SWIFT_UNAVAILABLE) -# define SWIFT_UNAVAILABLE __attribute__((unavailable)) -#endif -#if defined(__has_feature) && __has_feature(modules) -@import ObjectiveC; -@import Foundation; -#endif - -#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch" -#pragma clang diagnostic ignored "-Wduplicate-method-arg" - -/** - Encapsulates the failure message that matchers can report to the end user. - This is shared state between Nimble and matchers that mutate this value. -*/ -SWIFT_CLASS("_TtC6Nimble14FailureMessage") -@interface FailureMessage : NSObject -@property (nonatomic, copy) NSString * _Nonnull expected; -@property (nonatomic, copy) NSString * _Nullable actualValue; -@property (nonatomic, copy) NSString * _Nonnull to; -@property (nonatomic, copy) NSString * _Nonnull postfixMessage; -@property (nonatomic, copy) NSString * _Nonnull postfixActual; -/** - An optional message that will be appended as a new line and provides additional details - about the failure. This message will only be visible in the issue navigator / in logs but - not directly in the source editor since only a single line is presented there. -*/ -@property (nonatomic, copy) NSString * _Nullable extendedMessage; -@property (nonatomic, copy) NSString * _Nullable userDescription; -@property (nonatomic, copy) NSString * _Nonnull stringValue; -- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; -- (nonnull instancetype)initWithStringValue:(NSString * _Nonnull)stringValue OBJC_DESIGNATED_INITIALIZER; -@end - - -/** - Protocol for types that support only beEmpty(), haveCount() matchers -*/ -SWIFT_PROTOCOL("_TtP6Nimble13NMBCollection_") -@protocol NMBCollection -@property (nonatomic, readonly) NSInteger count; -@end - - -SWIFT_PROTOCOL("_TtP6Nimble13NMBComparable_") -@protocol NMBComparable -- (NSComparisonResult)NMB_compare:(id _Null_unspecified)otherObject; -@end - - -/** - Protocol for types that support contain() matcher. -*/ -SWIFT_PROTOCOL("_TtP6Nimble12NMBContainer_") -@protocol NMBContainer -- (BOOL)containsObject:(id _Nonnull)anObject; -@end - -@protocol NMBMatcher; - -SWIFT_CLASS("_TtC6Nimble14NMBExpectation") -@interface NMBExpectation : NSObject -- (nonnull instancetype)initWithActualBlock:(NSObject * _Null_unspecified (^ _Nonnull)(void))actualBlock negative:(BOOL)negative file:(NSString * _Nonnull)file line:(NSUInteger)line OBJC_DESIGNATED_INITIALIZER; -@property (nonatomic, readonly, copy) NMBExpectation * _Nonnull (^ _Nonnull withTimeout)(NSTimeInterval); -@property (nonatomic, readonly, copy) void (^ _Nonnull to)(id _Nonnull); -@property (nonatomic, readonly, copy) void (^ _Nonnull toWithDescription)(id _Nonnull, NSString * _Nonnull); -@property (nonatomic, readonly, copy) void (^ _Nonnull toNot)(id _Nonnull); -@property (nonatomic, readonly, copy) void (^ _Nonnull toNotWithDescription)(id _Nonnull, NSString * _Nonnull); -@property (nonatomic, readonly, copy) void (^ _Nonnull notTo)(id _Nonnull); -@property (nonatomic, readonly, copy) void (^ _Nonnull notToWithDescription)(id _Nonnull, NSString * _Nonnull); -@property (nonatomic, readonly, copy) void (^ _Nonnull toEventually)(id _Nonnull); -@property (nonatomic, readonly, copy) void (^ _Nonnull toEventuallyWithDescription)(id _Nonnull, NSString * _Nonnull); -@property (nonatomic, readonly, copy) void (^ _Nonnull toEventuallyNot)(id _Nonnull); -@property (nonatomic, readonly, copy) void (^ _Nonnull toEventuallyNotWithDescription)(id _Nonnull, NSString * _Nonnull); -@property (nonatomic, readonly, copy) void (^ _Nonnull toNotEventually)(id _Nonnull); -@property (nonatomic, readonly, copy) void (^ _Nonnull toNotEventuallyWithDescription)(id _Nonnull, NSString * _Nonnull); -+ (void)failWithMessage:(NSString * _Nonnull)message file:(NSString * _Nonnull)file line:(NSUInteger)line; -- (nonnull instancetype)init SWIFT_UNAVAILABLE; -@end - -@class SourceLocation; - -/** - Objective-C interface to the Swift variant of Matcher. -*/ -SWIFT_PROTOCOL("_TtP6Nimble10NMBMatcher_") -@protocol NMBMatcher -- (BOOL)matches:(NSObject * _Null_unspecified (^ _Nonnull)(void))actualBlock failureMessage:(FailureMessage * _Nonnull)failureMessage location:(SourceLocation * _Nonnull)location; -- (BOOL)doesNotMatch:(NSObject * _Null_unspecified (^ _Nonnull)(void))actualBlock failureMessage:(FailureMessage * _Nonnull)failureMessage location:(SourceLocation * _Nonnull)location; -@end - - -SWIFT_CLASS("_TtC6Nimble23NMBObjCBeCloseToMatcher") -@interface NMBObjCBeCloseToMatcher : NSObject -- (BOOL)matches:(NSObject * _Null_unspecified (^ _Nonnull)(void))actualExpression failureMessage:(FailureMessage * _Nonnull)failureMessage location:(SourceLocation * _Nonnull)location; -- (BOOL)doesNotMatch:(NSObject * _Null_unspecified (^ _Nonnull)(void))actualExpression failureMessage:(FailureMessage * _Nonnull)failureMessage location:(SourceLocation * _Nonnull)location; -@property (nonatomic, readonly, copy) NMBObjCBeCloseToMatcher * _Nonnull (^ _Nonnull within)(double); -- (nonnull instancetype)init SWIFT_UNAVAILABLE; -@end - - -SWIFT_CLASS("_TtC6Nimble14NMBObjCMatcher") -@interface NMBObjCMatcher : NSObject -- (BOOL)matches:(NSObject * _Null_unspecified (^ _Nonnull)(void))actualBlock failureMessage:(FailureMessage * _Nonnull)failureMessage location:(SourceLocation * _Nonnull)location; -- (BOOL)doesNotMatch:(NSObject * _Null_unspecified (^ _Nonnull)(void))actualBlock failureMessage:(FailureMessage * _Nonnull)failureMessage location:(SourceLocation * _Nonnull)location; -- (nonnull instancetype)init SWIFT_UNAVAILABLE; -@end - - -@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble)) -+ (id _Nonnull)equalMatcher:(NSObject * _Nonnull)expected; -@end - - -@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble)) -+ (NMBObjCMatcher * _Nonnull)beLessThanMatcher:(id _Nullable)expected; -@end - - -@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble)) -+ (NMBObjCMatcher * _Nonnull)beGreaterThanMatcher:(id _Nullable)expected; -@end - -@class NMBObjCRaiseExceptionMatcher; - -@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble)) -+ (NMBObjCRaiseExceptionMatcher * _Nonnull)raiseExceptionMatcher; -@end - - -@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble)) -+ (NMBObjCMatcher * _Nonnull)containMatcher:(NSArray * _Nonnull)expected; -@end - - -@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble)) -+ (NMBObjCMatcher * _Nonnull)satisfyAnyOfMatcher:(NSArray * _Nonnull)matchers; -@end - -@class NSNumber; - -@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble)) -+ (NMBObjCBeCloseToMatcher * _Nonnull)beCloseToMatcher:(NSNumber * _Nonnull)expected within:(double)within; -@end - - -@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble)) -+ (NMBObjCMatcher * _Nonnull)beLessThanOrEqualToMatcher:(id _Nullable)expected; -@end - - -@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble)) -+ (id _Nonnull)beAnInstanceOfMatcher:(Class _Nonnull)expected; -@end - - -@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble)) -+ (NMBObjCMatcher * _Nonnull)allPassMatcher:(NMBObjCMatcher * _Nonnull)matcher; -@end - - -@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble)) -+ (id _Nonnull)beAKindOfMatcher:(Class _Nonnull)expected; -@end - -@class NSString; - -@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble)) -+ (id _Nonnull)matchMatcher:(NSString * _Nonnull)expected; -@end - - -@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble)) -+ (NMBObjCMatcher * _Nonnull)haveCountMatcher:(NSNumber * _Nonnull)expected; -@end - - -@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble)) -+ (NMBObjCMatcher * _Nonnull)endWithMatcher:(id _Nonnull)expected; -@end - - -@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble)) -+ (NMBObjCMatcher * _Nonnull)beNilMatcher; -@end - - -@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble)) -+ (NMBObjCMatcher * _Nonnull)beEmptyMatcher; -@end - - -@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble)) -+ (NMBObjCMatcher * _Nonnull)beIdenticalToMatcher:(NSObject * _Nullable)expected; -@end - - -@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble)) -+ (NMBObjCMatcher * _Nonnull)beginWithMatcher:(id _Nonnull)expected; -@end - - -@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble)) -+ (NMBObjCMatcher * _Nonnull)beGreaterThanOrEqualToMatcher:(id _Nullable)expected; -@end - - -@interface NMBObjCMatcher (SWIFT_EXTENSION(Nimble)) -+ (NMBObjCMatcher * _Nonnull)beTruthyMatcher; -+ (NMBObjCMatcher * _Nonnull)beFalsyMatcher; -+ (NMBObjCMatcher * _Nonnull)beTrueMatcher; -+ (NMBObjCMatcher * _Nonnull)beFalseMatcher; -@end - -@class NSDictionary; -@class NSException; - -SWIFT_CLASS("_TtC6Nimble28NMBObjCRaiseExceptionMatcher") -@interface NMBObjCRaiseExceptionMatcher : NSObject -- (BOOL)matches:(NSObject * _Null_unspecified (^ _Nonnull)(void))actualBlock failureMessage:(FailureMessage * _Nonnull)failureMessage location:(SourceLocation * _Nonnull)location; -- (BOOL)doesNotMatch:(NSObject * _Null_unspecified (^ _Nonnull)(void))actualBlock failureMessage:(FailureMessage * _Nonnull)failureMessage location:(SourceLocation * _Nonnull)location; -@property (nonatomic, readonly, copy) NMBObjCRaiseExceptionMatcher * _Nonnull (^ _Nonnull named)(NSString * _Nonnull); -@property (nonatomic, readonly, copy) NMBObjCRaiseExceptionMatcher * _Nonnull (^ _Nonnull reason)(NSString * _Nullable); -@property (nonatomic, readonly, copy) NMBObjCRaiseExceptionMatcher * _Nonnull (^ _Nonnull userInfo)(NSDictionary * _Nullable); -@property (nonatomic, readonly, copy) NMBObjCRaiseExceptionMatcher * _Nonnull (^ _Nonnull satisfyingBlock)(void (^ _Nullable)(NSException * _Nonnull)); -- (nonnull instancetype)init SWIFT_UNAVAILABLE; -@end - - -/** - Protocol for types that support beginWith(), endWith(), beEmpty() matchers -*/ -SWIFT_PROTOCOL("_TtP6Nimble20NMBOrderedCollection_") -@protocol NMBOrderedCollection -- (id _Nonnull)objectAtIndex:(NSInteger)index; -@end - - -SWIFT_CLASS("_TtC6Nimble11NMBStringer") -@interface NMBStringer : NSObject -+ (NSString * _Nonnull)stringify:(id _Nullable)obj; -- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; -@end - - -@interface NSArray (SWIFT_EXTENSION(Nimble)) -@end - - -@interface NSArray (SWIFT_EXTENSION(Nimble)) -@end - - -@interface NSArray (SWIFT_EXTENSION(Nimble)) -@property (nonatomic, readonly, copy) NSString * _Nonnull testDescription; -@end - - -@interface NSDate (SWIFT_EXTENSION(Nimble)) -@property (nonatomic, readonly, copy) NSString * _Nonnull testDescription; -@end - - -@interface NSDate (SWIFT_EXTENSION(Nimble)) -@property (nonatomic, readonly) double doubleValue; -@end - - -@interface NSDictionary (SWIFT_EXTENSION(Nimble)) -@end - - -@interface NSHashTable (SWIFT_EXTENSION(Nimble)) -@end - - -@interface NSIndexSet (SWIFT_EXTENSION(Nimble)) -@end - - -@interface NSIndexSet (SWIFT_EXTENSION(Nimble)) -@property (nonatomic, readonly, copy) NSString * _Nonnull testDescription; -@end - - -@interface NSMapTable (SWIFT_EXTENSION(Nimble)) -@end - - -@interface NSNumber (SWIFT_EXTENSION(Nimble)) -@end - - -@interface NSNumber (SWIFT_EXTENSION(Nimble)) -- (NSComparisonResult)NMB_compare:(id _Null_unspecified)otherObject; -@end - - -@interface NSNumber (SWIFT_EXTENSION(Nimble)) -@property (nonatomic, readonly, copy) NSString * _Nonnull testDescription; -@end - - -@interface NSSet (SWIFT_EXTENSION(Nimble)) -@end - - -@interface NSSet (SWIFT_EXTENSION(Nimble)) -@end - - -@interface NSString (SWIFT_EXTENSION(Nimble)) -- (NSComparisonResult)NMB_compare:(id _Null_unspecified)otherObject; -@end - - -SWIFT_CLASS("_TtC6Nimble14SourceLocation") -@interface SourceLocation : NSObject -@property (nonatomic, readonly, copy) NSString * _Nonnull file; -@property (nonatomic, readonly) NSUInteger line; -- (nonnull instancetype)init SWIFT_UNAVAILABLE; -@property (nonatomic, readonly, copy) NSString * _Nonnull description; -@end - -#pragma clang diagnostic pop diff --git a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Headers/Nimble.h b/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Headers/Nimble.h deleted file mode 100644 index 1eab61a..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Headers/Nimble.h +++ /dev/null @@ -1,7 +0,0 @@ -#import -#import "NMBExceptionCapture.h" -#import "NMBStringify.h" -#import "DSL.h" - -FOUNDATION_EXPORT double NimbleVersionNumber; -FOUNDATION_EXPORT const unsigned char NimbleVersionString[]; diff --git a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Modules/Nimble.swiftmodule/x86_64.swiftdoc b/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Modules/Nimble.swiftmodule/x86_64.swiftdoc deleted file mode 100644 index c0074e8..0000000 Binary files a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Modules/Nimble.swiftmodule/x86_64.swiftdoc and /dev/null differ diff --git a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Modules/Nimble.swiftmodule/x86_64.swiftmodule b/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Modules/Nimble.swiftmodule/x86_64.swiftmodule deleted file mode 100644 index 1273801..0000000 Binary files a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Modules/Nimble.swiftmodule/x86_64.swiftmodule and /dev/null differ diff --git a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Modules/module.modulemap b/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Modules/module.modulemap deleted file mode 100644 index a8769c2..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Modules/module.modulemap +++ /dev/null @@ -1,10 +0,0 @@ -framework module Nimble { - umbrella header "Nimble.h" - - export * - module * { export * } -} - -module Nimble.Swift { - header "Nimble-Swift.h" -} diff --git a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Nimble b/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Nimble deleted file mode 100755 index b608a5a..0000000 Binary files a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Nimble and /dev/null differ diff --git a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Resources/Info.plist b/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Resources/Info.plist deleted file mode 100644 index 67cece6..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/A/Resources/Info.plist +++ /dev/null @@ -1,51 +0,0 @@ - - - - - BuildMachineOSBuild - 15G1004 - CFBundleDevelopmentRegion - en - CFBundleExecutable - Nimble - CFBundleIdentifier - net.jeffhui.Nimble - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Nimble - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleSupportedPlatforms - - MacOSX - - CFBundleVersion - 1 - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 8A218a - DTPlatformVersion - GM - DTSDKBuild - 16A300 - DTSDKName - macosx10.12 - DTXcode - 0800 - DTXcodeBuild - 8A218a - NSHumanReadableCopyright - Copyright © 2014 Jeff Hui. All rights reserved. - UIDeviceFamily - - 1 - 2 - - - diff --git a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/Current b/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/Current deleted file mode 120000 index 8c7e5a6..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Nimble.framework/Versions/Current +++ /dev/null @@ -1 +0,0 @@ -A \ No newline at end of file diff --git a/SwiftlineTests/Carthage/Build/Mac/Quick.framework.dSYM/Contents/Info.plist b/SwiftlineTests/Carthage/Build/Mac/Quick.framework.dSYM/Contents/Info.plist deleted file mode 100644 index 2d39dc1..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Quick.framework.dSYM/Contents/Info.plist +++ /dev/null @@ -1,20 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleIdentifier - com.apple.xcode.dsym.io.quick.Quick - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - dSYM - CFBundleSignature - ???? - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/SwiftlineTests/Carthage/Build/Mac/Quick.framework.dSYM/Contents/Resources/DWARF/Quick b/SwiftlineTests/Carthage/Build/Mac/Quick.framework.dSYM/Contents/Resources/DWARF/Quick deleted file mode 100644 index 0029159..0000000 Binary files a/SwiftlineTests/Carthage/Build/Mac/Quick.framework.dSYM/Contents/Resources/DWARF/Quick and /dev/null differ diff --git a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Headers b/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Headers deleted file mode 120000 index a177d2a..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Headers +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/Headers \ No newline at end of file diff --git a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Modules b/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Modules deleted file mode 120000 index 5736f31..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Modules +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/Modules \ No newline at end of file diff --git a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Quick b/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Quick deleted file mode 120000 index 1651b83..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Quick +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/Quick \ No newline at end of file diff --git a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Resources b/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Resources deleted file mode 120000 index 953ee36..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Resources +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/Resources \ No newline at end of file diff --git a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Headers/QCKDSL.h b/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Headers/QCKDSL.h deleted file mode 100644 index c5f3152..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Headers/QCKDSL.h +++ /dev/null @@ -1,234 +0,0 @@ -#import - -@class ExampleMetadata; - -/** - Provides a hook for Quick to be configured before any examples are run. - Within this scope, override the +[QuickConfiguration configure:] method - to set properties on a configuration object to customize Quick behavior. - For details, see the documentation for Configuraiton.swift. - - @param name The name of the configuration class. Like any Objective-C - class name, this must be unique to the current runtime - environment. - */ -#define QuickConfigurationBegin(name) \ - @interface name : QuickConfiguration; @end \ - @implementation name \ - - -/** - Marks the end of a Quick configuration. - Make sure you put this after `QuickConfigurationBegin`. - */ -#define QuickConfigurationEnd \ - @end \ - - -/** - Defines a new QuickSpec. Define examples and example groups within the space - between this and `QuickSpecEnd`. - - @param name The name of the spec class. Like any Objective-C class name, this - must be unique to the current runtime environment. - */ -#define QuickSpecBegin(name) \ - @interface name : QuickSpec; @end \ - @implementation name \ - - (void)spec { \ - - -/** - Marks the end of a QuickSpec. Make sure you put this after `QuickSpecBegin`. - */ -#define QuickSpecEnd \ - } \ - @end \ - -typedef NSDictionary *(^QCKDSLSharedExampleContext)(void); -typedef void (^QCKDSLSharedExampleBlock)(QCKDSLSharedExampleContext); -typedef void (^QCKDSLEmptyBlock)(void); -typedef void (^QCKDSLExampleMetadataBlock)(ExampleMetadata *exampleMetadata); - -#define QUICK_EXPORT FOUNDATION_EXPORT - -QUICK_EXPORT void qck_beforeSuite(QCKDSLEmptyBlock closure); -QUICK_EXPORT void qck_afterSuite(QCKDSLEmptyBlock closure); -QUICK_EXPORT void qck_sharedExamples(NSString *name, QCKDSLSharedExampleBlock closure); -QUICK_EXPORT void qck_describe(NSString *description, QCKDSLEmptyBlock closure); -QUICK_EXPORT void qck_context(NSString *description, QCKDSLEmptyBlock closure); -QUICK_EXPORT void qck_beforeEach(QCKDSLEmptyBlock closure); -QUICK_EXPORT void qck_beforeEachWithMetadata(QCKDSLExampleMetadataBlock closure); -QUICK_EXPORT void qck_afterEach(QCKDSLEmptyBlock closure); -QUICK_EXPORT void qck_afterEachWithMetadata(QCKDSLExampleMetadataBlock closure); -QUICK_EXPORT void qck_pending(NSString *description, QCKDSLEmptyBlock closure); -QUICK_EXPORT void qck_xdescribe(NSString *description, QCKDSLEmptyBlock closure); -QUICK_EXPORT void qck_xcontext(NSString *description, QCKDSLEmptyBlock closure); -QUICK_EXPORT void qck_fdescribe(NSString *description, QCKDSLEmptyBlock closure); -QUICK_EXPORT void qck_fcontext(NSString *description, QCKDSLEmptyBlock closure); - -#ifndef QUICK_DISABLE_SHORT_SYNTAX -/** - Defines a closure to be run prior to any examples in the test suite. - You may define an unlimited number of these closures, but there is no - guarantee as to the order in which they're run. - - If the test suite crashes before the first example is run, this closure - will not be executed. - - @param closure The closure to be run prior to any examples in the test suite. - */ -static inline void beforeSuite(QCKDSLEmptyBlock closure) { - qck_beforeSuite(closure); -} - - -/** - Defines a closure to be run after all of the examples in the test suite. - You may define an unlimited number of these closures, but there is no - guarantee as to the order in which they're run. - - If the test suite crashes before all examples are run, this closure - will not be executed. - - @param closure The closure to be run after all of the examples in the test suite. - */ -static inline void afterSuite(QCKDSLEmptyBlock closure) { - qck_afterSuite(closure); -} - -/** - Defines a group of shared examples. These examples can be re-used in several locations - by using the `itBehavesLike` function. - - @param name The name of the shared example group. This must be unique across all shared example - groups defined in a test suite. - @param closure A closure containing the examples. This behaves just like an example group defined - using `describe` or `context`--the closure may contain any number of `beforeEach` - and `afterEach` closures, as well as any number of examples (defined using `it`). - */ -static inline void sharedExamples(NSString *name, QCKDSLSharedExampleBlock closure) { - qck_sharedExamples(name, closure); -} - -/** - Defines an example group. Example groups are logical groupings of examples. - Example groups can share setup and teardown code. - - @param description An arbitrary string describing the example group. - @param closure A closure that can contain other examples. - */ -static inline void describe(NSString *description, QCKDSLEmptyBlock closure) { - qck_describe(description, closure); -} - -/** - Defines an example group. Equivalent to `describe`. - */ -static inline void context(NSString *description, QCKDSLEmptyBlock closure) { - qck_context(description, closure); -} - -/** - Defines a closure to be run prior to each example in the current example - group. This closure is not run for pending or otherwise disabled examples. - An example group may contain an unlimited number of beforeEach. They'll be - run in the order they're defined, but you shouldn't rely on that behavior. - - @param closure The closure to be run prior to each example. - */ -static inline void beforeEach(QCKDSLEmptyBlock closure) { - qck_beforeEach(closure); -} - -/** - Identical to QCKDSL.beforeEach, except the closure is provided with - metadata on the example that the closure is being run prior to. - */ -static inline void beforeEachWithMetadata(QCKDSLExampleMetadataBlock closure) { - qck_beforeEachWithMetadata(closure); -} - -/** - Defines a closure to be run after each example in the current example - group. This closure is not run for pending or otherwise disabled examples. - An example group may contain an unlimited number of afterEach. They'll be - run in the order they're defined, but you shouldn't rely on that behavior. - - @param closure The closure to be run after each example. - */ -static inline void afterEach(QCKDSLEmptyBlock closure) { - qck_afterEach(closure); -} - -/** - Identical to QCKDSL.afterEach, except the closure is provided with - metadata on the example that the closure is being run after. - */ -static inline void afterEachWithMetadata(QCKDSLExampleMetadataBlock closure) { - qck_afterEachWithMetadata(closure); -} - -/** - Defines an example or example group that should not be executed. Use `pending` to temporarily disable - examples or groups that should not be run yet. - - @param description An arbitrary string describing the example or example group. - @param closure A closure that will not be evaluated. - */ -static inline void pending(NSString *description, QCKDSLEmptyBlock closure) { - qck_pending(description, closure); -} - -/** - Use this to quickly mark a `describe` block as pending. - This disables all examples within the block. - */ -static inline void xdescribe(NSString *description, QCKDSLEmptyBlock closure) { - qck_xdescribe(description, closure); -} - -/** - Use this to quickly mark a `context` block as pending. - This disables all examples within the block. - */ -static inline void xcontext(NSString *description, QCKDSLEmptyBlock closure) { - qck_xcontext(description, closure); -} - -/** - Use this to quickly focus a `describe` block, focusing the examples in the block. - If any examples in the test suite are focused, only those examples are executed. - This trumps any explicitly focused or unfocused examples within the block--they are all treated as focused. - */ -static inline void fdescribe(NSString *description, QCKDSLEmptyBlock closure) { - qck_fdescribe(description, closure); -} - -/** - Use this to quickly focus a `context` block. Equivalent to `fdescribe`. - */ -static inline void fcontext(NSString *description, QCKDSLEmptyBlock closure) { - qck_fcontext(description, closure); -} - -#define it qck_it -#define xit qck_xit -#define fit qck_fit -#define itBehavesLike qck_itBehavesLike -#define xitBehavesLike qck_xitBehavesLike -#define fitBehavesLike qck_fitBehavesLike -#endif - -#define qck_it qck_it_builder(@{}, @(__FILE__), __LINE__) -#define qck_xit qck_it_builder(@{Filter.pending: @YES}, @(__FILE__), __LINE__) -#define qck_fit qck_it_builder(@{Filter.focused: @YES}, @(__FILE__), __LINE__) -#define qck_itBehavesLike qck_itBehavesLike_builder(@{}, @(__FILE__), __LINE__) -#define qck_xitBehavesLike qck_itBehavesLike_builder(@{Filter.pending: @YES}, @(__FILE__), __LINE__) -#define qck_fitBehavesLike qck_itBehavesLike_builder(@{Filter.focused: @YES}, @(__FILE__), __LINE__) - -typedef void (^QCKItBlock)(NSString *description, QCKDSLEmptyBlock closure); -typedef void (^QCKItBehavesLikeBlock)(NSString *description, QCKDSLSharedExampleContext context); - -QUICK_EXPORT QCKItBlock qck_it_builder(NSDictionary *flags, NSString *file, NSUInteger line); -QUICK_EXPORT QCKItBehavesLikeBlock qck_itBehavesLike_builder(NSDictionary *flags, NSString *file, NSUInteger line); diff --git a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Headers/Quick-Swift.h b/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Headers/Quick-Swift.h deleted file mode 100644 index fa0e0ba..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Headers/Quick-Swift.h +++ /dev/null @@ -1,351 +0,0 @@ -// Generated by Apple Swift version 3.0 (swiftlang-800.0.46.2 clang-800.0.38) -#pragma clang diagnostic push - -#if defined(__has_include) && __has_include() -# include -#endif - -#pragma clang diagnostic ignored "-Wauto-import" -#include -#include -#include -#include - -#if !defined(SWIFT_TYPEDEFS) -# define SWIFT_TYPEDEFS 1 -# if defined(__has_include) && __has_include() -# include -# elif !defined(__cplusplus) || __cplusplus < 201103L -typedef uint_least16_t char16_t; -typedef uint_least32_t char32_t; -# endif -typedef float swift_float2 __attribute__((__ext_vector_type__(2))); -typedef float swift_float3 __attribute__((__ext_vector_type__(3))); -typedef float swift_float4 __attribute__((__ext_vector_type__(4))); -typedef double swift_double2 __attribute__((__ext_vector_type__(2))); -typedef double swift_double3 __attribute__((__ext_vector_type__(3))); -typedef double swift_double4 __attribute__((__ext_vector_type__(4))); -typedef int swift_int2 __attribute__((__ext_vector_type__(2))); -typedef int swift_int3 __attribute__((__ext_vector_type__(3))); -typedef int swift_int4 __attribute__((__ext_vector_type__(4))); -typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2))); -typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3))); -typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4))); -#endif - -#if !defined(SWIFT_PASTE) -# define SWIFT_PASTE_HELPER(x, y) x##y -# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y) -#endif -#if !defined(SWIFT_METATYPE) -# define SWIFT_METATYPE(X) Class -#endif -#if !defined(SWIFT_CLASS_PROPERTY) -# if __has_feature(objc_class_property) -# define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__ -# else -# define SWIFT_CLASS_PROPERTY(...) -# endif -#endif - -#if defined(__has_attribute) && __has_attribute(objc_runtime_name) -# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X))) -#else -# define SWIFT_RUNTIME_NAME(X) -#endif -#if defined(__has_attribute) && __has_attribute(swift_name) -# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X))) -#else -# define SWIFT_COMPILE_NAME(X) -#endif -#if defined(__has_attribute) && __has_attribute(objc_method_family) -# define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X))) -#else -# define SWIFT_METHOD_FAMILY(X) -#endif -#if !defined(SWIFT_CLASS_EXTRA) -# define SWIFT_CLASS_EXTRA -#endif -#if !defined(SWIFT_PROTOCOL_EXTRA) -# define SWIFT_PROTOCOL_EXTRA -#endif -#if !defined(SWIFT_ENUM_EXTRA) -# define SWIFT_ENUM_EXTRA -#endif -#if !defined(SWIFT_CLASS) -# if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted) -# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA -# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA -# else -# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA -# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA -# endif -#endif - -#if !defined(SWIFT_PROTOCOL) -# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA -# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA -#endif - -#if !defined(SWIFT_EXTENSION) -# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__) -#endif - -#if !defined(OBJC_DESIGNATED_INITIALIZER) -# if defined(__has_attribute) && __has_attribute(objc_designated_initializer) -# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) -# else -# define OBJC_DESIGNATED_INITIALIZER -# endif -#endif -#if !defined(SWIFT_ENUM) -# define SWIFT_ENUM(_type, _name) enum _name : _type _name; enum SWIFT_ENUM_EXTRA _name : _type -# if defined(__has_feature) && __has_feature(generalized_swift_name) -# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_EXTRA _name : _type -# else -# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME) SWIFT_ENUM(_type, _name) -# endif -#endif -#if !defined(SWIFT_UNAVAILABLE) -# define SWIFT_UNAVAILABLE __attribute__((unavailable)) -#endif -#if defined(__has_feature) && __has_feature(modules) -@import Foundation; -@import ObjectiveC; -@import XCTest; -#endif - -#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch" -#pragma clang diagnostic ignored "-Wduplicate-method-arg" - -@interface NSBundle (SWIFT_EXTENSION(Quick)) -@end - - -/** - An object encapsulating the file and line number at which - a particular example is defined. -*/ -SWIFT_CLASS("_TtC5Quick8Callsite") -@interface Callsite : NSObject -/** - The absolute path of the file in which an example is defined. -*/ -@property (nonatomic, readonly, copy) NSString * _Nonnull file; -/** - The line number on which an example is defined. -*/ -@property (nonatomic, readonly) NSUInteger line; -- (nonnull instancetype)init SWIFT_UNAVAILABLE; -@end - -@class Example; -@class ExampleMetadata; - -/** - A configuration encapsulates various options you can use - to configure Quick’s behavior. -*/ -SWIFT_CLASS("_TtC5Quick13Configuration") -@interface Configuration : NSObject -/** - Run all examples if none match the configured filters. True by default. -*/ -@property (nonatomic) BOOL runAllWhenEverythingFiltered; -/** - Registers an inclusion filter. - All examples are filtered using all inclusion filters. - The remaining examples are run. If no examples remain, all examples are run. - \param filter A filter that, given an example, returns a value indicating - whether that example should be included in the examples - that are run. - -*/ -- (void)include:(BOOL (^ _Nonnull)(Example * _Nonnull))filter; -/** - Registers an exclusion filter. - All examples that remain after being filtered by the inclusion filters are - then filtered via all exclusion filters. - \param filter A filter that, given an example, returns a value indicating - whether that example should be excluded from the examples - that are run. - -*/ -- (void)exclude:(BOOL (^ _Nonnull)(Example * _Nonnull))filter; -- (void)beforeEachWithMetadata:(void (^ _Nonnull)(ExampleMetadata * _Nonnull))closure; -/** - Like Quick.DSL.beforeEach, this configures Quick to execute the - given closure before each example that is run. The closure - passed to this method is executed before each example Quick runs, - globally across the test suite. You may call this method multiple - times across mulitple +[QuickConfigure configure:] methods in order - to define several closures to run before each example. - Note that, since Quick makes no guarantee as to the order in which - +[QuickConfiguration configure:] methods are evaluated, there is no - guarantee as to the order in which beforeEach closures are evaluated - either. Mulitple beforeEach defined on a single configuration, however, - will be executed in the order they’re defined. - \param closure The closure to be executed before each example - in the test suite. - -*/ -- (void)beforeEach:(void (^ _Nonnull)(void))closure; -- (void)afterEachWithMetadata:(void (^ _Nonnull)(ExampleMetadata * _Nonnull))closure; -/** - Like Quick.DSL.afterEach, this configures Quick to execute the - given closure after each example that is run. The closure - passed to this method is executed after each example Quick runs, - globally across the test suite. You may call this method multiple - times across mulitple +[QuickConfigure configure:] methods in order - to define several closures to run after each example. - Note that, since Quick makes no guarantee as to the order in which - +[QuickConfiguration configure:] methods are evaluated, there is no - guarantee as to the order in which afterEach closures are evaluated - either. Mulitple afterEach defined on a single configuration, however, - will be executed in the order they’re defined. - \param closure The closure to be executed before each example - in the test suite. - -*/ -- (void)afterEach:(void (^ _Nonnull)(void))closure; -/** - Like Quick.DSL.beforeSuite, this configures Quick to execute - the given closure prior to any and all examples that are run. - The two methods are functionally equivalent. -*/ -- (void)beforeSuite:(void (^ _Nonnull)(void))closure; -/** - Like Quick.DSL.afterSuite, this configures Quick to execute - the given closure after all examples have been run. - The two methods are functionally equivalent. -*/ -- (void)afterSuite:(void (^ _Nonnull)(void))closure; -- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; -@end - - -/** - Examples, defined with the \code - it - \endcode function, use assertions to - demonstrate how code should behave. These are like “tests” in XCTest. -*/ -SWIFT_CLASS("_TtC5Quick7Example") -@interface Example : NSObject -/** - A boolean indicating whether the example is a shared example; - i.e.: whether it is an example defined with \code - itBehavesLike - \endcode. -*/ -@property (nonatomic) BOOL isSharedExample; -/** - The site at which the example is defined. - This must be set correctly in order for Xcode to highlight - the correct line in red when reporting a failure. -*/ -@property (nonatomic, strong) Callsite * _Nonnull callsite; -@property (nonatomic, readonly, copy) NSString * _Nonnull description; -/** - The example name. A name is a concatenation of the name of - the example group the example belongs to, followed by the - description of the example itself. - The example name is used to generate a test method selector - to be displayed in Xcode’s test navigator. -*/ -@property (nonatomic, readonly, copy) NSString * _Nonnull name; -/** - Executes the example closure, as well as all before and after - closures defined in the its surrounding example groups. -*/ -- (void)run; -- (nonnull instancetype)init SWIFT_UNAVAILABLE; -@end - - -/** - Example groups are logical groupings of examples, defined with - the \code - describe - \endcode and \code - context - \endcode functions. Example groups can share - setup and teardown code. -*/ -SWIFT_CLASS("_TtC5Quick12ExampleGroup") -@interface ExampleGroup : NSObject -@property (nonatomic, readonly, copy) NSString * _Nonnull description; -/** - Returns a list of examples that belong to this example group, - or to any of its descendant example groups. -*/ -@property (nonatomic, readonly, copy) NSArray * _Nonnull examples; -- (nonnull instancetype)init SWIFT_UNAVAILABLE; -@end - - -/** - A class that encapsulates information about an example, - including the index at which the example was executed, as - well as the example itself. -*/ -SWIFT_CLASS("_TtC5Quick15ExampleMetadata") -@interface ExampleMetadata : NSObject -/** - The example for which this metadata was collected. -*/ -@property (nonatomic, readonly, strong) Example * _Nonnull example; -/** - The index at which this example was executed in the - test suite. -*/ -@property (nonatomic, readonly) NSInteger exampleIndex; -- (nonnull instancetype)init SWIFT_UNAVAILABLE; -@end - - -/** - A namespace for filter flag keys, defined primarily to make the - keys available in Objective-C. -*/ -SWIFT_CLASS("_TtC5Quick6Filter") -@interface Filter : NSObject -/** - Example and example groups with [Focused: true] are included in test runs, - excluding all other examples without this flag. Use this to only run one or - two tests that you’re currently focusing on. -*/ -SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull focused;) -+ (NSString * _Nonnull)focused; -/** - Example and example groups with [Pending: true] are excluded from test runs. - Use this to temporarily suspend examples that you know do not pass yet. -*/ -SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull pending;) -+ (NSString * _Nonnull)pending; -- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; -@end - - -/** - A base class for a class cluster of Quick test suites, that should correctly - build dynamic test suites for XCTest to execute. -*/ -SWIFT_CLASS("_TtC5Quick14QuickTestSuite") -@interface QuickTestSuite : XCTestSuite -/** - Construct a test suite for a specific, selected subset of test cases (rather - than the default, which as all test cases). - If this method is called multiple times for the same test case class, e.g.. - FooSpec/testFoo - FooSpec/testBar - It is expected that the first call should return a valid test suite, and - all subsequent calls should return \code - nil - \endcode. -*/ -+ (QuickTestSuite * _Nullable)selectedTestSuiteForTestCaseWithName:(NSString * _Nonnull)name; -- (nonnull instancetype)initWithName:(NSString * _Nonnull)name OBJC_DESIGNATED_INITIALIZER; -@end - -#pragma clang diagnostic pop diff --git a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Headers/Quick.h b/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Headers/Quick.h deleted file mode 100644 index 87dad10..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Headers/Quick.h +++ /dev/null @@ -1,11 +0,0 @@ -#import - -//! Project version number for Quick. -FOUNDATION_EXPORT double QuickVersionNumber; - -//! Project version string for Quick. -FOUNDATION_EXPORT const unsigned char QuickVersionString[]; - -#import "QuickSpec.h" -#import "QCKDSL.h" -#import "QuickConfiguration.h" diff --git a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Headers/QuickConfiguration.h b/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Headers/QuickConfiguration.h deleted file mode 100644 index 5646199..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Headers/QuickConfiguration.h +++ /dev/null @@ -1,30 +0,0 @@ -#import - -@class Configuration; - -/** - Subclass QuickConfiguration and override the +[QuickConfiguration configure:] - method in order to configure how Quick behaves when running specs, or to define - shared examples that are used across spec files. - */ -@interface QuickConfiguration : NSObject - -/** - This method is executed on each subclass of this class before Quick runs - any examples. You may override this method on as many subclasses as you like, but - there is no guarantee as to the order in which these methods are executed. - - You can override this method in order to: - - 1. Configure how Quick behaves, by modifying properties on the Configuration object. - Setting the same properties in several methods has undefined behavior. - - 2. Define shared examples using `sharedExamples`. - - @param configuration A mutable object that is used to configure how Quick behaves on - a framework level. For details on all the options, see the - documentation in Configuration.swift. - */ -+ (void)configure:(Configuration *)configuration; - -@end diff --git a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Headers/QuickSpec.h b/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Headers/QuickSpec.h deleted file mode 100644 index 105a97e..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Headers/QuickSpec.h +++ /dev/null @@ -1,50 +0,0 @@ -#import - -/** - QuickSpec is a base class all specs written in Quick inherit from. - They need to inherit from QuickSpec, a subclass of XCTestCase, in - order to be discovered by the XCTest framework. - - XCTest automatically compiles a list of XCTestCase subclasses included - in the test target. It iterates over each class in that list, and creates - a new instance of that class for each test method. It then creates an - "invocation" to execute that test method. The invocation is an instance of - NSInvocation, which represents a single message send in Objective-C. - The invocation is set on the XCTestCase instance, and the test is run. - - Most of the code in QuickSpec is dedicated to hooking into XCTest events. - First, when the spec is first loaded and before it is sent any messages, - the +[NSObject initialize] method is called. QuickSpec overrides this method - to call +[QuickSpec spec]. This builds the example group stacks and - registers them with Quick.World, a global register of examples. - - Then, XCTest queries QuickSpec for a list of test methods. Normally, XCTest - automatically finds all methods whose selectors begin with the string "test". - However, QuickSpec overrides this default behavior by implementing the - +[XCTestCase testInvocations] method. This method iterates over each example - registered in Quick.World, defines a new method for that example, and - returns an invocation to call that method to XCTest. Those invocations are - the tests that are run by XCTest. Their selector names are displayed in - the Xcode test navigation bar. - */ -@interface QuickSpec : XCTestCase - -/** - Override this method in your spec to define a set of example groups - and examples. - - @code - override func spec() { - describe("winter") { - it("is coming") { - // ... - } - } - } - @endcode - - See DSL.swift for more information on what syntax is available. - */ -- (void)spec; - -@end diff --git a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Modules/Quick.swiftmodule/x86_64.swiftdoc b/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Modules/Quick.swiftmodule/x86_64.swiftdoc deleted file mode 100644 index 935cbbf..0000000 Binary files a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Modules/Quick.swiftmodule/x86_64.swiftdoc and /dev/null differ diff --git a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Modules/Quick.swiftmodule/x86_64.swiftmodule b/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Modules/Quick.swiftmodule/x86_64.swiftmodule deleted file mode 100644 index 4c91028..0000000 Binary files a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Modules/Quick.swiftmodule/x86_64.swiftmodule and /dev/null differ diff --git a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Modules/module.modulemap b/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Modules/module.modulemap deleted file mode 100644 index 43f1882..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Modules/module.modulemap +++ /dev/null @@ -1,10 +0,0 @@ -framework module Quick { - umbrella header "Quick.h" - - export * - module * { export * } -} - -module Quick.Swift { - header "Quick-Swift.h" -} diff --git a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Quick b/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Quick deleted file mode 100755 index 9264f19..0000000 Binary files a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Quick and /dev/null differ diff --git a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Resources/Info.plist b/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Resources/Info.plist deleted file mode 100644 index 5dc6a9e..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/A/Resources/Info.plist +++ /dev/null @@ -1,46 +0,0 @@ - - - - - BuildMachineOSBuild - 15G1004 - CFBundleDevelopmentRegion - en - CFBundleExecutable - Quick - CFBundleIdentifier - io.quick.Quick - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Quick - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleSupportedPlatforms - - MacOSX - - CFBundleVersion - 1 - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 8A218a - DTPlatformVersion - GM - DTSDKBuild - 16A300 - DTSDKName - macosx10.12 - DTXcode - 0800 - DTXcodeBuild - 8A218a - NSHumanReadableCopyright - Copyright © 2014 - present, Quick Team. All rights reserved. - - diff --git a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/Current b/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/Current deleted file mode 120000 index 8c7e5a6..0000000 --- a/SwiftlineTests/Carthage/Build/Mac/Quick.framework/Versions/Current +++ /dev/null @@ -1 +0,0 @@ -A \ No newline at end of file diff --git a/SwiftlineTests/Podfile b/SwiftlineTests/Podfile deleted file mode 100644 index adc8fa9..0000000 --- a/SwiftlineTests/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -platform :osx, '10.10' -plugin 'cocoapods-rome' - -pod 'Quick', '~> 0.8.0' -pod 'Nimble', '~> 3.2.0' diff --git a/SwiftlineTests/Swiftline.xcodeproj/project.pbxproj b/SwiftlineTests/Swiftline.xcodeproj/project.pbxproj deleted file mode 100644 index 24497a8..0000000 --- a/SwiftlineTests/Swiftline.xcodeproj/project.pbxproj +++ /dev/null @@ -1,598 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - D72766071BF416AC00126D99 /* Swiftline.h in Headers */ = {isa = PBXBuildFile; fileRef = D72766061BF416AC00126D99 /* Swiftline.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D727660E1BF416AC00126D99 /* Swiftline.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D72766031BF416AC00126D99 /* Swiftline.framework */; }; - D72766581BF416F700126D99 /* AgreeSettingsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = D72766501BF416F700126D99 /* AgreeSettingsTest.swift */; }; - D72766591BF416F700126D99 /* ColorizerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = D72766511BF416F700126D99 /* ColorizerTest.swift */; }; - D727665A1BF416F700126D99 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D72766521BF416F700126D99 /* RunnerTests.swift */; }; - D727665B1BF416F700126D99 /* ChooseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D72766531BF416F700126D99 /* ChooseTests.swift */; }; - D727665C1BF416F700126D99 /* ChooseSettingsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D72766541BF416F700126D99 /* ChooseSettingsTests.swift */; }; - D727665D1BF416F700126D99 /* AskTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D72766551BF416F700126D99 /* AskTests.swift */; }; - D727665E1BF416F700126D99 /* AskSettingsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D72766561BF416F700126D99 /* AskSettingsTests.swift */; }; - D727665F1BF416F700126D99 /* AgreeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D72766571BF416F700126D99 /* AgreeTests.swift */; }; - D72E3EBD1C052E2E00B77D49 /* ENVTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D72E3EBC1C052E2E00B77D49 /* ENVTests.swift */; }; - D72E3EC51C05B4FE00B77D49 /* ArgsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D72E3EC41C05B4FE00B77D49 /* ArgsTests.swift */; }; - D77488291D9AE0F2001EC08E /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D77488271D9AE0F2001EC08E /* Nimble.framework */; }; - D774882A1D9AE0F2001EC08E /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D77488281D9AE0F2001EC08E /* Quick.framework */; }; - D774882B1D9AE10B001EC08E /* Nimble.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = D77488271D9AE0F2001EC08E /* Nimble.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - D774882C1D9AE10B001EC08E /* Quick.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = D77488281D9AE0F2001EC08E /* Quick.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - D7C7F8BB1C71289A00EA5D29 /* Agree.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F89F1C71289A00EA5D29 /* Agree.swift */; }; - D7C7F8BC1C71289A00EA5D29 /* AgreeSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8A01C71289A00EA5D29 /* AgreeSettings.swift */; }; - D7C7F8BD1C71289A00EA5D29 /* ArgConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8A11C71289A00EA5D29 /* ArgConvertible.swift */; }; - D7C7F8BE1C71289A00EA5D29 /* Args.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8A21C71289A00EA5D29 /* Args.swift */; }; - D7C7F8BF1C71289A00EA5D29 /* ArgsParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8A31C71289A00EA5D29 /* ArgsParser.swift */; }; - D7C7F8C01C71289A00EA5D29 /* Argument.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8A41C71289A00EA5D29 /* Argument.swift */; }; - D7C7F8C11C71289A00EA5D29 /* Ask.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8A51C71289A00EA5D29 /* Ask.swift */; }; - D7C7F8C21C71289A00EA5D29 /* AskerValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8A61C71289A00EA5D29 /* AskerValidator.swift */; }; - D7C7F8C31C71289A00EA5D29 /* AskSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8A71C71289A00EA5D29 /* AskSettings.swift */; }; - D7C7F8C41C71289A00EA5D29 /* Choose.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8A81C71289A00EA5D29 /* Choose.swift */; }; - D7C7F8C51C71289A00EA5D29 /* ChooseSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8A91C71289A00EA5D29 /* ChooseSettings.swift */; }; - D7C7F8C61C71289A00EA5D29 /* Colorizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8AA1C71289A00EA5D29 /* Colorizer.swift */; }; - D7C7F8C71C71289A00EA5D29 /* CommandExecutor.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8AB1C71289A00EA5D29 /* CommandExecutor.swift */; }; - D7C7F8C81C71289A00EA5D29 /* Env.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8AC1C71289A00EA5D29 /* Env.swift */; }; - D7C7F8C91C71289A00EA5D29 /* Glob.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8AD1C71289A00EA5D29 /* Glob.swift */; }; - D7C7F8CA1C71289A00EA5D29 /* ProcessInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8AE1C71289A00EA5D29 /* ProcessInfo.swift */; }; - D7C7F8CB1C71289A00EA5D29 /* PromptPrinter.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8AF1C71289A00EA5D29 /* PromptPrinter.swift */; }; - D7C7F8CC1C71289A00EA5D29 /* PromptReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8B01C71289A00EA5D29 /* PromptReader.swift */; }; - D7C7F8CD1C71289A00EA5D29 /* PromptSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8B11C71289A00EA5D29 /* PromptSettings.swift */; }; - D7C7F8CE1C71289A00EA5D29 /* Runner.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8B21C71289A00EA5D29 /* Runner.swift */; }; - D7C7F8CF1C71289A00EA5D29 /* RunnerSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8B31C71289A00EA5D29 /* RunnerSettings.swift */; }; - D7C7F8D01C71289A00EA5D29 /* RunResults.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8B41C71289A00EA5D29 /* RunResults.swift */; }; - D7C7F8D11C71289A00EA5D29 /* ShortHandRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8B51C71289A00EA5D29 /* ShortHandRunner.swift */; }; - D7C7F8D21C71289A00EA5D29 /* StringBackgroundColorizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8B61C71289A00EA5D29 /* StringBackgroundColorizer.swift */; }; - D7C7F8D31C71289A00EA5D29 /* StringForegroundColorizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8B71C71289A00EA5D29 /* StringForegroundColorizer.swift */; }; - D7C7F8D41C71289A00EA5D29 /* StringStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8B81C71289A00EA5D29 /* StringStyle.swift */; }; - D7C7F8D51C71289A00EA5D29 /* StringStyleColorizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8B91C71289A00EA5D29 /* StringStyleColorizer.swift */; }; - D7C7F8D61C71289A00EA5D29 /* TaskPipe.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C7F8BA1C71289A00EA5D29 /* TaskPipe.swift */; }; - D7EEFD531C0BEF4500BF0F5D /* GlobTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7EEFD521C0BEF4500BF0F5D /* GlobTests.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - D727660F1BF416AC00126D99 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D72765FA1BF416AC00126D99 /* Project object */; - proxyType = 1; - remoteGlobalIDString = D72766021BF416AC00126D99; - remoteInfo = Swiftline; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - D72766641BF417A000126D99 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - D774882B1D9AE10B001EC08E /* Nimble.framework in CopyFiles */, - D774882C1D9AE10B001EC08E /* Quick.framework in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - D72766031BF416AC00126D99 /* Swiftline.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Swiftline.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - D72766061BF416AC00126D99 /* Swiftline.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Swiftline.h; sourceTree = ""; }; - D72766081BF416AC00126D99 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - D727660D1BF416AC00126D99 /* SwiftlineTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftlineTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - D72766141BF416AC00126D99 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - D72766501BF416F700126D99 /* AgreeSettingsTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AgreeSettingsTest.swift; sourceTree = ""; }; - D72766511BF416F700126D99 /* ColorizerTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColorizerTest.swift; sourceTree = ""; }; - D72766521BF416F700126D99 /* RunnerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; - D72766531BF416F700126D99 /* ChooseTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChooseTests.swift; sourceTree = ""; }; - D72766541BF416F700126D99 /* ChooseSettingsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChooseSettingsTests.swift; sourceTree = ""; }; - D72766551BF416F700126D99 /* AskTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AskTests.swift; sourceTree = ""; }; - D72766561BF416F700126D99 /* AskSettingsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AskSettingsTests.swift; sourceTree = ""; }; - D72766571BF416F700126D99 /* AgreeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AgreeTests.swift; sourceTree = ""; }; - D72E3EBC1C052E2E00B77D49 /* ENVTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ENVTests.swift; sourceTree = ""; }; - D72E3EC41C05B4FE00B77D49 /* ArgsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArgsTests.swift; sourceTree = ""; }; - D77488271D9AE0F2001EC08E /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = Carthage/Build/Mac/Nimble.framework; sourceTree = SOURCE_ROOT; }; - D77488281D9AE0F2001EC08E /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = Carthage/Build/Mac/Quick.framework; sourceTree = SOURCE_ROOT; }; - D7C7F89F1C71289A00EA5D29 /* Agree.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Agree.swift; path = ../../Source/Agree.swift; sourceTree = ""; }; - D7C7F8A01C71289A00EA5D29 /* AgreeSettings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AgreeSettings.swift; path = ../../Source/AgreeSettings.swift; sourceTree = ""; }; - D7C7F8A11C71289A00EA5D29 /* ArgConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ArgConvertible.swift; path = ../../Source/ArgConvertible.swift; sourceTree = ""; }; - D7C7F8A21C71289A00EA5D29 /* Args.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Args.swift; path = ../../Source/Args.swift; sourceTree = ""; }; - D7C7F8A31C71289A00EA5D29 /* ArgsParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ArgsParser.swift; path = ../../Source/ArgsParser.swift; sourceTree = ""; }; - D7C7F8A41C71289A00EA5D29 /* Argument.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Argument.swift; path = ../../Source/Argument.swift; sourceTree = ""; }; - D7C7F8A51C71289A00EA5D29 /* Ask.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Ask.swift; path = ../../Source/Ask.swift; sourceTree = ""; }; - D7C7F8A61C71289A00EA5D29 /* AskerValidator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AskerValidator.swift; path = ../../Source/AskerValidator.swift; sourceTree = ""; }; - D7C7F8A71C71289A00EA5D29 /* AskSettings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AskSettings.swift; path = ../../Source/AskSettings.swift; sourceTree = ""; }; - D7C7F8A81C71289A00EA5D29 /* Choose.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Choose.swift; path = ../../Source/Choose.swift; sourceTree = ""; }; - D7C7F8A91C71289A00EA5D29 /* ChooseSettings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ChooseSettings.swift; path = ../../Source/ChooseSettings.swift; sourceTree = ""; }; - D7C7F8AA1C71289A00EA5D29 /* Colorizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Colorizer.swift; path = ../../Source/Colorizer.swift; sourceTree = ""; }; - D7C7F8AB1C71289A00EA5D29 /* CommandExecutor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CommandExecutor.swift; path = ../../Source/CommandExecutor.swift; sourceTree = ""; }; - D7C7F8AC1C71289A00EA5D29 /* Env.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Env.swift; path = ../../Source/Env.swift; sourceTree = ""; }; - D7C7F8AD1C71289A00EA5D29 /* Glob.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Glob.swift; path = ../../Source/Glob.swift; sourceTree = ""; }; - D7C7F8AE1C71289A00EA5D29 /* ProcessInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ProcessInfo.swift; path = ../../Source/ProcessInfo.swift; sourceTree = ""; }; - D7C7F8AF1C71289A00EA5D29 /* PromptPrinter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PromptPrinter.swift; path = ../../Source/PromptPrinter.swift; sourceTree = ""; }; - D7C7F8B01C71289A00EA5D29 /* PromptReader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PromptReader.swift; path = ../../Source/PromptReader.swift; sourceTree = ""; }; - D7C7F8B11C71289A00EA5D29 /* PromptSettings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PromptSettings.swift; path = ../../Source/PromptSettings.swift; sourceTree = ""; }; - D7C7F8B21C71289A00EA5D29 /* Runner.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Runner.swift; path = ../../Source/Runner.swift; sourceTree = ""; }; - D7C7F8B31C71289A00EA5D29 /* RunnerSettings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RunnerSettings.swift; path = ../../Source/RunnerSettings.swift; sourceTree = ""; }; - D7C7F8B41C71289A00EA5D29 /* RunResults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RunResults.swift; path = ../../Source/RunResults.swift; sourceTree = ""; }; - D7C7F8B51C71289A00EA5D29 /* ShortHandRunner.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ShortHandRunner.swift; path = ../../Source/ShortHandRunner.swift; sourceTree = ""; }; - D7C7F8B61C71289A00EA5D29 /* StringBackgroundColorizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = StringBackgroundColorizer.swift; path = ../../Source/StringBackgroundColorizer.swift; sourceTree = ""; }; - D7C7F8B71C71289A00EA5D29 /* StringForegroundColorizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = StringForegroundColorizer.swift; path = ../../Source/StringForegroundColorizer.swift; sourceTree = ""; }; - D7C7F8B81C71289A00EA5D29 /* StringStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = StringStyle.swift; path = ../../Source/StringStyle.swift; sourceTree = ""; }; - D7C7F8B91C71289A00EA5D29 /* StringStyleColorizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = StringStyleColorizer.swift; path = ../../Source/StringStyleColorizer.swift; sourceTree = ""; }; - D7C7F8BA1C71289A00EA5D29 /* TaskPipe.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TaskPipe.swift; path = ../../Source/TaskPipe.swift; sourceTree = ""; }; - D7EEFD521C0BEF4500BF0F5D /* GlobTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GlobTests.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - D72765FF1BF416AC00126D99 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D727660A1BF416AC00126D99 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - D727660E1BF416AC00126D99 /* Swiftline.framework in Frameworks */, - D77488291D9AE0F2001EC08E /* Nimble.framework in Frameworks */, - D774882A1D9AE0F2001EC08E /* Quick.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - D72765F91BF416AC00126D99 = { - isa = PBXGroup; - children = ( - D72766051BF416AC00126D99 /* Swiftline */, - D72766111BF416AC00126D99 /* SwiftlineTests */, - D72766041BF416AC00126D99 /* Products */, - ); - sourceTree = ""; - }; - D72766041BF416AC00126D99 /* Products */ = { - isa = PBXGroup; - children = ( - D72766031BF416AC00126D99 /* Swiftline.framework */, - D727660D1BF416AC00126D99 /* SwiftlineTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - D72766051BF416AC00126D99 /* Swiftline */ = { - isa = PBXGroup; - children = ( - D7C7F89F1C71289A00EA5D29 /* Agree.swift */, - D7C7F8A01C71289A00EA5D29 /* AgreeSettings.swift */, - D7C7F8A11C71289A00EA5D29 /* ArgConvertible.swift */, - D7C7F8A21C71289A00EA5D29 /* Args.swift */, - D7C7F8A31C71289A00EA5D29 /* ArgsParser.swift */, - D7C7F8A41C71289A00EA5D29 /* Argument.swift */, - D7C7F8A51C71289A00EA5D29 /* Ask.swift */, - D7C7F8A61C71289A00EA5D29 /* AskerValidator.swift */, - D7C7F8A71C71289A00EA5D29 /* AskSettings.swift */, - D7C7F8A81C71289A00EA5D29 /* Choose.swift */, - D7C7F8A91C71289A00EA5D29 /* ChooseSettings.swift */, - D7C7F8AA1C71289A00EA5D29 /* Colorizer.swift */, - D7C7F8AB1C71289A00EA5D29 /* CommandExecutor.swift */, - D7C7F8AC1C71289A00EA5D29 /* Env.swift */, - D7C7F8AD1C71289A00EA5D29 /* Glob.swift */, - D7C7F8AE1C71289A00EA5D29 /* ProcessInfo.swift */, - D7C7F8AF1C71289A00EA5D29 /* PromptPrinter.swift */, - D7C7F8B01C71289A00EA5D29 /* PromptReader.swift */, - D7C7F8B11C71289A00EA5D29 /* PromptSettings.swift */, - D7C7F8B21C71289A00EA5D29 /* Runner.swift */, - D7C7F8B31C71289A00EA5D29 /* RunnerSettings.swift */, - D7C7F8B41C71289A00EA5D29 /* RunResults.swift */, - D7C7F8B51C71289A00EA5D29 /* ShortHandRunner.swift */, - D7C7F8B61C71289A00EA5D29 /* StringBackgroundColorizer.swift */, - D7C7F8B71C71289A00EA5D29 /* StringForegroundColorizer.swift */, - D7C7F8B81C71289A00EA5D29 /* StringStyle.swift */, - D7C7F8B91C71289A00EA5D29 /* StringStyleColorizer.swift */, - D7C7F8BA1C71289A00EA5D29 /* TaskPipe.swift */, - D72766061BF416AC00126D99 /* Swiftline.h */, - D72766081BF416AC00126D99 /* Info.plist */, - ); - path = Swiftline; - sourceTree = ""; - }; - D72766111BF416AC00126D99 /* SwiftlineTests */ = { - isa = PBXGroup; - children = ( - D77488271D9AE0F2001EC08E /* Nimble.framework */, - D77488281D9AE0F2001EC08E /* Quick.framework */, - D72766501BF416F700126D99 /* AgreeSettingsTest.swift */, - D72766511BF416F700126D99 /* ColorizerTest.swift */, - D72766521BF416F700126D99 /* RunnerTests.swift */, - D72766531BF416F700126D99 /* ChooseTests.swift */, - D72766541BF416F700126D99 /* ChooseSettingsTests.swift */, - D72766551BF416F700126D99 /* AskTests.swift */, - D72766561BF416F700126D99 /* AskSettingsTests.swift */, - D72766571BF416F700126D99 /* AgreeTests.swift */, - D72766141BF416AC00126D99 /* Info.plist */, - D72E3EBC1C052E2E00B77D49 /* ENVTests.swift */, - D72E3EC41C05B4FE00B77D49 /* ArgsTests.swift */, - D7EEFD521C0BEF4500BF0F5D /* GlobTests.swift */, - ); - path = SwiftlineTests; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - D72766001BF416AC00126D99 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - D72766071BF416AC00126D99 /* Swiftline.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - D72766021BF416AC00126D99 /* Swiftline */ = { - isa = PBXNativeTarget; - buildConfigurationList = D72766171BF416AC00126D99 /* Build configuration list for PBXNativeTarget "Swiftline" */; - buildPhases = ( - D72765FE1BF416AC00126D99 /* Sources */, - D72765FF1BF416AC00126D99 /* Frameworks */, - D72766001BF416AC00126D99 /* Headers */, - D72766011BF416AC00126D99 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Swiftline; - productName = Swiftline; - productReference = D72766031BF416AC00126D99 /* Swiftline.framework */; - productType = "com.apple.product-type.framework"; - }; - D727660C1BF416AC00126D99 /* SwiftlineTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = D727661A1BF416AC00126D99 /* Build configuration list for PBXNativeTarget "SwiftlineTests" */; - buildPhases = ( - D72766091BF416AC00126D99 /* Sources */, - D727660A1BF416AC00126D99 /* Frameworks */, - D727660B1BF416AC00126D99 /* Resources */, - D72766641BF417A000126D99 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - D72766101BF416AC00126D99 /* PBXTargetDependency */, - ); - name = SwiftlineTests; - productName = SwiftlineTests; - productReference = D727660D1BF416AC00126D99 /* SwiftlineTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - D72765FA1BF416AC00126D99 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0710; - ORGANIZATIONNAME = "Omar Abdelhafith"; - TargetAttributes = { - D72766021BF416AC00126D99 = { - CreatedOnToolsVersion = 7.1.1; - }; - D727660C1BF416AC00126D99 = { - CreatedOnToolsVersion = 7.1.1; - LastSwiftMigration = 0800; - }; - }; - }; - buildConfigurationList = D72765FD1BF416AC00126D99 /* Build configuration list for PBXProject "Swiftline" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = D72765F91BF416AC00126D99; - productRefGroup = D72766041BF416AC00126D99 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - D72766021BF416AC00126D99 /* Swiftline */, - D727660C1BF416AC00126D99 /* SwiftlineTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - D72766011BF416AC00126D99 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D727660B1BF416AC00126D99 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - D72765FE1BF416AC00126D99 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - D7C7F8CD1C71289A00EA5D29 /* PromptSettings.swift in Sources */, - D7C7F8C41C71289A00EA5D29 /* Choose.swift in Sources */, - D7C7F8C91C71289A00EA5D29 /* Glob.swift in Sources */, - D7C7F8BB1C71289A00EA5D29 /* Agree.swift in Sources */, - D7C7F8BD1C71289A00EA5D29 /* ArgConvertible.swift in Sources */, - D7C7F8CB1C71289A00EA5D29 /* PromptPrinter.swift in Sources */, - D7C7F8C71C71289A00EA5D29 /* CommandExecutor.swift in Sources */, - D7C7F8BE1C71289A00EA5D29 /* Args.swift in Sources */, - D7C7F8C21C71289A00EA5D29 /* AskerValidator.swift in Sources */, - D7C7F8CA1C71289A00EA5D29 /* ProcessInfo.swift in Sources */, - D7C7F8D21C71289A00EA5D29 /* StringBackgroundColorizer.swift in Sources */, - D7C7F8BF1C71289A00EA5D29 /* ArgsParser.swift in Sources */, - D7C7F8C11C71289A00EA5D29 /* Ask.swift in Sources */, - D7C7F8D01C71289A00EA5D29 /* RunResults.swift in Sources */, - D7C7F8D51C71289A00EA5D29 /* StringStyleColorizer.swift in Sources */, - D7C7F8C51C71289A00EA5D29 /* ChooseSettings.swift in Sources */, - D7C7F8CC1C71289A00EA5D29 /* PromptReader.swift in Sources */, - D7C7F8CF1C71289A00EA5D29 /* RunnerSettings.swift in Sources */, - D7C7F8D31C71289A00EA5D29 /* StringForegroundColorizer.swift in Sources */, - D7C7F8C31C71289A00EA5D29 /* AskSettings.swift in Sources */, - D7C7F8D11C71289A00EA5D29 /* ShortHandRunner.swift in Sources */, - D7C7F8C01C71289A00EA5D29 /* Argument.swift in Sources */, - D7C7F8D61C71289A00EA5D29 /* TaskPipe.swift in Sources */, - D7C7F8BC1C71289A00EA5D29 /* AgreeSettings.swift in Sources */, - D7C7F8CE1C71289A00EA5D29 /* Runner.swift in Sources */, - D7C7F8C61C71289A00EA5D29 /* Colorizer.swift in Sources */, - D7C7F8D41C71289A00EA5D29 /* StringStyle.swift in Sources */, - D7C7F8C81C71289A00EA5D29 /* Env.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D72766091BF416AC00126D99 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - D72E3EBD1C052E2E00B77D49 /* ENVTests.swift in Sources */, - D727665B1BF416F700126D99 /* ChooseTests.swift in Sources */, - D727665D1BF416F700126D99 /* AskTests.swift in Sources */, - D727665F1BF416F700126D99 /* AgreeTests.swift in Sources */, - D727665E1BF416F700126D99 /* AskSettingsTests.swift in Sources */, - D72766581BF416F700126D99 /* AgreeSettingsTest.swift in Sources */, - D727665A1BF416F700126D99 /* RunnerTests.swift in Sources */, - D727665C1BF416F700126D99 /* ChooseSettingsTests.swift in Sources */, - D7EEFD531C0BEF4500BF0F5D /* GlobTests.swift in Sources */, - D72E3EC51C05B4FE00B77D49 /* ArgsTests.swift in Sources */, - D72766591BF416F700126D99 /* ColorizerTest.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - D72766101BF416AC00126D99 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = D72766021BF416AC00126D99 /* Swiftline */; - targetProxy = D727660F1BF416AC00126D99 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - D72766151BF416AC00126D99 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - D72766161BF416AC00126D99 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - D72766181BF416AC00126D99 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = ""; - COMBINE_HIDPI_IMAGES = YES; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_VERSION = A; - INFOPLIST_FILE = Swiftline/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.9; - PRODUCT_BUNDLE_IDENTIFIER = nsomar.Swiftline; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; - }; - name = Debug; - }; - D72766191BF416AC00126D99 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = ""; - COMBINE_HIDPI_IMAGES = YES; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_VERSION = A; - INFOPLIST_FILE = Swiftline/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.9; - PRODUCT_BUNDLE_IDENTIFIER = nsomar.Swiftline; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - }; - name = Release; - }; - D727661B1BF416AC00126D99 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_MODULES = YES; - COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Rome", - "$(PROJECT_DIR)/Carthage/Build/Mac", - ); - INFOPLIST_FILE = SwiftlineTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = nsomar.SwiftlineTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; - }; - name = Debug; - }; - D727661C1BF416AC00126D99 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_MODULES = YES; - COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Rome", - "$(PROJECT_DIR)/Carthage/Build/Mac", - ); - INFOPLIST_FILE = SwiftlineTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = nsomar.SwiftlineTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - D72765FD1BF416AC00126D99 /* Build configuration list for PBXProject "Swiftline" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D72766151BF416AC00126D99 /* Debug */, - D72766161BF416AC00126D99 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - D72766171BF416AC00126D99 /* Build configuration list for PBXNativeTarget "Swiftline" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D72766181BF416AC00126D99 /* Debug */, - D72766191BF416AC00126D99 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - D727661A1BF416AC00126D99 /* Build configuration list for PBXNativeTarget "SwiftlineTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D727661B1BF416AC00126D99 /* Debug */, - D727661C1BF416AC00126D99 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = D72765FA1BF416AC00126D99 /* Project object */; -} diff --git a/SwiftlineTests/Swiftline.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/SwiftlineTests/Swiftline.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 9568768..0000000 --- a/SwiftlineTests/Swiftline.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/SwiftlineTests/Swiftline.xcodeproj/xcshareddata/xcschemes/Swiftline.xcscheme b/SwiftlineTests/Swiftline.xcodeproj/xcshareddata/xcschemes/Swiftline.xcscheme deleted file mode 100644 index 8619238..0000000 --- a/SwiftlineTests/Swiftline.xcodeproj/xcshareddata/xcschemes/Swiftline.xcscheme +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SwiftlineTests/Swiftline/Info.plist b/SwiftlineTests/Swiftline/Info.plist deleted file mode 100644 index 685806b..0000000 --- a/SwiftlineTests/Swiftline/Info.plist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSHumanReadableCopyright - Copyright © 2015 Omar Abdelhafith. All rights reserved. - NSPrincipalClass - - - diff --git a/SwiftlineTests/Swiftline/Swiftline.h b/SwiftlineTests/Swiftline/Swiftline.h deleted file mode 100644 index 162fdc4..0000000 --- a/SwiftlineTests/Swiftline/Swiftline.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// Swiftline.h -// Swiftline -// -// Created by Omar Abdelhafith on 12/11/2015. -// Copyright © 2015 Omar Abdelhafith. All rights reserved. -// - -#import - -//! Project version number for Swiftline. -FOUNDATION_EXPORT double SwiftlineVersionNumber; - -//! Project version string for Swiftline. -FOUNDATION_EXPORT const unsigned char SwiftlineVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - - diff --git a/SwiftlineTests/SwiftlineTests/AgreeSettingsTest.swift b/SwiftlineTests/SwiftlineTests/AgreeSettingsTest.swift deleted file mode 100644 index c359709..0000000 --- a/SwiftlineTests/SwiftlineTests/AgreeSettingsTest.swift +++ /dev/null @@ -1,60 +0,0 @@ -import Foundation -import Quick -import Nimble -@testable import Swiftline - - -class AgreeSettingsTest: QuickSpec { - override func spec() { - - let settings = AgreeSettings(prompt: "The Prompt is") - - it("accepts Yes, yes, Y, y") { - expect(settings.invalidItemMessage("Yes")).to(beNil()) - expect(settings.invalidItemMessage("Y")).to(beNil()) - expect(settings.invalidItemMessage("yes")).to(beNil()) - expect(settings.invalidItemMessage("y")).to(beNil()) - } - - it("accepts No, no, N, n") { - expect(settings.invalidItemMessage("No")).to(beNil()) - expect(settings.invalidItemMessage("N")).to(beNil()) - expect(settings.invalidItemMessage("no")).to(beNil()) - expect(settings.invalidItemMessage("n")).to(beNil()) - } - - it("does not accept invalid inputs") { - expect(settings.invalidItemMessage("www")).notTo(beNil()) - expect(settings.invalidItemMessage("")).notTo(beNil()) - } - - it("retunrs the same item as valid item") { - expect(settings.validatedItem(forString: "No")).to(equal("No")) - expect(settings.validatedItem(forString: "Yes")).to(equal("Yes")) - } - - it("validates Yes, yes, Y, y as true") { - expect(settings.isPositive("Yes")).to(beTrue()) - expect(settings.isPositive("Y")).to(beTrue()) - expect(settings.isPositive("yes")).to(beTrue()) - expect(settings.isPositive("y")).to(beTrue()) - } - - it("validates No, no, N, n as negative") { - expect(settings.isPositive("No")).to(beFalse()) - expect(settings.isPositive("N")).to(beFalse()) - expect(settings.isPositive("no")).to(beFalse()) - expect(settings.isPositive("n")).to(beFalse()) - } - - it("retunrs correct invalid message prompt") { - let invalid = settings.invalidItemMessage("") - expect(invalid).to(equal("Please enter \"yes\" or \"no\".")) - } - - it("retunrs correct prompt new message prompt") { - let invalid = settings.newItemPromptMessage() - expect(invalid).to(equal("The Prompt is ")) - } - } -} \ No newline at end of file diff --git a/SwiftlineTests/SwiftlineTests/AgreeTests.swift b/SwiftlineTests/SwiftlineTests/AgreeTests.swift deleted file mode 100644 index 76b907b..0000000 --- a/SwiftlineTests/SwiftlineTests/AgreeTests.swift +++ /dev/null @@ -1,45 +0,0 @@ -import Foundation -import Quick -import Nimble -@testable import Swiftline - - -class AgreeTest: QuickSpec { - override func spec() { - - var promptPrinter: DummyPromptPrinter! - - beforeEach { - promptPrinter = DummyPromptPrinter() - PromptSettings.printer = promptPrinter - } - - it("returns true if yes is passed") { - PromptSettings.reader = DummyPromptReader(toReturn: "Yes") - - let ret = agree("Are you a test?") - - expect(ret).to(equal(true)) - expect(promptPrinter.printed).to(equal("Are you a test? ")) - } - - it("returns true if n is passed") { - PromptSettings.reader = DummyPromptReader(toReturn: "n") - - let ret = agree("Are you a test?") - - expect(ret).to(equal(false)) - expect(promptPrinter.printed).to(equal("Are you a test? ")) - } - - it("keeps asking if wrong parameter are passed") { - PromptSettings.reader = DummyPromptReader(toReturn: "a", "n") - - let ret = agree("Are you a test?") - - expect(ret).to(equal(false)) - let prompts = "Are you a test? Please enter \"yes\" or \"no\".\nAre you a test? " - expect(promptPrinter.printed).to(equal(prompts)) - } - } -} diff --git a/SwiftlineTests/SwiftlineTests/ArgsTests.swift b/SwiftlineTests/SwiftlineTests/ArgsTests.swift deleted file mode 100644 index 49fa54b..0000000 --- a/SwiftlineTests/SwiftlineTests/ArgsTests.swift +++ /dev/null @@ -1,160 +0,0 @@ -import Foundation -import Quick -import Nimble -@testable import Swiftline - -class ArgsTests: QuickSpec { - override func spec() { - - describe("Args") { - - it("returns the correct number of args passed") { - expect(Args.all.count).to(beGreaterThan(0)) - } - - it("returns the exact argument passed to the app") { - ProcessInfo.internalProcessInfo = DummyProcessInfo("1", "2", "3") - expect(Args.all).to(equal(["1", "2", "3"])) - } - - it("creats a hash from passed args") { - ProcessInfo.internalProcessInfo = DummyProcessInfo("excutable_name", "-f", "file.rb", "--integer", "1", "Some custom one", "one", "two", "--no-ff") - let result = [ - "f": "file.rb", - "integer": "1", - "no-ff": ""] - - expect(Args.parsed.flags).to(equal(result)) - expect(Args.parsed.parameters).to(equal(["Some custom one", "one", "two"])) - expect(Args.parsed.command).to(equal("excutable_name")) - } - } - - describe("ArgsParser") { - - it("returns empty for empty array") { - let r = ArgsParser.parseFlags([]) - expect(r.0.count).to(equal(0)) - expect(r.1.count).to(equal(0)) - } - - it("returns all leading non flag parameters") { - let r = ArgsParser.parseFlags(["omar", "hello", "-f", "test", "--help"]) - expect(r.1).to(equal(["omar", "hello"])) - } - - - it("returns all tailling non flag parameters") { - let r = ArgsParser.parseFlags(["-f", "test", "--help", "x", "omar", "hello"]) - expect(r.1).to(equal(["omar", "hello"])) - } - - - it("returns all mixed non flag parameters") { - let r = ArgsParser.parseFlags(["-f", "test", "omar", "--help", "x", "hello"]) - expect(r.1).to(equal(["omar", "hello"])) - } - - it("returns all flags if they are all set") { - let r = ArgsParser.parseFlags(["-f", "test", "omar", "--help", "x", "hello"]) - - expect(r.0[0].argument.name).to(equal("f")) - expect(r.0[0].value).to(equal("test")) - - expect(r.0[1].argument.name).to(equal("help")) - expect(r.0[1].value).to(equal("x")) - } - - it("returns all flags if some are not set") { - let r = ArgsParser.parseFlags(["-f", "-w", "omar", "--help", "x", "hello"]) - - expect(r.0[0].argument.name).to(equal("f")) - expect(r.0[0].value).to(beNil()) - - expect(r.0[1].argument.name).to(equal("w")) - expect(r.0[1].value).to(equal("omar")) - - expect(r.0[2].argument.name).to(equal("help")) - expect(r.0[2].value).to(equal("x")) - } - - it("parses complex flags configuration") { - let r = ArgsParser.parseFlags(["one", "-f", "-w", "omar", "two", "--help", "x", "hello"]) - - expect(r.1).to(equal(["one", "two", "hello"])) - - expect(r.0[0].argument.name).to(equal("f")) - expect(r.0[0].value).to(beNil()) - - expect(r.0[1].argument.name).to(equal("w")) - expect(r.0[1].value).to(equal("omar")) - - expect(r.0[2].argument.name).to(equal("help")) - expect(r.0[2].value).to(equal("x")) - } - - it("stops parsing flags when -- is found") { - let r = ArgsParser.parseFlags(["one", "-f", "-w", "omar", "two", "--", "--help", "x", "hello"]) - - expect(r.1).to(equal(["one", "two", "--help", "x", "hello"])) - - expect(r.0[0].argument.name).to(equal("f")) - expect(r.0[0].value).to(beNil()) - - expect(r.0[1].argument.name).to(equal("w")) - expect(r.0[1].value).to(equal("omar")) - } - } - - describe("Argument") { - - it("knows the arg type for a string") { - expect(Argument.ArgumentType("-f")) - .to(equal(Argument.ArgumentType.shortFlag)) - - expect(Argument.ArgumentType("--force")) - .to(equal(Argument.ArgumentType.longFlag)) - - expect(Argument.ArgumentType("--no-repo-update")) - .to(equal(Argument.ArgumentType.longFlag)) - - expect(Argument.ArgumentType("not an arg")) - .to(equal(Argument.ArgumentType.notAFlag)) - - expect(Argument.ArgumentType("not-an-arg")) - .to(equal(Argument.ArgumentType.notAFlag)) - } - - it("knows if an argument is a flag") { - expect(Argument.ArgumentType.shortFlag.isFlag) - .to(beTrue()) - - expect(Argument.ArgumentType.longFlag.isFlag) - .to(beTrue()) - - expect(Argument.ArgumentType.notAFlag.isFlag) - .to(beFalse()) - } - - - it("normalize a flag") { - expect(Argument("-f").name) - .to(equal("f")) - - expect(Argument("--force").name) - .to(equal("force")) - - expect(Argument("--no-repo-update").name) - .to(equal("no-repo-update")) - - expect(Argument("not an arg").name) - .to(equal("not an arg")) - - expect(Argument("not-an-arg").name) - .to(equal("not-an-arg")) - } - - } - - } -} diff --git a/SwiftlineTests/SwiftlineTests/AskSettingsTests.swift b/SwiftlineTests/SwiftlineTests/AskSettingsTests.swift deleted file mode 100644 index eed5761..0000000 --- a/SwiftlineTests/SwiftlineTests/AskSettingsTests.swift +++ /dev/null @@ -1,52 +0,0 @@ -import Foundation -import Quick -import Nimble -@testable import Swiftline - - -class AskSettingsTests: QuickSpec { - override func spec() { - - describe("AskerSettings") { - - it("returns the default if string is empty") { - let askSettings = AskSettings() - askSettings.defaultValue = "Def" - expect(askSettings.preparedItem(originalString: "")).to(equal("Def")) - } - - it("does not return the default if string is empty") { - let askSettings = AskSettings() - askSettings.defaultValue = "Def" - expect(askSettings.preparedItem(originalString: "asd")).to(equal("asd")) - } - } - - describe("AskerValidation") { - - it("validates with a block") { - let askSettings = AskSettings() - askSettings.addInvalidCase("") { s in return false } - expect(askSettings.invalidItemMessage("ss")).to(beNil()) - - askSettings.addInvalidCase("") { s in return true } - expect(askSettings.invalidItemMessage("ss")).toNot(beNil()) - } - - it("returns correct invalid message") { - let askSettings = AskSettings() - expect(askSettings.invalidItemMessage(nil)).to(equal("You provided an empty message, pelase enter anything!")) - } - - it("returns correct invalid message when not valid int") { - let askSettings = AskSettings() - expect(askSettings.invalidItemMessage("dd")).to(equal("You must enter a valid Integer.")) - } - - it("returns correct invalid prompt") { - let askSettings = AskSettings() - expect(askSettings.newItemPromptMessage()).to(equal("? ")) - } - } - } -} diff --git a/SwiftlineTests/SwiftlineTests/AskTests.swift b/SwiftlineTests/SwiftlineTests/AskTests.swift deleted file mode 100644 index 0fe5587..0000000 --- a/SwiftlineTests/SwiftlineTests/AskTests.swift +++ /dev/null @@ -1,110 +0,0 @@ -import Foundation -import Quick -import Nimble -@testable import Swiftline - - -class AskerTest: QuickSpec { - override func spec() { - - var promptPrinter: DummyPromptPrinter! - - beforeEach { - promptPrinter = DummyPromptPrinter() - PromptSettings.printer = promptPrinter - } - - it("reads a string from the stdin") { - PromptSettings.reader = DummyPromptReader(toReturn: "A String") - let res = ask("Enter a string") - - expect(res).to(equal("A String")) - expect(promptPrinter.printed).to(equal("Enter a string\n")) - } - - it("reads an Int from the stdin") { - PromptSettings.reader = DummyPromptReader(toReturn: "1") - let res = ask("Enter a string", type: Int.self) - - expect(res).to(equal(1)) - expect(promptPrinter.printed).to(equal("Enter a string\n")) - } - - it("keeps asking if entered is not an int") { - PromptSettings.reader = DummyPromptReader(toReturn: "x", "y", "1") - - let res = ask("Enter a string", type: Int.self) - - let prompt = ["Enter a string", - "You must enter a valid Integer.", - "? You must enter a valid Integer.", - "? "].joined(separator: "\n") - - expect(res).to(equal(1)) - expect(promptPrinter.printed).to(equal(prompt)) - } - - it("reads an double from the stdin") { - PromptSettings.reader = DummyPromptReader(toReturn: "1") - let res = ask("Enter a string", type: Double.self) - - expect(res).to(equal(1.0)) - expect(promptPrinter.printed).to(equal("Enter a string\n")) - } - - it("keeps asking if validation is false") { - PromptSettings.reader = DummyPromptReader(toReturn: "1", "2", "3") - let res = ask("Enter a string") { s in - s.addInvalidCase("Invalid string") { $0 != "3" } - } - - expect(res).to(equal("3")) - - let prompt = ["Enter a string", - "Invalid string", - "? Invalid string\n? "].joined(separator: "\n") - - expect(promptPrinter.printed).to(equal(prompt)) - } - - it("ask for confirmation") { - PromptSettings.reader = DummyPromptReader(toReturn: "val", "Y") - let res = ask("Enter a string") { $0.confirm = true } - - expect(res).to(equal("val")) - expect(promptPrinter.printed).to(equal("Enter a string\nAre you sure? ")) - } - - it("ask for confirmation, if no is passed it keeps asking") { - PromptSettings.reader = DummyPromptReader(toReturn: "val", "N", "other val", "y") - let res = ask("Enter a string") { $0.confirm = true } - - expect(res).to(equal("other val")) - - let prompt = ["Enter a string", - "Are you sure? ? Are you sure? "].joined(separator: "\n") - - expect(promptPrinter.printed).to(equal(prompt)) - } - - it("ask for confirmation, and validates input, if no is passed it keeps asking") { - - PromptSettings.reader = DummyPromptReader(toReturn: "1", "n", "10", "9", "yes") - - let res = ask("Age?", type: Int.self) { - $0.confirm = true - $0.addInvalidCase("Age not correct") { $0 == 10 } - } - - expect(res).to(equal(9)) - - let prompt = ["Age?", - "Are you sure? ? Age not correct", - "? Are you sure? " - ].joined(separator: "\n") - - expect(promptPrinter.printed).to(equal(prompt)) - } - - } -} diff --git a/SwiftlineTests/SwiftlineTests/ChooseSettingsTests.swift b/SwiftlineTests/SwiftlineTests/ChooseSettingsTests.swift deleted file mode 100644 index 96dc859..0000000 --- a/SwiftlineTests/SwiftlineTests/ChooseSettingsTests.swift +++ /dev/null @@ -1,159 +0,0 @@ -import Foundation -import Quick -import Nimble -@testable import Swiftline - - -class ChooseSettingsTests: QuickSpec { - override func spec() { - - describe("simple choices") { - var chooseSettings: ChooseSettings! - - beforeEach { - chooseSettings = ChooseSettings() - chooseSettings.addChoice("one") { "one" } - chooseSettings.addChoice("two") { "two" } - chooseSettings.addChoice("three") { "three" } - } - - it("accepts one, two, three as inputs") { - expect(chooseSettings.invalidItemMessage("one")).to(beNil()) - expect(chooseSettings.invalidItemMessage("two")).to(beNil()) - expect(chooseSettings.invalidItemMessage("three")).to(beNil()) - } - - it("accepts 1, 2, 3 as inputs") { - expect(chooseSettings.invalidItemMessage("1")).to(beNil()) - expect(chooseSettings.invalidItemMessage("2")).to(beNil()) - expect(chooseSettings.invalidItemMessage("3")).to(beNil()) - } - - it("does not accept 0, 4, x, asd as inputs") { - expect(chooseSettings.invalidItemMessage("0")).notTo(beNil()) - expect(chooseSettings.invalidItemMessage("4")).notTo(beNil()) - expect(chooseSettings.invalidItemMessage("x")).notTo(beNil()) - expect(chooseSettings.invalidItemMessage("asd")).notTo(beNil()) - } - - it("returns one for 1 and two for 2") { - expect(chooseSettings.validatedItem(forString: "one")).to(equal("one")) - expect(chooseSettings.validatedItem(forString: "2")).to(equal("two")) - } - - it("returns the correct invalid message") { - expect(chooseSettings.invalidItemMessage("")).to(equal("You must choose one of [1, 2, 3, one, two, three].")) - } - - it("returns the correct prompt message") { - expect(chooseSettings.newItemPromptMessage()).to(equal("? ")) - } - - it("returns 1, 2, 3, one, two, three as valid choices") { - expect(chooseSettings.validChoices()).to(equal(["1", "2", "3", "one", "two", "three"])) - } - - it("returns the correct prompt message") { - expect(chooseSettings.newItemPromptMessage()).to(equal("? ")) - } - - it("returns the correct initial prompt message") { - let items = ["1. one", "2. two", "3. three"] - expect(chooseSettings.preparePromptItems()).to(equal(items)) - } - - it("returns one for 1 and two for 2") { - expect(chooseSettings.choiceForInput("1")).to(equal("one")) - expect(chooseSettings.choiceForInput("two")).to(equal("two")) - } - } - - describe("choice with block") { - - var chooseSettings: ChooseSettings! - - beforeEach { - chooseSettings = ChooseSettings() - chooseSettings.addChoice("one") { "one" } - chooseSettings.addChoice("two") { "two" } - chooseSettings.addChoice("three") { "three" } - } - - it("creates prompt with numbers and .") { - let items = ["1. one", "2. two", "3. three"] - expect(chooseSettings.preparePromptItems()).to(equal(items)) - } - - it("creates prompt with numbers and )") { - let items = ["1) one", "2) two", "3) three"] - chooseSettings.indexSuffix = ") " - expect(chooseSettings.preparePromptItems()).to(equal(items)) - } - - it("creates prompt with letters and -") { - let items = ["a - one", "b - two", "c - three"] - chooseSettings.indexSuffix = " - " - chooseSettings.index = .letters - expect(chooseSettings.preparePromptItems()).to(equal(items)) - } - } - - describe("choice with block") { - - var chooseSettings: ChooseSettings! - - beforeEach { - chooseSettings = ChooseSettings() - chooseSettings.addChoice("one") { 10 } - chooseSettings.addChoice("two") { 20 } - chooseSettings.addChoice("three") { 33 } - } - - it("accepts one, two, three as inputs") { - expect(chooseSettings.invalidItemMessage("one")).to(beNil()) - } - - it("accepts 1, 2, 3 as inputs") { - expect(chooseSettings.invalidItemMessage("1")).to(beNil()) - } - - it("does not accept 0, 4, x, asd as inputs") { - expect(chooseSettings.invalidItemMessage("0")).notTo(beNil()) - expect(chooseSettings.invalidItemMessage("4")).notTo(beNil()) - expect(chooseSettings.invalidItemMessage("x")).notTo(beNil()) - expect(chooseSettings.invalidItemMessage("asd")).notTo(beNil()) - } - - it("returns one for 1 and two for 2") { - expect(chooseSettings.validatedItem(forString: "one")).to(equal(10)) - expect(chooseSettings.validatedItem(forString: "2")).to(equal(20)) - } - - it("returns the correct invalid message") { - expect(chooseSettings.invalidItemMessage("")).to(equal("You must choose one of [1, 2, 3, one, two, three].")) - } - - it("returns the correct prompt message") { - expect(chooseSettings.newItemPromptMessage()).to(equal("? ")) - } - - it("returns 1, 2, 3, one, two, three as valid choices") { - expect(chooseSettings.validChoices()).to(equal(["1", "2", "3", "one", "two", "three"])) - } - - it("returns the correct prompt message") { - expect(chooseSettings.newItemPromptMessage()).to(equal("? ")) - } - - it("returns the correct initial prompt message") { - let items = ["1. one", "2. two", "3. three"] - expect(chooseSettings.preparePromptItems()).to(equal(items)) - } - - it("returns one for 1 and two for 2") { - expect(chooseSettings.choiceForInput("1")).to(equal(10)) - expect(chooseSettings.choiceForInput("two")).to(equal(20)) - } - } - } -} diff --git a/SwiftlineTests/SwiftlineTests/ChooseTests.swift b/SwiftlineTests/SwiftlineTests/ChooseTests.swift deleted file mode 100644 index a14dd3a..0000000 --- a/SwiftlineTests/SwiftlineTests/ChooseTests.swift +++ /dev/null @@ -1,140 +0,0 @@ -import Foundation -import Quick -import Nimble -@testable import Swiftline - - -class ChooseTests: QuickSpec { - override func spec() { - - var promptPrinter: DummyPromptPrinter! - - beforeEach { - promptPrinter = DummyPromptPrinter() - PromptSettings.printer = promptPrinter - } - - it("prints a prompt with choices") { - PromptSettings.reader = DummyPromptReader(toReturn: "1") - choose("Select one of ", choices: "one", "two", "three") - - let prompt = [ - "1. one", - "2. two", - "3. three", - "Select one of "].joined(separator: "\n") - expect(promptPrinter.printed).to(equal(prompt)) - } - - it("return the selected choice for 1") { - PromptSettings.reader = DummyPromptReader(toReturn: "1") - let choice = choose("Select one of", choices: "one", "two", "three") - expect(choice).to(equal("one")) - } - - it("return the selected choice for two") { - PromptSettings.reader = DummyPromptReader(toReturn: "two") - let choice = choose("Select one of", choices: "one", "two", "three") - expect(choice).to(equal("two")) - } - - it("keeps prompting if didnt receive the correct answer") { - PromptSettings.reader = DummyPromptReader(toReturn: "x", "y", "three") - let choice = choose("Select one of ", choices: "one", "two", "three") - - let prompt = [ - "1. one\n", - "2. two\n", - "3. three\n", - "Select one of ", - "You must choose one of [1, 2, 3, one, two, three].\n? ", - "You must choose one of [1, 2, 3, one, two, three].\n? "].joined(separator: "") - expect(promptPrinter.printed).to(equal(prompt)) - expect(choice).to(equal("three")) - } - - it("displays choices with blocks correctly") { - PromptSettings.reader = DummyPromptReader(toReturn: "1") - let choice = choose("Select one of ", type: Double.self) { - $0.addChoice("one") { 10 } - $0.addChoice("two") { 20 } - $0.addChoice("three") { 30 } - } - - let prompt = [ - "1. one", - "2. two", - "3. three", - "Select one of "].joined(separator: "\n") - expect(promptPrinter.printed).to(equal(prompt)) - expect(choice).to(equal(10)) - } - - it("displays choices with blocks correctly and selecting the second choice") { - PromptSettings.reader = DummyPromptReader(toReturn: "two") - let choice = choose("Select one of ", type: Double.self) { - $0.addChoice("one") { 10 } - $0.addChoice("two", "three") { 20 } - } - - let prompt = [ - "1. one", - "2. two", - "3. three", - "Select one of "].joined(separator: "\n") - expect(promptPrinter.printed).to(equal(prompt)) - expect(choice).to(equal(20)) - } - - it("displays choices with blocks correctly and selecting the third choice") { - PromptSettings.reader = DummyPromptReader(toReturn: "3") - let choice = choose("Select one of ", type: Double.self) { - $0.addChoice("one") { 10 } - $0.addChoice("two", "three") { 20 } - } - - let prompt = [ - "1. one", - "2. two", - "3. three", - "Select one of "].joined(separator: "\n") - expect(promptPrinter.printed).to(equal(prompt)) - expect(choice).to(equal(20)) - } - - it("creates a choose with only a block") { - PromptSettings.reader = DummyPromptReader(toReturn: "3") - let choice: Int = choose { - $0.promptQuestion = "Select one of " - $0.addChoice("one") { 10 } - $0.addChoice("two", "three") { 20 } - } - - let prompt = [ - "1. one", - "2. two", - "3. three", - "Select one of "].joined(separator: "\n") - expect(promptPrinter.printed).to(equal(prompt)) - expect(choice).to(equal(20)) - } - - it("creates a choose with only a block and a type") { - PromptSettings.reader = DummyPromptReader(toReturn: "3") - let choice = choose(Int.self) { - $0.promptQuestion = "Select one of " - $0.addChoice("one") { 10 } - $0.addChoice("two", "three") { 20 } - } - - let prompt = [ - "1. one", - "2. two", - "3. three", - "Select one of "].joined(separator: "\n") - expect(promptPrinter.printed).to(equal(prompt)) - expect(choice).to(equal(20)) - } - - } -} diff --git a/SwiftlineTests/SwiftlineTests/ColorizerTest.swift b/SwiftlineTests/SwiftlineTests/ColorizerTest.swift deleted file mode 100644 index 53419ef..0000000 --- a/SwiftlineTests/SwiftlineTests/ColorizerTest.swift +++ /dev/null @@ -1,167 +0,0 @@ -import Foundation -import Quick -import Nimble -@testable import Swiftline - - -class ColorizerTest: QuickSpec { - override func spec() { - - describe("Foreground Extension") { - - it("returns a black string") { - let string = "the string".f.Black - expect(string).to(equal("\u{001B}[30mthe string\u{001B}[0m")) - } - - it("returns a red string") { - let string = "the string".f.Red - expect(string).to(equal("\u{001B}[31mthe string\u{001B}[0m")) - } - - it("returns a green string") { - let string = "the string".f.Green - expect(string).to(equal("\u{001B}[32mthe string\u{001B}[0m")) - } - - it("returns a yellow string") { - let string = "the string".f.Yellow - expect(string).to(equal("\u{001B}[33mthe string\u{001B}[0m")) - } - - it("returns a blue string") { - let string = "the string".f.Blue - expect(string).to(equal("\u{001B}[34mthe string\u{001B}[0m")) - } - - it("returns a magenta string") { - let string = "the string".f.Magenta - expect(string).to(equal("\u{001B}[35mthe string\u{001B}[0m")) - } - - it("returns a cyan string") { - let string = "the string".f.Cyan - expect(string).to(equal("\u{001B}[36mthe string\u{001B}[0m")) - } - - it("returns a white string") { - let string = "the string".f.White - expect(string).to(equal("\u{001B}[37mthe string\u{001B}[0m")) - } - - } - - describe("Background Extension") { - - it("returns a black string") { - let string = "the string".b.Black - expect(string).to(equal("\u{001B}[40mthe string\u{001B}[0m")) - } - - it("returns a red string") { - let string = "the string".b.Red - expect(string).to(equal("\u{001B}[41mthe string\u{001B}[0m")) - } - - it("returns a green string") { - let string = "the string".b.Green - expect(string).to(equal("\u{001B}[42mthe string\u{001B}[0m")) - } - - it("returns a yellow string") { - let string = "the string".b.Yellow - expect(string).to(equal("\u{001B}[43mthe string\u{001B}[0m")) - } - - it("returns a blue string") { - let string = "the string".b.Blue - expect(string).to(equal("\u{001B}[44mthe string\u{001B}[0m")) - } - - it("returns a magenta string") { - let string = "the string".b.Magenta - expect(string).to(equal("\u{001B}[45mthe string\u{001B}[0m")) - } - - it("returns a cyan string") { - let string = "the string".b.Cyan - expect(string).to(equal("\u{001B}[46mthe string\u{001B}[0m")) - } - - it("returns a white string") { - let string = "the string".b.White - expect(string).to(equal("\u{001B}[47mthe string\u{001B}[0m")) - } - - } - - describe("Style Extension") { - - it("returns a bold string") { - let string = "the string".s.Bold - expect(string).to(equal("\u{001B}[1mthe string\u{001B}[0m")) - } - - it("returns an italic string") { - let string = "the string".s.Italic - expect(string).to(equal("\u{001B}[3mthe string\u{001B}[0m")) - } - - it("returns an underline string") { - let string = "the string".s.Underline - expect(string).to(equal("\u{001B}[4mthe string\u{001B}[0m")) - } - - it("returns an inverse string") { - let string = "the string".s.Inverse - expect(string).to(equal("\u{001B}[7mthe string\u{001B}[0m")) - } - - it("returns a strikethrough string") { - let string = "the string".s.Strikethrough - expect(string).to(equal("\u{001B}[9mthe string\u{001B}[0m")) - } - - it("returns a boldoff string") { - let string = "the string".s.BoldOff - expect(string).to(equal("\u{001B}[22mthe string\u{001B}[0m")) - } - - it("returns an italic off string") { - let string = "the string".s.ItalicOff - expect(string).to(equal("\u{001B}[23mthe string\u{001B}[0m")) - } - - it("returns an underline off string") { - let string = "the string".s.UnderlineOff - expect(string).to(equal("\u{001B}[24mthe string\u{001B}[0m")) - } - - it("returns an inverse off string") { - let string = "the string".s.InverseOff - expect(string).to(equal("\u{001B}[27mthe string\u{001B}[0m")) - } - - it("returns a strikethrough off string") { - let string = "the string".s.StrikethroughOff - expect(string).to(equal("\u{001B}[29mthe string\u{001B}[0m")) - } - - it("returns a reset style string") { - let string = "the string".s.Reset - expect(string).to(equal("\u{001B}[0mthe string\u{001B}[0m")) - } - - } - - describe("Mixing Styles Extension") { - - it("returns a bold red with white foreground string ") { - let string = "the string".s.Bold.f.Red.b.White - - expect(string).to(equal("\u{001B}[47;31;1mthe string\u{001B}[0m")) - } - } - - } -} diff --git a/SwiftlineTests/SwiftlineTests/ENVTests.swift b/SwiftlineTests/SwiftlineTests/ENVTests.swift deleted file mode 100644 index a8cff59..0000000 --- a/SwiftlineTests/SwiftlineTests/ENVTests.swift +++ /dev/null @@ -1,86 +0,0 @@ -import Foundation -import Quick -import Nimble -@testable import Swiftline - - -class ENVTests: QuickSpec { - override func spec() { - - beforeEach { - CommandExecutor.currentTaskExecutor = ActualTaskExecutor() - } - - it("returns nil when key does not exists") { - expect(Env.get("AAAAA")) - .to(beNil()) - } - - it("Reads environment variables") { - Env.set("SomeKey", "SomeValue") - expect(Env.get("SomeKey")).to(equal("SomeValue")) - } - - it("clears key when nil is passed") { - Env.set("SomeKey", "SomeValue") - expect(Env.get("SomeKey")).to(equal("SomeValue")) - - Env.set("SomeKey", nil) - expect(Env.get("SomeKey")).to(beNil()) - } - - it("clears all env vars") { - Env.set("SomeKey", "SomeValue") - expect(Env.get("SomeKey")).to(equal("SomeValue")) - - Env.clear() - expect(Env.get("SomeKey")).to(beNil()) - } - - it("return all keys") { - Env.clear() - Env.set("key1", "value1") - Env.set("key2", "value2") - - expect(Env.keys).to(equal(["key1", "key2"])) - Env.clear() - expect(Env.keys.count).to(equal(0)) - } - - it("return all values") { - Env.clear() - Env.set("key1", "value1") - Env.set("key2", "value2") - - expect(Env.values).to(equal(["value1", "value2"])) - } - - it("checks if key exists") { - Env.set("key1", "value1") - expect(Env.hasKey("key1")).to(beTrue()) - - Env.clear() - expect(Env.hasKey("key1")).to(beFalse()) - } - - it("checks if value exists") { - Env.set("key1", "value1") - expect(Env.hasValue("value1")).to(beTrue()) - - Env.clear() - expect(Env.hasValue("value1")).to(beFalse()) - } - - it("enumerates keys and values") { - Env.clear() - Env.set("key1", "value1") - Env.set("key2", "value2") - - Env.eachPair { - expect(["key1", "key2"]).to(contain($0)) - expect(["value1", "value2"]).to(contain($1)) - } - } - - } -} diff --git a/SwiftlineTests/SwiftlineTests/GlobTests.swift b/SwiftlineTests/SwiftlineTests/GlobTests.swift deleted file mode 100644 index 6f863aa..0000000 --- a/SwiftlineTests/SwiftlineTests/GlobTests.swift +++ /dev/null @@ -1,15 +0,0 @@ -import Foundation -import Quick -import Nimble -@testable import Swiftline - -class GlobTests: QuickSpec { - override func spec() { - - it("expands globs") { - let expanded = Glob.expand("\(FileManager.default.currentDirectoryPath)/*") - expect(expanded.count).to(beGreaterThan(0)) - } - - } -} diff --git a/SwiftlineTests/SwiftlineTests/Info.plist b/SwiftlineTests/SwiftlineTests/Info.plist deleted file mode 100644 index ba72822..0000000 --- a/SwiftlineTests/SwiftlineTests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/SwiftlineTests/SwiftlineTests/RunnerTests.swift b/SwiftlineTests/SwiftlineTests/RunnerTests.swift deleted file mode 100644 index 8f31c63..0000000 --- a/SwiftlineTests/SwiftlineTests/RunnerTests.swift +++ /dev/null @@ -1,201 +0,0 @@ -import Foundation -import Quick -import Nimble -@testable import Swiftline - - -class RunnerTests: QuickSpec { - override func spec() { - - var promptPrinter: DummyPromptPrinter! - - beforeEach { - promptPrinter = DummyPromptPrinter() - PromptSettings.printer = promptPrinter - } - - describe("dummy executor") { - - var dummyExecutor: DummyTaskExecutor! - - it("executes a command") { - dummyExecutor = DummyTaskExecutor(status: 0, output: "123", error: "") - CommandExecutor.currentTaskExecutor = dummyExecutor - let res = 🏃.run("ls -all") - - expect(res.exitStatus).to(equal(0)) - expect(res.stdout).to(equal("123")) - expect(res.stderr).to(equal("")) - - expect(dummyExecutor.commandsExecuted).to(equal(["ls -all"])) - } - - it("execute a command and handle erros") { - dummyExecutor = DummyTaskExecutor(status: 1, output: "", error: "123") - CommandExecutor.currentTaskExecutor = dummyExecutor - let res = 🏃.run("test test test") - - expect(res.exitStatus).to(equal(1)) - expect(res.stdout).to(equal("")) - expect(res.stderr).to(equal("123")) - - expect(dummyExecutor.commandsExecuted).to(equal(["test test test"])) - } - - it("execute a command with arguments seperated") { - dummyExecutor = DummyTaskExecutor(status: 1, output: "", error: "123") - CommandExecutor.currentTaskExecutor = dummyExecutor - - 🏃.run("ls", args: ["-all"]) - expect(dummyExecutor.commandsExecuted).to(equal(["ls -all"])) - - 🏃.run("echo", args: "bbb") - expect(dummyExecutor.commandsExecuted).to(equal(["ls -all", "echo bbb"])) - } - } - - describe("With echo") { - it("echo back stdout and stderr") { - let dummyExecutor = DummyTaskExecutor(status: 1, output: "Command output was", error: "error out") - CommandExecutor.currentTaskExecutor = dummyExecutor - - 🏃.run("ls", args: ["-all"]) { s in - s.echo = [.Stdout, .Stderr] - } - - expect(dummyExecutor.commandsExecuted).to(equal(["ls -all"])) - - let output = [ - "Stdout: ", - "Command output was", - "Stderr: ", - "error out\n"].joined(separator: "\n") - expect(promptPrinter.printed).to(equal(output)) - } - - it("does not echo if empty") { - let dummyExecutor = DummyTaskExecutor(status: 1, output: "", error: "error out") - CommandExecutor.currentTaskExecutor = dummyExecutor - - 🏃.run("ls", args: ["-all"]) { s in - s.echo = [.Stdout, .Stderr] - } - - expect(dummyExecutor.commandsExecuted).to(equal(["ls -all"])) - - let output = [ - "Stderr: ", - "error out\n"].joined(separator: "\n") - expect(promptPrinter.printed).to(equal(output)) - } - - it("echos only the command") { - let dummyExecutor = DummyTaskExecutor(status: 1, output: "", error: "error out") - CommandExecutor.currentTaskExecutor = dummyExecutor - - 🏃.run("ls", args: ["-all"]) { s in - s.echo = .Command - } - - expect(dummyExecutor.commandsExecuted).to(equal(["ls -all"])) - - let output = [ - "Command: ", - "ls -all\n"].joined(separator: "\n") - expect(promptPrinter.printed).to(equal(output)) - } - - - it("echo back stdout only") { - let dummyExecutor = DummyTaskExecutor(status: 1, output: "Command output was 2", error: "error out 2") - CommandExecutor.currentTaskExecutor = dummyExecutor - - 🏃.run("ls") { - $0.echo = .Stdout - } - - let output = [ - "Stdout: ", - "Command output was 2\n"].joined(separator: "\n") - expect(promptPrinter.printed).to(equal(output)) - } - - it("echo back stderr only") { - let dummyExecutor = DummyTaskExecutor(status: 1, output: "Command output was 2", error: "error out 2") - CommandExecutor.currentTaskExecutor = dummyExecutor - - 🏃.run("ls") { - $0.echo = .Stderr - } - - let output = [ - "Stderr: ", - "error out 2\n"].joined(separator: "\n") - expect(promptPrinter.printed).to(equal(output)) - } - - it("echo back nothing") { - let dummyExecutor = DummyTaskExecutor(status: 1, output: "Command output was 2", error: "error out 2") - CommandExecutor.currentTaskExecutor = dummyExecutor - - 🏃.run("ls") { - $0.echo = .None - } - - expect(promptPrinter.printed).to(equal("")) - } - - it("execute command with an echo") { - let dummyExecutor = DummyTaskExecutor(status: 1, output: "Command output was 2", error: "error out 2") - CommandExecutor.currentTaskExecutor = dummyExecutor - - 🏃.run("ls -all", echo: [.Command]) - - expect(dummyExecutor.commandsExecuted).to(equal(["ls -all"])) - - let output = [ - "Command: ", - "ls -all\n"].joined(separator: "\n") - expect(promptPrinter.printed).to(equal(output)) - } - } - - describe("Actual executor") { - - it("execute ls") { - CommandExecutor.currentTaskExecutor = ActualTaskExecutor() - let res = 🏃.run("ls -all") - - expect(res.exitStatus).to(equal(0)) - expect(res.stdout).notTo(equal("")) - expect(res.stderr).to(equal("")) - } - } - - describe("dry run") { - it("execute ls") { - CommandExecutor.currentTaskExecutor = ActualTaskExecutor() - let res = 🏃.run("ls -all") { - $0.dryRun = true - } - - expect(res.exitStatus).to(equal(0)) - expect(res.stdout).to(equal("")) - expect(res.stderr).to(equal("")) - expect(promptPrinter.printed).to(equal("Executed command 'ls -all'\n")) - } - - } - - describe("interactive run") { - it("execute ls") { - CommandExecutor.currentTaskExecutor = InteractiveTaskExecutor() - let res = 🏃.runWithoutCapture("ls") - - // Make it pass for now - // FIXME: figure out why this does not work - expect(res).to(equal(2)) - } - } - } -} diff --git a/TestPackage/Package.swift b/TestPackage/Package.swift deleted file mode 100644 index 9b3996f..0000000 --- a/TestPackage/Package.swift +++ /dev/null @@ -1,7 +0,0 @@ -import PackageDescription - -let package = Package(name: "TestPackage", - dependencies: [ - .Package(url: "../", majorVersion: 0, minor: 3), - ] -) diff --git a/TestPackage/Source/main.swift b/TestPackage/Source/main.swift deleted file mode 100644 index 38c09e0..0000000 --- a/TestPackage/Source/main.swift +++ /dev/null @@ -1,9 +0,0 @@ -import Swiftline - -let res = ask("How are you doing?") - -if res == "Good" { - print("Cool!") -} else { - print("Oh, bad!") -} diff --git a/Tests/SwiftlineTests/AgreeSettingsTest.swift b/Tests/SwiftlineTests/AgreeSettingsTest.swift new file mode 100644 index 0000000..cb48e2c --- /dev/null +++ b/Tests/SwiftlineTests/AgreeSettingsTest.swift @@ -0,0 +1,64 @@ +import Foundation +import XCTest +@testable import Swiftline + + +class AgreeSettingsTest: XCTestCase { + let settings = AgreeSettings(prompt: "The Prompt is") + + // it("accepts Yes, yes, Y, y") + func testItAcceptsYes() { + XCTAssertEqual(settings.invalidItemMessage("Yes"), nil) + XCTAssertEqual(settings.invalidItemMessage("Y"), nil) + XCTAssertEqual(settings.invalidItemMessage("yes"), nil) + XCTAssertEqual(settings.invalidItemMessage("y"), nil) + } + + func testItAcceptsNo() { + XCTAssertEqual(settings.invalidItemMessage("No"), nil) + XCTAssertEqual(settings.invalidItemMessage("N"), nil) + XCTAssertEqual(settings.invalidItemMessage("no"), nil) + XCTAssertEqual(settings.invalidItemMessage("n"), nil) + } + + // it("does not accept invalid inputs") + func testItDoesNotAcceptInvalidInputs() { + XCTAssertNotEqual(settings.invalidItemMessage("www"), nil) + XCTAssertNotEqual(settings.invalidItemMessage(""), nil) + } + + // it("retunrs the same item as valid item") + func testItReturnsTheSameItemAsValidItem() { + XCTAssertEqual(settings.validatedItem(forString: "No"), "No") + XCTAssertEqual(settings.validatedItem(forString: "Yes"), "Yes") + } + + // it("validates Yes, yes, Y, y as true") + func testItValidatesYesAsTrue() { + XCTAssertEqual(settings.isPositive("Yes"), true) + XCTAssertEqual(settings.isPositive("Y"), true) + XCTAssertEqual(settings.isPositive("yes"), true) + XCTAssertEqual(settings.isPositive("y"), true) + } + + // it("validates No, no, N, n as negative") + func testItValidatesNoAsTrue() { + XCTAssertEqual(settings.isPositive("No"), false) + XCTAssertEqual(settings.isPositive("N"), false) + XCTAssertEqual(settings.isPositive("no"), false) + XCTAssertEqual(settings.isPositive("n"), false) + } + + // it("retunrs correct invalid message prompt") + func testReturnsCorrectInvalidMessage() { + let invalid = settings.invalidItemMessage("") + XCTAssertEqual(invalid, "Please enter \"yes\" or \"no\".") + } + + // it("retunrs correct prompt new message prompt") + func testReturnsCorrectPromptMessage() { + let invalid = settings.newItemPromptMessage() + XCTAssertEqual(invalid, "The Prompt is ") + } + +} diff --git a/Tests/SwiftlineTests/AgreeTests.swift b/Tests/SwiftlineTests/AgreeTests.swift new file mode 100644 index 0000000..21416eb --- /dev/null +++ b/Tests/SwiftlineTests/AgreeTests.swift @@ -0,0 +1,46 @@ +import Foundation +import XCTest +@testable import Swiftline + + +class AgreeTest: XCTestCase { + + var promptPrinter: DummyPromptPrinter! + + override func setUp() { + promptPrinter = DummyPromptPrinter() + PromptSettings.printer = promptPrinter + } + + // it("returns true if yes is passed") + func testItReturnsTrueIfYesIsPassed() { + PromptSettings.reader = DummyPromptReader(toReturn: "Yes") + + let ret = agree("Are you a test?") + + XCTAssertEqual(ret, true) + XCTAssertEqual(promptPrinter.printed, "Are you a test? ") + } + + // it("returns true if n is passed") + func testItReturnsTrueIfNoIsPassed() { + PromptSettings.reader = DummyPromptReader(toReturn: "n") + + let ret = agree("Are you a test?") + + XCTAssertEqual(ret, false) + XCTAssertEqual(promptPrinter.printed, "Are you a test? ") + } + + // it("keeps asking if wrong parameter are passed") + func testItKeepsAskingIfWrongIsPassed() { + PromptSettings.reader = DummyPromptReader(toReturn: "a", "n") + + let ret = agree("Are you a test?") + + XCTAssertEqual(ret, false) + let prompts = "Are you a test? Please enter \"yes\" or \"no\".\nAre you a test? " + XCTAssertEqual(promptPrinter.printed, prompts) + } + +} diff --git a/Tests/SwiftlineTests/ArgsTests.swift b/Tests/SwiftlineTests/ArgsTests.swift new file mode 100644 index 0000000..d2700b6 --- /dev/null +++ b/Tests/SwiftlineTests/ArgsTests.swift @@ -0,0 +1,124 @@ +// +// CommandTests.swift +// Guaka +// +// Created by Omar Abdelhafith on 05/11/2016. +// +// + +import XCTest +@testable import Swiftline + +class ArgsTests: XCTestCase { + + func testItReturnsCorrectNumberOfArgs() { + XCTAssertEqual(Args.all.count > 0, true) + } + + func testItCreatesAHashFromArgs() { + let args = ["excutable_name", "-f", "file.rb", "--integer", "1", "Some custom one", "one", "two", "--no-ff"] + let res = Args.parse(argumens: args, cachedResults: nil) + + let result = [ + "f": "file.rb", + "integer": "1", + "no-ff": ""] + + XCTAssertEqual(res.flags, result) + XCTAssertEqual(res.parameters, ["Some custom one", "one", "two"]) + XCTAssertEqual(res.command, "excutable_name") + } + + func testReturnsEmptyArray() { + let r = ArgsParser.parseFlags([]) + XCTAssertEqual(r.0.count, 0) + XCTAssertEqual(r.1.count, 0) + } + + func testReturnsAllLeadingNonFlagParams() { + let r = ArgsParser.parseFlags(["omar", "hello", "-f", "test", "--help"]) + XCTAssertEqual(r.1, ["omar", "hello"]) + } + + func testReturnaAllTrailingNonFlagParams() { + let r = ArgsParser.parseFlags(["-f", "test", "--help", "x", "omar", "hello"]) + XCTAssertEqual(r.1, ["omar", "hello"]) + } + + func testReturnsAllMixedNonFlagParams() { + let r = ArgsParser.parseFlags(["-f", "test", "omar", "--help", "x", "hello"]) + XCTAssertEqual(r.1, ["omar", "hello"]) + } + + func testReturnAllFlagsIfTheyAreAllSet() { + let r = ArgsParser.parseFlags(["-f", "test", "omar", "--help", "x", "hello"]) + + XCTAssertEqual(r.0[0].argument.name, "f") + XCTAssertEqual(r.0[0].value, "test") + + XCTAssertEqual(r.0[1].argument.name, "help") + XCTAssertEqual(r.0[1].value, "x") + } + + func testReturnAllFlagsIfSomeAreNotSet() { + let r = ArgsParser.parseFlags(["-f", "-w", "omar", "--help", "x", "hello"]) + + XCTAssertEqual(r.0[0].argument.name, "f") + XCTAssertEqual(r.0[0].value, nil) + + XCTAssertEqual(r.0[1].argument.name, "w") + XCTAssertEqual(r.0[1].value, "omar") + + XCTAssertEqual(r.0[2].argument.name, "help") + XCTAssertEqual(r.0[2].value, "x") + } + + func testREturnsComplesFalg() { + let r = ArgsParser.parseFlags(["one", "-f", "-w", "omar", "two", "--help", "x", "hello"]) + + XCTAssertEqual(r.1, ["one", "two", "hello"]) + + XCTAssertEqual(r.0[0].argument.name, "f") + XCTAssertEqual(r.0[0].value, nil) + + XCTAssertEqual(r.0[1].argument.name, "w") + XCTAssertEqual(r.0[1].value, "omar") + + XCTAssertEqual(r.0[2].argument.name, "help") + XCTAssertEqual(r.0[2].value, "x") + } + + func testStopsParsingFlagsWhitTerminator() { + let r = ArgsParser.parseFlags(["one", "-f", "-w", "omar", "two", "--", "--help", "x", "hello"]) + + XCTAssertEqual(r.0[0].argument.name, "f") + XCTAssertEqual(r.0[0].value, nil) + + XCTAssertEqual(r.0[1].argument.name, "w") + XCTAssertEqual(r.0[1].value, "omar") + } + + func testITKnowsTheArgTypeOfString() { + XCTAssertEqual(Argument.ArgumentType("-f"), Argument.ArgumentType.shortFlag) + XCTAssertEqual(Argument.ArgumentType("--force"), Argument.ArgumentType.longFlag) + XCTAssertEqual(Argument.ArgumentType("--no-repo-update"), Argument.ArgumentType.longFlag) + XCTAssertEqual(Argument.ArgumentType("not an arg"), Argument.ArgumentType.notAFlag) + XCTAssertEqual(Argument.ArgumentType("not-an-arg"), Argument.ArgumentType.notAFlag) + + } + + func testItKnowsAnArgumentFlag() { + XCTAssertEqual(Argument.ArgumentType.shortFlag.isFlag, true) + XCTAssertEqual(Argument.ArgumentType.longFlag.isFlag, true) + XCTAssertEqual(Argument.ArgumentType.notAFlag.isFlag, false) + } + + func testItNormalizeFlags() { + XCTAssertEqual(Argument("-f").name, "f") + XCTAssertEqual(Argument("--force").name, "force") + XCTAssertEqual(Argument("--no-repo-update").name, "no-repo-update") + XCTAssertEqual(Argument("not an arg").name, "not an arg") + XCTAssertEqual(Argument("not-an-arg").name, "not-an-arg") + } + +} diff --git a/Tests/SwiftlineTests/AskSettingsTests.swift b/Tests/SwiftlineTests/AskSettingsTests.swift new file mode 100644 index 0000000..9d485e0 --- /dev/null +++ b/Tests/SwiftlineTests/AskSettingsTests.swift @@ -0,0 +1,50 @@ +// +// CommandTests.swift +// Guaka +// +// Created by Omar Abdelhafith on 05/11/2016. +// +// + +import XCTest +@testable import Swiftline + +class AskSettingsTests: XCTestCase { + + func testItReturnsTheDefaultStringIfEmpty() { + let askSettings = AskSettings() + askSettings.defaultValue = "Def" + XCTAssertEqual(askSettings.preparedItem(originalString: ""), "Def") + } + + func testItDoesNotReturnTheDefaultIfStringIsEmpty() { + let askSettings = AskSettings() + askSettings.defaultValue = "Def" + XCTAssertEqual(askSettings.preparedItem(originalString: "asd"), "asd") + } + + func testItValidatesWithABlock() { + let askSettings = AskSettings() + askSettings.addInvalidCase("") { s in return false } + XCTAssertEqual(askSettings.invalidItemMessage("ss"), nil) + + askSettings.addInvalidCase("") { s in return true } + XCTAssertNotEqual(askSettings.invalidItemMessage("ss"), nil) + } + + func testItReturnsCorrectInvalidMessage() { + let askSettings = AskSettings() + XCTAssertEqual(askSettings.invalidItemMessage(nil), "You provided an empty message, pelase enter anything!") + } + + func testItReturnsCorrectInvalidMessageWhenNotValidInt() { + let askSettings = AskSettings() + XCTAssertEqual(askSettings.invalidItemMessage("dd"), "You must enter a valid Integer.") + } + + func testItReturnsCorrectInvalidPrompt() { + let askSettings = AskSettings() + XCTAssertEqual(askSettings.newItemPromptMessage(), "? ") + } + +} diff --git a/Tests/SwiftlineTests/AskTests.swift b/Tests/SwiftlineTests/AskTests.swift new file mode 100644 index 0000000..062c71c --- /dev/null +++ b/Tests/SwiftlineTests/AskTests.swift @@ -0,0 +1,114 @@ +// +// CommandTests.swift +// Guaka +// +// Created by Omar Abdelhafith on 05/11/2016. +// +// + +import XCTest +@testable import Swiftline + +class AskerTest: XCTestCase { + + var promptPrinter: DummyPromptPrinter! + + override func setUp() { + promptPrinter = DummyPromptPrinter() + PromptSettings.printer = promptPrinter + } + + func testItReadsAStringFromStdin() { + PromptSettings.reader = DummyPromptReader(toReturn: "A String") + let res = ask("Enter a string") + + XCTAssertEqual(res, "A String") + XCTAssertEqual(promptPrinter.printed, "Enter a string\n") + } + + func testItReadsAnIntFromStdin() { + PromptSettings.reader = DummyPromptReader(toReturn: "1") + let res = ask("Enter a string", type: Int.self) + + XCTAssertEqual(res, 1) + XCTAssertEqual(promptPrinter.printed, "Enter a string\n") + } + + func testItKeepsAskingIfEnteredIsNotAnInt() { + PromptSettings.reader = DummyPromptReader(toReturn: "x", "y", "1") + + let res = ask("Enter a string", type: Int.self) + + let prompt = ["Enter a string", + "You must enter a valid Integer.", + "? You must enter a valid Integer.", + "? "].joined(separator: "\n") + + XCTAssertEqual(res, 1) + XCTAssertEqual(promptPrinter.printed, prompt) + } + + func testItReadsADoubleFromStdin() { + PromptSettings.reader = DummyPromptReader(toReturn: "1") + let res = ask("Enter a string", type: Double.self) + + XCTAssertEqual(res, 1.0) + XCTAssertEqual(promptPrinter.printed, "Enter a string\n") + } + + func testItKeepsAskingIfFalseValidation() { + PromptSettings.reader = DummyPromptReader(toReturn: "1", "2", "3") + let res = ask("Enter a string") { s in + s.addInvalidCase("Invalid string") { $0 != "3" } + } + + XCTAssertEqual(res, "3") + + let prompt = ["Enter a string", + "Invalid string", + "? Invalid string\n? "].joined(separator: "\n") + + XCTAssertEqual(promptPrinter.printed, prompt) + } + + + func testItAsksForConfirmation() { + PromptSettings.reader = DummyPromptReader(toReturn: "val", "Y") + let res = ask("Enter a string") { $0.confirm = true } + + XCTAssertEqual(res, "val") + XCTAssertEqual(promptPrinter.printed, "Enter a string\nAre you sure? ") + } + + func testItNoIsPassedToConfirmationItKeepsAsking() { + PromptSettings.reader = DummyPromptReader(toReturn: "val", "N", "other val", "y") + let res = ask("Enter a string") { $0.confirm = true } + + XCTAssertEqual(res, "other val") + + let prompt = ["Enter a string", + "Are you sure? ? Are you sure? "].joined(separator: "\n") + + XCTAssertEqual(promptPrinter.printed, prompt) + } + + func testItAsksForConfirmationAndValidatesInput() { + + PromptSettings.reader = DummyPromptReader(toReturn: "1", "n", "10", "9", "yes") + + let res = ask("Age?", type: Int.self) { + $0.confirm = true + $0.addInvalidCase("Age not correct") { $0 == 10 } + } + + XCTAssertEqual(res, 9) + + let prompt = ["Age?", + "Are you sure? ? Age not correct", + "? Are you sure? " + ].joined(separator: "\n") + + XCTAssertEqual(promptPrinter.printed, prompt) + } + +} diff --git a/Tests/SwiftlineTests/ChooseSettingsTests.swift b/Tests/SwiftlineTests/ChooseSettingsTests.swift new file mode 100644 index 0000000..6efad66 --- /dev/null +++ b/Tests/SwiftlineTests/ChooseSettingsTests.swift @@ -0,0 +1,144 @@ +// +// CommandTests.swift +// Guaka +// +// Created by Omar Abdelhafith on 05/11/2016. +// +// + +import XCTest +@testable import Swiftline + +class ChooseSettingsTests: XCTestCase { + + var chooseSettings: ChooseSettings! + override func setUp() { + chooseSettings = ChooseSettings() + chooseSettings.addChoice("one") { "one" } + chooseSettings.addChoice("two") { "two" } + chooseSettings.addChoice("three") { "three" } + } + + func testOneTwoThreAsInputs() { + XCTAssertEqual(chooseSettings.invalidItemMessage("one"), nil) + XCTAssertEqual(chooseSettings.invalidItemMessage("two"), nil) + XCTAssertEqual(chooseSettings.invalidItemMessage("three"), nil) + } + + func test123AsInputs() { + XCTAssertEqual(chooseSettings.invalidItemMessage("1"), nil) + XCTAssertEqual(chooseSettings.invalidItemMessage("2"), nil) + XCTAssertEqual(chooseSettings.invalidItemMessage("3"), nil) + } + + + func testInvalidInputs() { + XCTAssertNotEqual(chooseSettings.invalidItemMessage("0"), nil) + XCTAssertNotEqual(chooseSettings.invalidItemMessage("4"), nil) + XCTAssertNotEqual(chooseSettings.invalidItemMessage("x"), nil) + XCTAssertNotEqual(chooseSettings.invalidItemMessage("asd"), nil) + } + + + func testReturnsOneAndTowCorrectly() { + XCTAssertEqual(chooseSettings.validatedItem(forString: "one"), "one") + XCTAssertEqual(chooseSettings.validatedItem(forString: "2"), "two") + } + + func testItReturnsTheCorrectInvalidMessage() { + XCTAssertEqual(chooseSettings.invalidItemMessage(""), "You must choose one of [1, 2, 3, one, two, three].") + } + + func testItReturnsTheCorrectPromptMessage() { + XCTAssertEqual(chooseSettings.newItemPromptMessage(), "? ") + } + + func testReturns123AsValidChoices() { + XCTAssertEqual(chooseSettings.validChoices(), ["1", "2", "3", "one", "two", "three"]) + } + + func testItReturnsTheCorrectInitialPrompt() { + let items = ["1. one", "2. two", "3. three"] + XCTAssertEqual(chooseSettings.preparePromptItems(), items) + } + + func testReturnsOnefor1AnTwofor2() { + XCTAssertEqual(chooseSettings.choiceForInput("1"), "one") + XCTAssertEqual(chooseSettings.choiceForInput("two"), "two") + } + + + func testItCreatesPromtWithNumbers() { + let items = ["1. one", "2. two", "3. three"] + XCTAssertEqual(chooseSettings.preparePromptItems(), items) + } + + func testItCreatesPromptWithNumbersAndBrackets() { + let items = ["1) one", "2) two", "3) three"] + chooseSettings.indexSuffix = ") " + XCTAssertEqual(chooseSettings.preparePromptItems(), items) + } + + func testItCreatesPromptWithLettersAndDash() { + let items = ["a - one", "b - two", "c - three"] + chooseSettings.indexSuffix = " - " + chooseSettings.index = .letters + XCTAssertEqual(chooseSettings.preparePromptItems(), items) + } +} + +class ChooseSettingsTests2: XCTestCase { + + var chooseSettings: ChooseSettings! + + override func setUp() { + chooseSettings = ChooseSettings() + chooseSettings.addChoice("one") { 10 } + chooseSettings.addChoice("two") { 20 } + chooseSettings.addChoice("three") { 33 } + } + + func testAcceptsOneTwoThree() { + XCTAssertEqual(chooseSettings.invalidItemMessage("one"), nil) + } + + func testAccepts123() { + XCTAssertEqual(chooseSettings.invalidItemMessage("1"), nil) + } + + func testInvalidInputs() { + XCTAssertNotEqual(chooseSettings.invalidItemMessage("0"), nil) + XCTAssertNotEqual(chooseSettings.invalidItemMessage("4"), nil) + XCTAssertNotEqual(chooseSettings.invalidItemMessage("x"), nil) + XCTAssertNotEqual(chooseSettings.invalidItemMessage("asd"), nil) + } + + + func testReturnsOneAndTowCorrectly() { + XCTAssertEqual(chooseSettings.validatedItem(forString: "one"), 10) + XCTAssertEqual(chooseSettings.validatedItem(forString: "2"), 20) + } + + + func testItReturnsTheCorrectInvalidMessage() { + XCTAssertEqual(chooseSettings.invalidItemMessage(""), "You must choose one of [1, 2, 3, one, two, three].") + } + func testItReturnsTheCorrectPromptMessage() { + XCTAssertEqual(chooseSettings.newItemPromptMessage(), "? ") + } + + func testReturns123AsValidChoices() { + XCTAssertEqual(chooseSettings.validChoices(), ["1", "2", "3", "one", "two", "three"]) + } + + func testItReturnsTheCorrectInitialPrompt() { + let items = ["1. one", "2. two", "3. three"] + XCTAssertEqual(chooseSettings.preparePromptItems(), items) + } + + func testReturnsOnefor1AnTwofor2() { + XCTAssertEqual(chooseSettings.choiceForInput("1"), 10) + XCTAssertEqual(chooseSettings.choiceForInput("two"), 20) + } + +} diff --git a/Tests/SwiftlineTests/ChooseTests.swift b/Tests/SwiftlineTests/ChooseTests.swift new file mode 100644 index 0000000..6eb8745 --- /dev/null +++ b/Tests/SwiftlineTests/ChooseTests.swift @@ -0,0 +1,143 @@ +// +// CommandTests.swift +// Guaka +// +// Created by Omar Abdelhafith on 05/11/2016. +// +// + +import XCTest +@testable import Swiftline + +class ChooseTests: XCTestCase { + + var promptPrinter: DummyPromptPrinter! + + override func setUp() { + promptPrinter = DummyPromptPrinter() + PromptSettings.printer = promptPrinter + } + + func testPrintsPromtWithChoices() { + PromptSettings.reader = DummyPromptReader(toReturn: "1") + choose("Select one of ", choices: "one", "two", "three") + + let prompt = [ + "1. one", + "2. two", + "3. three", + "Select one of "].joined(separator: "\n") + XCTAssertEqual(promptPrinter.printed, prompt) + } + + func testReturnsTheSelectedChoiseFor1() { + PromptSettings.reader = DummyPromptReader(toReturn: "1") + let choice = choose("Select one of", choices: "one", "two", "three") + XCTAssertEqual(choice, "one") + } + + func testReturnsTheSelectedChoiseFor2() { + PromptSettings.reader = DummyPromptReader(toReturn: "2") + let choice = choose("Select one of", choices: "one", "two", "three") + XCTAssertEqual(choice, "two") + } + + func testKeepsPromptingIfIncorrectAnswer() { + PromptSettings.reader = DummyPromptReader(toReturn: "x", "y", "three") + let choice = choose("Select one of ", choices: "one", "two", "three") + + let prompt = [ + "1. one\n", + "2. two\n", + "3. three\n", + "Select one of ", + "You must choose one of [1, 2, 3, one, two, three].\n? ", + "You must choose one of [1, 2, 3, one, two, three].\n? "].joined(separator: "") + XCTAssertEqual(promptPrinter.printed, prompt) + XCTAssertEqual(choice, "three") + } + + func testDisplaysTheChoicesWithBlock() { + PromptSettings.reader = DummyPromptReader(toReturn: "1") + let choice = choose("Select one of ", type: Double.self) { + $0.addChoice("one") { 10 } + $0.addChoice("two") { 20 } + $0.addChoice("three") { 30 } + } + + let prompt = [ + "1. one", + "2. two", + "3. three", + "Select one of "].joined(separator: "\n") + XCTAssertEqual(promptPrinter.printed, prompt) + XCTAssertEqual(choice, 10) + } + + func testItDisplaysTheChoicesWithBlockWhenSelectingTheSecondChoice() { + PromptSettings.reader = DummyPromptReader(toReturn: "two") + let choice = choose("Select one of ", type: Double.self) { + $0.addChoice("one") { 10 } + $0.addChoice("two", "three") { 20 } + } + + let prompt = [ + "1. one", + "2. two", + "3. three", + "Select one of "].joined(separator: "\n") + XCTAssertEqual(promptPrinter.printed, prompt) + XCTAssertEqual(choice, 20) + } + + func testItDisplaysTheChoicesWithBlockWhenSelectingTheThirdChoice() { + PromptSettings.reader = DummyPromptReader(toReturn: "3") + let choice = choose("Select one of ", type: Double.self) { + $0.addChoice("one") { 10 } + $0.addChoice("two", "three") { 20 } + } + + let prompt = [ + "1. one", + "2. two", + "3. three", + "Select one of "].joined(separator: "\n") + XCTAssertEqual(promptPrinter.printed, prompt) + XCTAssertEqual(choice, 20) + } + + func testItCreatesAChoiceWithOnlyABlock() { + PromptSettings.reader = DummyPromptReader(toReturn: "3") + let choice: Int = choose { + $0.promptQuestion = "Select one of " + $0.addChoice("one") { 10 } + $0.addChoice("two", "three") { 20 } + } + + let prompt = [ + "1. one", + "2. two", + "3. three", + "Select one of "].joined(separator: "\n") + XCTAssertEqual(promptPrinter.printed, prompt) + XCTAssertEqual(choice, 20) + } + + func testItCreatesAChoiceWithOnlyABlockAndAType() { + PromptSettings.reader = DummyPromptReader(toReturn: "3") + let choice = choose(Int.self) { + $0.promptQuestion = "Select one of " + $0.addChoice("one") { 10 } + $0.addChoice("two", "three") { 20 } + } + + let prompt = [ + "1. one", + "2. two", + "3. three", + "Select one of "].joined(separator: "\n") + XCTAssertEqual(promptPrinter.printed, prompt) + XCTAssertEqual(choice, 20) + } + +} diff --git a/Tests/SwiftlineTests/ColorizerTest.swift b/Tests/SwiftlineTests/ColorizerTest.swift new file mode 100644 index 0000000..4809132 --- /dev/null +++ b/Tests/SwiftlineTests/ColorizerTest.swift @@ -0,0 +1,147 @@ +import Foundation +import XCTest +@testable import Swiftline + + +class ColorizerTest: XCTestCase { + + func testItReturnsBlackStringForeground() { + let string = "the string".f.black + XCTAssertEqual(string, "\u{001B}[30mthe string\u{001B}[0m") + } + + func testItReturnsRedStringForeground() { + let string = "the string".f.red + XCTAssertEqual(string, "\u{001B}[31mthe string\u{001B}[0m") + } + + func testItReturnsGreenStringForeground() { + let string = "the string".f.green + XCTAssertEqual(string, "\u{001B}[32mthe string\u{001B}[0m") + } + + func testItReturnsYellowStringForeground() { + let string = "the string".f.yellow + XCTAssertEqual(string, "\u{001B}[33mthe string\u{001B}[0m") + } + + func testItReturnsBlueStringForeground() { + let string = "the string".f.blue + XCTAssertEqual(string, "\u{001B}[34mthe string\u{001B}[0m") + } + + func testItReturnsMagentaStringForeground() { + let string = "the string".f.magenta + XCTAssertEqual(string, "\u{001B}[35mthe string\u{001B}[0m") + } + + func testItReturnsCyanStringForeground() { + let string = "the string".f.cyan + XCTAssertEqual(string, "\u{001B}[36mthe string\u{001B}[0m") + } + + func testItReturnsWhiteStringForeground() { + let string = "the string".f.white + XCTAssertEqual(string, "\u{001B}[37mthe string\u{001B}[0m") + } + + func testItReturnsBlackStringBackground() { + let string = "the string".b.black + XCTAssertEqual(string, "\u{001B}[40mthe string\u{001B}[0m") + } + + func testItReturnsRedStringBackground() { + let string = "the string".b.red + XCTAssertEqual(string, "\u{001B}[41mthe string\u{001B}[0m") + } + + func testItReturnsGreenStringBackground() { + let string = "the string".b.green + XCTAssertEqual(string, "\u{001B}[42mthe string\u{001B}[0m") + } + + func testItReturnsYellowStringBackground() { + let string = "the string".b.yellow + XCTAssertEqual(string, "\u{001B}[43mthe string\u{001B}[0m") + } + + func testItReturnsBlueStringBackground() { + let string = "the string".b.blue + XCTAssertEqual(string, "\u{001B}[44mthe string\u{001B}[0m") + } + + func testItReturnsMagentaStringBackground() { + let string = "the string".b.magenta + XCTAssertEqual(string, "\u{001B}[45mthe string\u{001B}[0m") + } + + func testItReturnsCyanStringBackground() { + let string = "the string".b.cyan + XCTAssertEqual(string, "\u{001B}[46mthe string\u{001B}[0m") + } + + func testItReturnsWhiteStringBackground() { + let string = "the string".b.white + XCTAssertEqual(string, "\u{001B}[47mthe string\u{001B}[0m") + } + + func testItReturnsABoldString() { + let string = "the string".s.bold + XCTAssertEqual(string, "\u{001B}[1mthe string\u{001B}[0m") + } + + func testItReturnsAnItalicString() { + let string = "the string".s.italic + XCTAssertEqual(string, "\u{001B}[3mthe string\u{001B}[0m") + } + + func testItReturnsAnUnderlineString() { + let string = "the string".s.underline + XCTAssertEqual(string, "\u{001B}[4mthe string\u{001B}[0m") + } + + func testItReturnsAnInverseString() { + let string = "the string".s.inverse + XCTAssertEqual(string, "\u{001B}[7mthe string\u{001B}[0m") + } + + func testItReturnsAStrickThroughString() { + let string = "the string".s.strikethrough + XCTAssertEqual(string, "\u{001B}[9mthe string\u{001B}[0m") + } + + func testItReturnsABoldOffString() { + let string = "the string".s.boldOff + XCTAssertEqual(string, "\u{001B}[22mthe string\u{001B}[0m") + } + + func testItReturnsAnItalicOffString() { + let string = "the string".s.italicOff + XCTAssertEqual(string, "\u{001B}[23mthe string\u{001B}[0m") + } + + func testItReturnsAnUnderlineOffString() { + let string = "the string".s.underlineOff + XCTAssertEqual(string, "\u{001B}[24mthe string\u{001B}[0m") + } + + func testItReturnsAnInverseOffString() { + let string = "the string".s.inverseOff + XCTAssertEqual(string, "\u{001B}[27mthe string\u{001B}[0m") + } + + func testItReturnsAStrickThroughOffString() { + let string = "the string".s.strikethroughOff + XCTAssertEqual(string, "\u{001B}[29mthe string\u{001B}[0m") + } + + func testItReturnsAResetString() { + let string = "the string".s.reset + XCTAssertEqual(string, "\u{001B}[0mthe string\u{001B}[0m") + } + + func testItReturnsAStringWithMultipleStyles() { + let string = "the string".s.bold.f.red.b.white + XCTAssertEqual(string, "\u{001B}[47;31;1mthe string\u{001B}[0m") + } +} diff --git a/Tests/SwiftlineTests/StringExtensionTests.swift b/Tests/SwiftlineTests/StringExtensionTests.swift new file mode 100644 index 0000000..ae534dc --- /dev/null +++ b/Tests/SwiftlineTests/StringExtensionTests.swift @@ -0,0 +1,129 @@ +// +// CommandTests.swift +// Guaka +// +// Created by Omar Abdelhafith on 05/11/2016. +// +// + +import XCTest +@testable import Swiftline + +class StringExtensionTests: XCTestCase { + + override func setUp() { + } + + func testItCanReplaceAString() { + let str = "Hello World ; BlaBla" + let toReplace = ";" + let toReplaceWith = "BBB" + let expected = "Hello World BBB BlaBla" + + let res = str.replacing(subString: toReplace, withString: toReplaceWith) + + XCTAssertEqual(res, expected) + } + + func testItCanReplaceAStringWithSingleCharacter() { + let str = "Hello World ; BlaBla" + let toReplace = ";" + let toReplaceWith = "B" + let expected = "Hello World B BlaBla" + + let res = str.replacing(subString: toReplace, withString: toReplaceWith) + + XCTAssertEqual(res, expected) + } + + func testItCanReplaceAStringWithEmptyString() { + let str = "Hello World ; BlaBla" + let toReplace = ";" + let toReplaceWith = "" + let expected = "Hello World BlaBla" + + let res = str.replacing(subString: toReplace, withString: toReplaceWith) + + XCTAssertEqual(res, expected) + } + + func testItCanReplaceAStringOnTheBeginning() { + let str = "; World A BlaBla" + let toReplace = ";" + let toReplaceWith = "BBB" + let expected = "BBB World A BlaBla" + + let res = str.replacing(subString: toReplace, withString: toReplaceWith) + + XCTAssertEqual(res, expected) + } + + func testItCanReplaceAStringOnTheEnd() { + let str = "Hello World A ;" + let toReplace = ";" + let toReplaceWith = "BBB" + let expected = "Hello World A BBB" + + let res = str.replacing(subString: toReplace, withString: toReplaceWith) + + XCTAssertEqual(res, expected) + } + + func testItCanReplaceAStringWithMultipleOccurancs() { + let str = ";Hel;lo ; World A ;" + let toReplace = ";" + let toReplaceWith = "BBB" + let expected = "BBBHelBBBlo BBB World A BBB" + + let res = str.replacing(subString: toReplace, withString: toReplaceWith) + + XCTAssertEqual(res, expected) + } + + func testItCanReplaceAStringOfMultiCharacters() { + let str = "Hello World m;m BlaBla" + let toReplace = "m;m" + let toReplaceWith = "BBB" + let expected = "Hello World BBB BlaBla" + + let res = str.replacing(subString: toReplace, withString: toReplaceWith) + + XCTAssertEqual(res, expected) + } + + func testItCanReplaceAStringWithSubrange() { + let str = ";Hello World ; BlaBla" + let toReplace = ";" + let toReplaceWith = "BBB" + let expected = ";Hello World BBB BlaBla" + + let range = (str.index(str.startIndex, offsetBy: 1)..