Skip to content

Commit

Permalink
Merge pull request #1 from phatblat/template
Browse files Browse the repository at this point in the history
☠️ Template
  • Loading branch information
phatblat authored May 18, 2020
2 parents 0c2b2ce + 637c4d9 commit 3737a01
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*.xccheckout
*.xcscmblueprint
.DS_Store
.build/
.classpath
.gradle/
.idea/
Expand Down
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.2.2
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The MIT License (MIT)
# The MIT License (MIT)

Copyright ©️ 2020 Ben Chatelain

Expand Down
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#
# Makefile
# Makefile-swift
# SwiftCLI
#
# https://github.com/phatblat/Makefile-swift

################################################################################
#
# Variables
#

CMD_NAME = signpass
CMD_NAME = swiftcli
SHELL = /bin/sh

# trunk
Expand Down
34 changes: 34 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"object": {
"pins": [
{
"package": "Nimble",
"repositoryURL": "https://github.com/Quick/Nimble",
"state": {
"branch": null,
"revision": "72f5a90d573f7f7d70aa6b8ad84b3e1e02eabb4d",
"version": "8.0.9"
}
},
{
"package": "Quick",
"repositoryURL": "https://github.com/Quick/Quick",
"state": {
"branch": null,
"revision": "33682c2f6230c60614861dfc61df267e11a1602f",
"version": "2.2.0"
}
},
{
"package": "swift-argument-parser",
"repositoryURL": "https://github.com/apple/swift-argument-parser",
"state": {
"branch": null,
"revision": "223d62adc52d51669ae2ee19bdb8b7d9fd6fcd9c",
"version": "0.0.6"
}
}
]
},
"version": 1
}
40 changes: 40 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// swift-tools-version:5.2
// The swift-tools-version declares the minimum version of Swift required to build this package.
// https://github.com/apple/swift-package-manager/blob/master/Documentation/PackageDescription.md

import PackageDescription

let package = Package(
name: "SwiftCLI",
platforms: [
.macOS(.v10_15),
],
products: [
.executable(
name: "swiftcli",
targets: ["swiftcli"]),
.library(
name: "SwiftCLIKit",
type: .dynamic,
targets: ["SwiftCLIKit"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser", .upToNextMajor(from: "0.0.1")),
.package(url: "https://github.com/Quick/Quick", .upToNextMajor(from: "2.2.0")),
.package(url: "https://github.com/Quick/Nimble", .upToNextMajor(from: "8.0.9")),
],
targets: [
.target(
name: "swiftcli",
dependencies: ["SwiftCLIKit"]),
.target(
name: "SwiftCLIKit",
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser")
]),
.testTarget(
name: "SwiftCLIKitTests",
dependencies: ["SwiftCLIKit", "Quick", "Nimble"]),
],
swiftLanguageVersions: [.v5]
)
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# Makefile-swift
# SwiftCLI

A template `Makefile` for Swift projects using the Swift Package Manager.
Based on Rob Allen's
A template for Swift projects using the Swift Package Manager. Includes 3 targets:

- `swiftcli`: an executable
- `SwiftCLIKit`: a library/framework to hold all logic
- `SwiftCLIKitTests`: tests for the library

The reason for putting all logic in the library is because an executable target
is not a bundle and thus Xcode can't run tests against it.

`Makefile` is based on Rob Allen's
[Cross-platform Makefile for Swift](https://akrabat.com/cross-platform-makefile-for-swift/)

## 📄 License
Expand Down
Empty file added Resources/sample_file.txt
Empty file.
3 changes: 3 additions & 0 deletions Sources/SwiftCLIKit/SwiftCLIKit.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
struct SwiftCLIKit {
var text = "Hello, World!"
}
3 changes: 3 additions & 0 deletions Sources/swiftcli/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
struct SwiftCLI {
var text = "Hello, World!"
}
1 change: 1 addition & 0 deletions Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fatalError("Running tests like this is unsupported. Run the tests again by using `swift test --enable-test-discovery`")
11 changes: 11 additions & 0 deletions Tests/SwiftCLIKitTests/SwiftCLITests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@testable import SwiftCLIKit
import XCTest

final class SwiftCLIKitTests: XCTestCase {
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct
// results.
XCTAssertEqual(SwiftCLIKit().text, "Hello, World!")
}
}

0 comments on commit 3737a01

Please sign in to comment.