Skip to content

Commit

Permalink
Initial push
Browse files Browse the repository at this point in the history
  • Loading branch information
Walter Wong committed Sep 28, 2021
1 parent a032a25 commit 2ffdb82
Show file tree
Hide file tree
Showing 9 changed files with 150 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
32 changes: 32 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
TOOL_NAME = dh-state-machine-generate
FORMULA_NAME = dh-state-machine-generate-test
VERSION = $(shell git describe --abbrev=0 --tags)

PREFIX = /usr/local
INSTALL_PATH = $(PREFIX)/bin/$(TOOL_NAME)
SHARE_PATH = $(PREFIX)/share/$(TOOL_NAME)
BUILD_PATH = .build/release/$(TOOL_NAME)
CURRENT_PATH = $(PWD)
REPO = https://github.com/WalterWong94/$(TOOL_NAME)
RELEASE_TAR = $(REPO)/archive/$(VERSION).tar.gz
SHA = $(shell curl -L -s $(RELEASE_TAR) | shasum -a 256 | sed 's/ .*//')

build:
swift build --disable-sandbox -c release

install: build
mkdir -p $(PREFIX)/bin
cp -f $(BUILD_PATH) $(INSTALL_PATH)

uninstall:
rm -f $(INSTALL_PATH)

format:
swiftformat .

update_brew:
sed -i '' 's|\(url ".*/archive/\)\(.*\)\(.tar\)|\1$(VERSION)\3|' Formula/$(FORMULA_NAME).rb
sed -i '' 's|\(sha256 "\)\(.*\)\("\)|\1$(SHA)\3|' Formula/$(FORMULA_NAME).rb

git add Formula/*
git commit -m "Update brew to $(VERSION)"
25 changes: 25 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"object": {
"pins": [
{
"package": "swift-argument-parser",
"repositoryURL": "https://github.com/apple/swift-argument-parser",
"state": {
"branch": null,
"revision": "6b2aa2748a7881eebb9f84fb10c01293e15b52ca",
"version": "0.5.0"
}
},
{
"package": "SwiftFormat",
"repositoryURL": "https://github.com/nicklockwood/SwiftFormat",
"state": {
"branch": null,
"revision": "a9bdfd2548ebe518a693a5c6341d27c42b7e7a0a",
"version": "0.48.11"
}
}
]
},
"version": 1
}
26 changes: 26 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "StateMachineGenerator",
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.executable(name: "dh-state-machine-generate", targets: ["StateMachineGenerator"])
],
dependencies: [
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.41.2"),
.package(url: "https://github.com/apple/swift-argument-parser", from: "0.3.0")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "StateMachineGenerator",
dependencies: [.product(name: "ArgumentParser", package: "swift-argument-parser")]),
.testTarget(
name: "StateMachineGeneratorTests",
dependencies: ["StateMachineGenerator"]),
]
)
21 changes: 21 additions & 0 deletions Sources/StateMachineGenerator/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// File.swift
//
//
// Created by Walter Wong on 27/9/21.
//

import ArgumentParser
import Foundation

StateMachineGenerator.main()

struct StateMachineGenerator: ParsableCommand {
static var configuration = CommandConfiguration(
commandName: "dh-state-machine-generate"
)

func run() throws {

}
}
7 changes: 7 additions & 0 deletions Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import XCTest

import StateMachineGeneratorTests

var tests = [XCTestCaseEntry]()
tests += StateMachineGeneratorTests.allTests()
XCTMain(tests)
15 changes: 15 additions & 0 deletions Tests/StateMachineGeneratorTests/StateMachineGeneratorTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import XCTest
@testable import StateMachineGenerator

final class StateMachineGeneratorTests: 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(StateMachineGenerator().text, "Hello, World!")
}

static var allTests = [
("testExample", testExample),
]
}
9 changes: 9 additions & 0 deletions Tests/StateMachineGeneratorTests/XCTestManifests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import XCTest

#if !canImport(ObjectiveC)
public func allTests() -> [XCTestCaseEntry] {
return [
testCase(StateMachineGeneratorTests.allTests),
]
}
#endif

0 comments on commit 2ffdb82

Please sign in to comment.