diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c6abd09 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/rtb-buddy +/.idea/ +/coverage.out diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..291286e --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,61 @@ +version: 2 + +project_name: rtb-buddy + +before: + hooks: + - go mod tidy + - go test ./... + +builds: + - id: rtb-buddy + main: ./cmd/rtb-buddy + binary: rtb-buddy + env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - arm64 + ldflags: + - -s -w -X github.com/rtbrick/tools/cmd/rtb-buddy/config.VERSION={{.Version}} + +archives: + - id: default + ids: + - rtb-buddy + formats: ["tar.gz"] + name_template: "rtb-buddy_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + format_overrides: + - goos: windows + formats: ["zip"] + +checksum: + name_template: "checksums.txt" + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" + - "^chore:" + - "^ci:" + +homebrew_casks: + - name: rtb-buddy + repository: + owner: rtbrick + name: homebrew-tap + homepage: "https://github.com/rtbrick/tools" + description: "Multipurpose helper tool for the RtBrick fullstack" + binary: rtb-buddy + hooks: + post: + install: | + if OS.mac? + system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/rtb-buddy"] + end diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..93b5df5 --- /dev/null +++ b/Makefile @@ -0,0 +1,33 @@ +.PHONY: all build test fmt lint vet fix clean snapshot + +BIN := rtb-buddy +MODULE := ./cmd/rtb-buddy +VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev") +LDFLAGS := -s -w -X github.com/rtbrick/tools/cmd/rtb-buddy/config.VERSION=$(VERSION) + +all: fix lint test build + +build: + go build -ldflags "$(LDFLAGS)" -o $(BIN) $(MODULE) + +snapshot: + goreleaser release --snapshot --clean --skip=publish + +test: + go test -cover -coverprofile=coverage.out ./... + #go tool cover -func=coverage.out + +fmt: + gofmt -s -w . + +lint: + go tool golangci-lint run ./... + +vet: + go vet ./... + +fix: + go fix ./... + +clean: + rm -f $(BIN) coverage.out \ No newline at end of file diff --git a/README.adoc b/README.adoc new file mode 100644 index 0000000..d57d6bc --- /dev/null +++ b/README.adoc @@ -0,0 +1,241 @@ += rtbrick/tools +:toc: left +:toclevels: 3 +:sectnums: +:source-highlighter: rouge +:icons: font +:experimental: + +// Badges +image:https://img.shields.io/badge/license-BSD_3--Clause-blue.svg[License] +image:https://img.shields.io/badge/go-1.27+-00ADD8.svg[Go Version] +image:https://img.shields.io/badge/module-github.com%2Frtbrick%2Ftools-green.svg[Module] + +== Overview + +`rtbrick/tools` is a **collection of CLI tools** for the RtBrick platform. + +== Tools + +|=== +| Tool | Description + +| `rtb-buddy` +| Multipurpose helper tool for the RtBrick fullstack. See link:cmd/rtb-buddy/README.adoc[documentation]. + +|=== + +== Installation + +=== Quick Install + +[source,sh] +---- +curl -fsSL https://raw.githubusercontent.com/rtbrick/tools/main/install.sh | sudo bash +---- + +This detects your OS and architecture, downloads the latest release from GitHub, verifies the checksum, and installs `rtb-buddy` to `/usr/local/bin`. + +=== Options + +[source,sh] +---- +# Install a specific version +curl -fsSL https://raw.githubusercontent.com/rtbrick/tools/main/install.sh | sudo bash -s -- --version v1.0.0 + +# Install to a custom directory +curl -fsSL https://raw.githubusercontent.com/rtbrick/tools/main/install.sh | bash -s -- --dir ~/.local/bin + +# Uninstall +curl -fsSL https://raw.githubusercontent.com/rtbrick/tools/main/install.sh | sudo bash -s -- --uninstall +---- + +=== Homebrew (macOS) + +[source,sh] +---- +brew install rtbrick/tap/rtb-buddy +---- + +=== From Source + +[source,sh] +---- +git clone https://github.com/rtbrick/tools.git +cd tools +make build +sudo cp rtb-buddy /usr/local/bin/ +---- + +== Development + +=== Prerequisites + +* Go 1.27+ +* Git +* https://golangci-lint.run/[golangci-lint] (optional, for `make lint`) + +=== Make Targets + +[source,sh] +---- +make build # Build the rtb-buddy binary +make test # Run all tests +make fmt # Format source code +make lint # Run golangci-lint +make vet # Run go vet +make clean # Remove built binaries +---- + +== Contributing + +We welcome contributions! Please follow these guidelines: + +=== Reporting Issues + +* Search existing issues first to avoid duplicates +* Use the issue template if available +* Include: steps to reproduce, expected vs actual behavior, environment + +=== Pull Requests + +1. Fork the repository +2. Create a feature branch: `git checkout -b feature/my-change` +3. Make your changes with clear, focused commits +4. Run `make fmt` and `make lint` before committing +5. Add tests for new functionality +6. Open a PR with a descriptive title and description + +=== Code Style + +* Follow standard Go conventions (`gofmt`, `golint`) +* Keep functions small and focused +* Document exported types and functions with Go doc comments +* Update documentation when behavior changes + +=== Commit Messages + +Use conventional commits format: + +[source,sh] +---- +(): + + + +