Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Version 2018.12.x #41

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [2018.X.X]

### Added
- `--case` flag to the `test` command, to specify which test case to run.

## [2018.10.03]

### Added
Expand Down
32 changes: 16 additions & 16 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
"repositoryURL": "https://github.com/vapor/core.git",
"state": {
"branch": null,
"revision": "ad776ec35f0a811672128eaf796fb3de10a46d3f",
"version": "3.4.2"
"revision": "eb876a758733166a4fb20f3f0a17b480c5ea563e",
"version": "3.4.3"
}
},
{
"package": "Crypto",
"repositoryURL": "https://github.com/vapor/crypto.git",
"state": {
"branch": null,
"revision": "4b85405430df1892ee3aa1554bdb477e96cf46ad",
"version": "3.2.0"
"revision": "5605334590affd4785a5839806b4504407e054ac",
"version": "3.3.0"
}
},
{
Expand All @@ -42,8 +42,8 @@
"repositoryURL": "https://github.com/vapor/http.git",
"state": {
"branch": null,
"revision": "f3641659867edfa7db1a939d1e38ece7f3766e25",
"version": "3.1.2"
"revision": "272b22be8cb3364e42a4701c2e0676e37480ec5a",
"version": "3.1.5"
}
},
{
Expand Down Expand Up @@ -87,17 +87,17 @@
"repositoryURL": "https://github.com/apple/swift-nio.git",
"state": {
"branch": null,
"revision": "f42c836ba58e3e38688acdb75df986dff02717f1",
"version": "1.9.4"
"revision": "5d8148c8b45dfb449276557f22120694567dd1d2",
"version": "1.9.5"
}
},
{
"package": "swift-nio-ssl",
"repositoryURL": "https://github.com/apple/swift-nio-ssl.git",
"state": {
"branch": null,
"revision": "6617eb0d3afcb12170594968df01ca63afb58ac5",
"version": "1.2.0"
"revision": "8380fa29a2af784b067d8ee01c956626ca29f172",
"version": "1.3.1"
}
},
{
Expand Down Expand Up @@ -132,8 +132,8 @@
"repositoryURL": "https://github.com/vapor/url-encoded-form.git",
"state": {
"branch": null,
"revision": "cbfe7ef6301557d3f2d0807a98165232ae06e1c6",
"version": "1.0.4"
"revision": "932024f363ee5ff59059cf7d67194a1c271d3d0c",
"version": "1.0.5"
}
},
{
Expand All @@ -150,17 +150,17 @@
"repositoryURL": "https://github.com/vapor/vapor.git",
"state": {
"branch": null,
"revision": "54632a6c1e7ecd9923c0d00b612de936de1c4745",
"version": "3.0.8"
"revision": "157d3b15336caa882662cc75024dd04b2e225246",
"version": "3.1.0"
}
},
{
"package": "WebSocket",
"repositoryURL": "https://github.com/vapor/websocket.git",
"state": {
"branch": null,
"revision": "141cb4d3814dc8062cb0b2f43e72801b5dfcf272",
"version": "1.0.1"
"revision": "149af03348f60ac8b84defdf277112d62fd8c704",
"version": "1.0.2"
}
},
{
Expand Down
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ let package = Package(
targets: [
.target(name: "Helpers", dependencies: ["Core", "Console"]),
.target(name: "Ether", dependencies: ["Vapor", "Helpers", "Console", "Command", "Manifest", "Core", "Xgen"]),
.target(name: "Executable", dependencies: ["Vapor", "Ether", "Console"])
.target(name: "Executable", dependencies: ["Vapor", "Ether", "Console"]),
.testTarget(name: "EtherTests", dependencies: ["Ether", "Executable"])
]
)
19 changes: 18 additions & 1 deletion Sources/Ether/Test.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ public final class Test: Command {
public var arguments: [CommandArgument] = []

public var options: [CommandOption] = [
CommandOption.value(name: "case", short: "c", help: [
"Specifies the test case to run. Valid values look like this:",
"- `EtherTests`",
"- `EtherTests.EtherTests`",
"- `EtherTests.EtherTests.testSomething"
]),
CommandOption.flag(name: "verbose", short: "v", help: ["Outputs raw stdout from `swift test`"]),
CommandOption.flag(name: "release", short: "r", help: ["Runs tests in release mode"])
]
Expand All @@ -36,8 +42,19 @@ public final class Test: Command {
public init() {}

public func run(using context: CommandContext) throws -> EventLoopFuture<Void> {
var command = ["test"]
if let `case` = context.options["case"] {
let filters = `case`.split(separator: ".").map(String.init)
if filters.count < 3 {
command.append(contentsOf: ["--filter", `case`])
} else {
let filter = filters[0] + "." + filters[1] + "/" + filters[2]
command.append(contentsOf: ["--filter", filter])
}
}

let stdout = self.output()
let exit = Process.asyncExecute("swift", "test", on: context.container) { output in
let exit = Process.asyncExecute("swift", command, on: context.container) { output in
switch output {
case let .stdout(data): self.log(data, on: context, with: stdout)
case let .stderr(data): self.log(data, on: context, with: stdout)
Expand Down
26 changes: 26 additions & 0 deletions Tests/EtherTests/EtherTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@testable import Ether
import XCTest

class EtherTests: XCTestCase {
func testPrint() {
print("hello")
}

static var allTests: [(String, (EtherTests) -> ()throws -> ())] {
return [
("testPrint", testPrint)
]
}
}

class AnotherTests: XCTestCase {
func testOut() {
print("bye")
}

static var allTests: [(String, (AnotherTests) -> ()throws -> ())] {
return [
("testOut", testOut)
]
}
}
19 changes: 17 additions & 2 deletions publish.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
if brew gdate 2>/dev/null; then
echo "🍺 Updating Homebrew Formulae"
brew upgrade
else
echo "Make sure you have the latest version of LibreSSL installed"

while true; do
read -p "Continue? [Y/n]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
fi

echo "📦 Updating Swift packages..."
swift package update
swift package resolve


echo "📦 Determining latest Git tag..."
TAG=$(git describe --abbrev=0 --tags);

Expand Down Expand Up @@ -32,7 +47,7 @@ cp .build/release/Executable ./$PACKAGE_NAME/$EXEC_NAME
tar -cvzf macOS-sierra.tar.gz ./$PACKAGE_NAME
HASH=$(shasum -a 256 macOS-sierra.tar.gz | cut -d " " -f 1)

echo "📦 Drag and drop $PWD/macOS-sierra.tar.gz into https://github.com/vapor/toolbox/releases/edit/$TAG"
echo "📦 Drag and drop $PWD/macOS-sierra.tar.gz into https://github.com/Ether-CLI/Ether/releases/edit/$TAG"

while true; do
read -p "Have you finished uploading? [y/n]" yn
Expand Down