Skip to content

Commit

Permalink
Remove xc and use make instead (miniscruff#555)
Browse files Browse the repository at this point in the history
  • Loading branch information
miniscruff authored Oct 21, 2023
1 parent 53fef6d commit d2a0b1f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 56 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

# Test binary, built with `go test -c`
*.test
coverage.txt
coverage.html

# Output of the go coverage tool
*.out
coverage.txt
coverage.html

# hugo builds
docs/public
Expand Down
17 changes: 8 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,20 @@ Pick any branch name you like that describes your change, but really anything wo

Now you are ready to start working on your change.

Development commands are listed in the [Tasks header in the Readme](/README.md#Tasks) and can be run using
the [xc task runner](https://xcfile.dev/).
You can also run the commands directly but task names are used in this guide.
Development commands are listed in the [Makefile](/Makefile) and can be run using make.
Make without arguments, or the help recipe can be used to list possible commands.

### Get the tests running

```sh
xc test
```bash
make test
```

Running tests should be possible immediately after cloning with just `go`.

### Viewing the documentation
```sh
xc docs-serve
```bash
make docs-serve
```

Documentation is generated by Hugo and sourced from different locations.
Expand Down Expand Up @@ -80,8 +79,8 @@ that can be referenced when writing your body message.
Be sure to commit the generated file to your branch as part of your pull request.

### Prepare your pull request
```sh
xc lint
```bash
make lint
```

## Creating your pull request
Expand Down
33 changes: 33 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.ONESHELL:
.DEFAULT: help

.PHONY: help
help:
@grep -E '^[a-z-]+:.*#' Makefile | \
sort | \
while read -r l; do printf "\033[1;32m$$(echo $$l | \
cut -d':' -f1)\033[00m:$$(echo $$l | cut -d'#' -f2-)\n"; \
done

.PHONY: test
test: # Run unit test suite
go test -race -coverprofile=c.out ./...
go tool cover -html=c.out -o=coverage.html

.PHONY: lint
lint: # Run linters
goimports -w -local github.com/miniscruff/changie .
golangci-lint run ./...

.PHONY: gen
gen: # Generate config and CLI docs
go run main.go gen

.PHONY: vhs-gen
vhs-gen: # Generate VHS recording videos
cd examples
ls *.tape | xargs -n 1 vhs

.PHONY: docs-serve
docs-serve: gen # Serve documentation locally
hugo serve -s docs
45 changes: 0 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,50 +41,5 @@ If you need additional help create an issue or post on discussions.
Changie is focused around the CLI and its configuration options and aims to keep existing CLI commands and options suported in major versions.
It is possible to use Changie as a dependent package but no support or compability is guaranteed.

## Tasks
Below is a list of common development tasks, these can easily be run using [xc](https://xcfile.dev/).
For example `xc test` will run the test suite.

### test
Run unit test suite with code coverage enabled
```
go test -coverprofile=c.out ./...
```

### coverage
requires: test
```
go tool cover -html=c.out
```

### lint
```
goimports -w -local github.com/miniscruff/changie .
golangci-lint run ./...
```

### gen
Generate config and CLI docs

```
go run main.go gen
```

### vhs-gen
Generate VHS recording videos

```
cd examples
ls *.tape | xargs -n 1 vhs
```

### docs-serve
Serve a locally running hugo instance for documentation

requires: gen
```
hugo serve -s docs
```

## License
Distributed under the [MIT License](LICENSE).

0 comments on commit d2a0b1f

Please sign in to comment.