Rename the app from tracker to fit
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 2m44s

The directory, the repo and the hostname are all fit; the module path,
the image, the namespace and the data file were still tracker. Nothing
is deployed yet, so this is free now and would not be later.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-01 22:03:33 -07:00
parent faf73c8be5
commit 3168a4ef96
14 changed files with 58 additions and 58 deletions

View File

@@ -24,7 +24,7 @@ func Load() (*Config, error) {
c := &Config{
Addr: env("ADDR", ":8080"),
BaseURL: strings.TrimRight(env("BASE_URL", "http://localhost:8080"), "/"),
DataPath: env("DATA_PATH", "data/tracker.json"),
DataPath: env("DATA_PATH", "data/fit.json"),
}
// The whole app is date arithmetic, so a wrong timezone silently logs

View File

@@ -284,7 +284,7 @@ func (s *Store) Export() ([]byte, error) {
func (s *Store) Import(body []byte) error {
var next data
if err := json.Unmarshal(body, &next); err != nil {
return fmt.Errorf("that file is not a tracker export: %w", err)
return fmt.Errorf("that file is not a fit export: %w", err)
}
if next.Days == nil {
next.Days = map[string]*Day{}
@@ -313,7 +313,7 @@ func (s *Store) persist() error {
}
dir := filepath.Dir(s.path)
tmp, err := os.CreateTemp(dir, ".tracker-*.json")
tmp, err := os.CreateTemp(dir, ".fit-*.json")
if err != nil {
return fmt.Errorf("create temp file: %w", err)
}

View File

@@ -96,7 +96,7 @@ func TestMarks(t *testing.T) {
}
func TestSaveAndReopen(t *testing.T) {
path := filepath.Join(t.TempDir(), "nested", "tracker.json")
path := filepath.Join(t.TempDir(), "nested", "fit.json")
st, err := Open(path)
if err != nil {
@@ -128,7 +128,7 @@ func TestSaveAndReopen(t *testing.T) {
}
func TestSaveEmptyDayRemovesIt(t *testing.T) {
path := filepath.Join(t.TempDir(), "tracker.json")
path := filepath.Join(t.TempDir(), "fit.json")
st, _ := Open(path)
if err := st.SaveDay(Day{Date: "2026-07-01", Workout: true}); err != nil {
@@ -145,7 +145,7 @@ func TestSaveEmptyDayRemovesIt(t *testing.T) {
// A day handed out must not share memory with the stored one, or editing the
// copy would quietly rewrite history.
func TestDayIsACopy(t *testing.T) {
path := filepath.Join(t.TempDir(), "tracker.json")
path := filepath.Join(t.TempDir(), "fit.json")
st, _ := Open(path)
st.SaveDay(Day{Date: "2026-07-01", Protein: ptr(190)})
@@ -158,7 +158,7 @@ func TestDayIsACopy(t *testing.T) {
}
func TestOpenRefusesUnreadableFile(t *testing.T) {
path := filepath.Join(t.TempDir(), "tracker.json")
path := filepath.Join(t.TempDir(), "fit.json")
if err := os.WriteFile(path, []byte("{not json"), 0o644); err != nil {
t.Fatal(err)
}
@@ -168,7 +168,7 @@ func TestOpenRefusesUnreadableFile(t *testing.T) {
}
func TestDaysFillsGaps(t *testing.T) {
path := filepath.Join(t.TempDir(), "tracker.json")
path := filepath.Join(t.TempDir(), "fit.json")
st, _ := Open(path)
st.SaveSettings(settings())
st.SaveDay(Day{Date: "2026-06-22", Workout: true})
@@ -189,7 +189,7 @@ func TestDaysFillsGaps(t *testing.T) {
}
func TestImportRejectsJunkDates(t *testing.T) {
path := filepath.Join(t.TempDir(), "tracker.json")
path := filepath.Join(t.TempDir(), "fit.json")
st, _ := Open(path)
if err := st.Import([]byte(`{"days":{"last tuesday":{"workout":true}}}`)); err == nil {
t.Fatal("Import accepted a key that is not a date")

View File

@@ -8,7 +8,7 @@ import (
"strings"
"time"
"github.com/scottyah/tracker/internal/store"
"github.com/scottyah/fit/internal/store"
)
// gratitudeMax caps one gratitude line. It is a line, not an essay, and a cap
@@ -250,7 +250,7 @@ func (s *Server) handleExport(w http.ResponseWriter, r *http.Request) {
s.fail(w, http.StatusInternalServerError, "The export did not build: "+err.Error())
return
}
name := "tracker-" + s.today() + ".json"
name := "fit-" + s.today() + ".json"
w.Header().Set("Content-Type", "application/json")
w.Header().Set("Content-Disposition", `attachment; filename="`+name+`"`)
w.Write(body)

View File

@@ -10,8 +10,8 @@ import (
"net/http"
"time"
"github.com/scottyah/tracker/internal/config"
"github.com/scottyah/tracker/internal/store"
"github.com/scottyah/fit/internal/config"
"github.com/scottyah/fit/internal/store"
)
//go:embed templates/*.html

View File

@@ -9,8 +9,8 @@ import (
"testing"
"time"
"github.com/scottyah/tracker/internal/config"
"github.com/scottyah/tracker/internal/store"
"github.com/scottyah/fit/internal/config"
"github.com/scottyah/fit/internal/store"
)
// newServer builds a server whose "today" is fixed, so the day arithmetic is
@@ -22,7 +22,7 @@ func newServer(t *testing.T, today string) (*Server, *store.Store) {
if err != nil {
t.Fatal(err)
}
st, err := store.Open(filepath.Join(t.TempDir(), "tracker.json"))
st, err := store.Open(filepath.Join(t.TempDir(), "fit.json"))
if err != nil {
t.Fatal(err)
}
@@ -240,11 +240,11 @@ func TestExportThenImport(t *testing.T) {
if rec.Code != http.StatusOK {
t.Fatalf("status %d", rec.Code)
}
if !strings.Contains(rec.Header().Get("Content-Disposition"), "tracker-2026-07-31.json") {
if !strings.Contains(rec.Header().Get("Content-Disposition"), "fit-2026-07-31.json") {
t.Errorf("download name = %q", rec.Header().Get("Content-Disposition"))
}
fresh, err := store.Open(filepath.Join(t.TempDir(), "tracker.json"))
fresh, err := store.Open(filepath.Join(t.TempDir(), "fit.json"))
if err != nil {
t.Fatal(err)
}