From 27bbd7123ddb5ac13d714f74baaaad2d348e01e2 Mon Sep 17 00:00:00 2001 From: Chris Kuehl Date: Sun, 1 Sep 2024 21:33:08 -0500 Subject: [PATCH] Move things around --- .goreleaser-cli.yaml | 35 ++++++++++++++++++++++++++++++++ .goreleaser.yaml | 31 +++------------------------- Makefile | 25 +++++++++++++++-------- {cli => cmd}/fpb/fpb.go | 2 +- {cli => cmd}/fpb/fpb_test.go | 0 {cli => cmd}/fput/fput.go | 2 +- {cli => cmd}/internal/cli/cli.go | 0 7 files changed, 56 insertions(+), 39 deletions(-) create mode 100644 .goreleaser-cli.yaml rename {cli => cmd}/fpb/fpb.go (99%) rename {cli => cmd}/fpb/fpb_test.go (100%) rename {cli => cmd}/fput/fput.go (98%) rename {cli => cmd}/internal/cli/cli.go (100%) diff --git a/.goreleaser-cli.yaml b/.goreleaser-cli.yaml new file mode 100644 index 0000000..bae120c --- /dev/null +++ b/.goreleaser-cli.yaml @@ -0,0 +1,35 @@ +version: 2 +snapshot: + name_template: '{{.Env.VERSION}}' +builds: + - id: fput + main: ./cmd/fput + no_unique_dist_dir: true + binary: fput-{{.Os}}-{{.Arch}} + - id: fpb + main: ./cmd/fpb + no_unique_dist_dir: true + binary: fpb-{{.Os}}-{{.Arch}} +archives: +- format: binary +nfpms: + - id: cli + package_name: fluffy + builds: + - fpb + - fput + homepage: 'https://github.com/chriskuehl/fluffy' + maintainer: 'Chris Kuehl ' + description: 'command-line tools for uploading to fluffy servers' + license: Apache-2.0 + formats: + - deb + - rpm + - archlinux + contents: + - src: /usr/bin/fpb-{{.Os}}-{{.Arch}} + dst: /usr/bin/fpb + type: symlink + - src: /usr/bin/fput-{{.Os}}-{{.Arch}} + dst: /usr/bin/fput + type: symlink diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 6ff5e02..50099ce 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -2,34 +2,9 @@ version: 2 snapshot: name_template: '{{.Env.VERSION}}' builds: - - id: fput - main: ./cli/fput + - id: server + main: ./cmd/server no_unique_dist_dir: true - binary: fput-{{.Os}}-{{.Arch}} - - id: fpb - main: ./cli/fpb - no_unique_dist_dir: true - binary: fpb-{{.Os}}-{{.Arch}} + binary: server-{{.Os}}-{{.Arch}} archives: - format: binary -nfpms: - - id: cli - package_name: fluffy - builds: - - fpb - - fput - homepage: 'https://github.com/chriskuehl/fluffy' - maintainer: 'Chris Kuehl ' - description: 'command-line tools for uploading to fluffy servers' - license: Apache-2.0 - formats: - - deb - - rpm - - archlinux - contents: - - src: /usr/bin/fpb-{{.Os}}-{{.Arch}} - dst: /usr/bin/fpb - type: symlink - - src: /usr/bin/fput-{{.Os}}-{{.Arch}} - dst: /usr/bin/fput - type: symlink diff --git a/Makefile b/Makefile index f93b052..032d1cc 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,18 @@ .PHONY: minimal minimal: bin/server bin/fpb bin/fput assets settings.py install-hooks -.PHONY: fluffy-server +.PHONY: bin/server bin/server: go build -o $@ ./cmd/server +.PHONY: bin/fpb +bin/fpb: + go build -o $@ ./cmd/fpb + +.PHONY: bin/fput +bin/fput: + go build -o $@ ./cmd/fput + .PHONY: dev dev: go run github.com/cespare/reflex@latest -v -s -r '^server/|^go\.mod$$' -- go run ./cmd/server --dev @@ -13,18 +21,17 @@ dev: delve: dlv debug ./cmd/server -- --dev -.PHONY: bin/fpb -bin/fpb: - go build -o $@ ./cli/fpb - -.PHONY: bin/fput -bin/fput: - go build -o $@ ./cli/fput - .PHONY: release-cli release-cli: export GORELEASER_CURRENT_TAG ?= 0.0.0 release-cli: export VERSION ?= 0.0.0 release-cli: + go run github.com/goreleaser/goreleaser/v2@latest release --config .goreleaser-cli.yaml --clean --snapshot --verbose + rm -v dist/*.txt dist/*.yaml dist/*.json + +.PHONY: release-server +release-server: export GORELEASER_CURRENT_TAG ?= 0.0.0 +release-server: export VERSION ?= 0.0.0 +release-server: go run github.com/goreleaser/goreleaser/v2@latest release --clean --snapshot --verbose rm -v dist/*.txt dist/*.yaml dist/*.json diff --git a/cli/fpb/fpb.go b/cmd/fpb/fpb.go similarity index 99% rename from cli/fpb/fpb.go rename to cmd/fpb/fpb.go index 12af57d..bfc3112 100644 --- a/cli/fpb/fpb.go +++ b/cmd/fpb/fpb.go @@ -15,7 +15,7 @@ import ( "github.com/spf13/cobra" - "github.com/chriskuehl/fluffy/cli/internal/cli" + "github.com/chriskuehl/fluffy/cmd/internal/cli" ) // This will be set by the linker for release builds. diff --git a/cli/fpb/fpb_test.go b/cmd/fpb/fpb_test.go similarity index 100% rename from cli/fpb/fpb_test.go rename to cmd/fpb/fpb_test.go diff --git a/cli/fput/fput.go b/cmd/fput/fput.go similarity index 98% rename from cli/fput/fput.go rename to cmd/fput/fput.go index c8bc215..b038cdf 100644 --- a/cli/fput/fput.go +++ b/cmd/fput/fput.go @@ -13,7 +13,7 @@ import ( "github.com/spf13/cobra" - "github.com/chriskuehl/fluffy/cli/internal/cli" + "github.com/chriskuehl/fluffy/cmd/internal/cli" ) // This will be set by the linker for release builds. diff --git a/cli/internal/cli/cli.go b/cmd/internal/cli/cli.go similarity index 100% rename from cli/internal/cli/cli.go rename to cmd/internal/cli/cli.go