template / commit
Getting the build to work on Windows again. Going back to pwsh, since that's a common shell.
.vscode/settings.json | 5 +++++ Makefile | 21 ++++++++++++--------- README.md | 9 +++++++-- profile_test.go | 2 +- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 3e2495f..3746455 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,12 +1,17 @@ { "cSpell.words": [ "bashdb", + "hackathon", + "isdefault", "logrus", + "namepatterns", "pwsh", + "Roadmap", "runpostscriptonfailure", "scriptshell", "sirupsen", "stretchr", + "templating", "urfave" ] } \ No newline at end of file diff --git a/Makefile b/Makefile index 9201aa9..23ed5eb 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,11 @@ -.PHONY: test +ifeq ($(OS),Windows_NT) + SHELL := pwsh.exe +else + SHELL := pwsh +endif +.SHELLFLAGS := -Command -all: build test lint install +all: install clean: go clean @@ -10,17 +15,15 @@ build: go build . lint: build + golangci-lint version golangci-lint run +.PHONY: test test: build - mkdir -p test - go test -v ./... -coverprofile="./test/coverage.out" - -test_coverage: test + New-Item -Path .\test\ -ItemType Directory -Force + go test -v -coverprofile="./test/coverage.out" go tool cover -html="./test/coverage.out" -o "./test/coverage.html" - -test_coverage_html: test_coverage - open "./test/coverage.html" + start "./test/coverage.html" install: build test lint go install diff --git a/README.md b/README.md index 143d8a8..b72a453 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ This is one of the profiles that comes with the tool. ``` Using the above configuration: + ```sh > template daily Profile: daily @@ -64,7 +65,7 @@ This will cause VSCode to open the `~\DailyNotes` folder as a workspace, and the The application requires [go](https://en.wikipedia.org/wiki/Go_(programming_language)). You can download the installer [here](https://go.dev/doc/install). -The build is managed by [make](https://www.gnu.org/software/make/). +The build is managed by [make](https://www.gnu.org/software/make/) and uses [PowerShell Core](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell). The default profiles use [Visual Studio Code](https://code.visualstudio.com/). @@ -115,7 +116,9 @@ ln -s ~/Dropbox/Work ~/Work A simple way to get started is to load this directory in VSCode and debug the project using one of the prepared launch tasks. Use command `View: Show Run and Debug` to display the launch configs, then pick one and press "Start Debugging" button. -The following command will build the package, test it, and then install it. I use this approach, but that's because I use `template xyz` multiple times a day, and find it helpful to be using the latest version. +This command will build the package, test it, lint it, and then install it locally: `make`. + +I use this approach, but that's because I typically use `template xyz` multiple times a day and find it helpful to be testing the latest version. ## Support @@ -155,6 +158,8 @@ Good guidance is invaluable, IMO, so to this extent I am very bullish about addi Makefile should be used for any build/test/release task. If there is a reason to run a task more than once *in the lifetime of a project*, add the task to the Makefile with a descriptive name. I don't want to see complicated steps embedded in READMEs or (worse) in code. If the task is important, one that a maintainer/developer/user *may* want to do, add it to Makefile. +And if the task is more complicated than ~10 lines of pwsh, add a new script under the "./scripts" folder and call the script from Makefile. + Similarly, if there is a good VSCode debug scenario, add a task to launch.json. ### Future Features diff --git a/profile_test.go b/profile_test.go index d276b89..5245457 100644 --- a/profile_test.go +++ b/profile_test.go @@ -352,7 +352,7 @@ func getCurrentOs() OSType { } } func getOtherOs(currentOs OSType) OSType { - if currentOs == "windows" { + if currentOs == "Windows" { return "Mac" } return "Windows"