detached 4c5e5e6

feat(ports): add repo metadata, git repos and clock ports with mockery mocks

commit
4c5e5e67060627f902879ac30c8f9c233125bcad
author
brice · · 2026-10-10 06:09 UTC
parent
f7f6672
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
8 files · +1317 -4
M .hexcheck.yaml +9 -0
@@ -20,9 +20,18 @@ components:
2020 role: entrypoint
2121 paths:
2222 - cmd/**
23+ config:
24+ role: entrypoint
25+ paths:
26+ - internal/config/**
2327 generated:
2428 role: ignore
2529 paths:
2630 - gen/**
2731 - '**/mocks/**'
2832 - '**/*_templ.go'
33+mocking:
34+ generatedMockPaths:
35+ - internal/ports/mocks/**
36+ generatedMockNamePatterns:
37+ - '{{Interface}}'
@@ -20,9 +20,18 @@ components:
20 role: entrypoint20 role: entrypoint
21 paths:21 paths:
22 - cmd/**22 - cmd/**
23+ config:
24+ role: entrypoint
25+ paths:
26+ - internal/config/**
23 generated:27 generated:
24 role: ignore28 role: ignore
25 paths:29 paths:
26 - gen/**30 - gen/**
27 - '**/mocks/**'31 - '**/mocks/**'
28 - '**/*_templ.go'32 - '**/*_templ.go'
33+mocking:
34+ generatedMockPaths:
35+ - internal/ports/mocks/**
36+ generatedMockNamePatterns:
37+ - '{{Interface}}'
A .mockery.yml +13 -0
@@ -0,0 +1,13 @@
1+# Mocks of the ports. Regenerate with: go generate ./internal/ports
2+template: testify
3+packages:
4+ bnema.dev/ermite/internal/ports:
5+ config:
6+ dir: "{{.InterfaceDir}}/mocks"
7+ pkgname: mocks
8+ filename: "{{.InterfaceName}}.go"
9+ structname: "{{.InterfaceName}}"
10+ interfaces:
11+ RepoMetaStore:
12+ GitRepos:
13+ Clock:
@@ -0,0 +1,13 @@
1+# Mocks of the ports. Regenerate with: go generate ./internal/ports
2+template: testify
3+packages:
4+ bnema.dev/ermite/internal/ports:
5+ config:
6+ dir: "{{.InterfaceDir}}/mocks"
7+ pkgname: mocks
8+ filename: "{{.InterfaceName}}.go"
9+ structname: "{{.InterfaceName}}"
10+ interfaces:
11+ RepoMetaStore:
12+ GitRepos:
13+ Clock:
M go.mod +121 -1
@@ -2,12 +2,132 @@ module bnema.dev/ermite
22
33 go 1.27.1
44
5-tool github.com/bnema/hexcheck/cmd/hexcheck
5+tool (
6+ github.com/bnema/hexcheck/cmd/hexcheck
7+ github.com/bufbuild/buf/cmd/buf
8+ github.com/vektra/mockery/v3
9+ google.golang.org/protobuf/cmd/protoc-gen-go
10+)
11+
12+require (
13+ github.com/bnema/zerowrap v1.4.1
14+ github.com/stretchr/testify v1.12.1
15+)
616
717 require (
18+ buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.36.12-20260722160903-4d94f3df3a7b.2 // indirect
19+ buf.build/gen/go/bufbuild/protodescriptor/protocolbuffers/go v1.36.12-20250109164928-1da0de137947.2 // indirect
20+ buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.12-20260825204119-511051f7f437.2 // indirect
21+ buf.build/gen/go/bufbuild/registry/connectrpc/go v1.20.0-20260831211851-b4432e12a6e7.1 // indirect
22+ buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.36.12-20260831211851-b4432e12a6e7.2 // indirect
23+ buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.36.12-20241007202033-cf42259fcbfc.2 // indirect
24+ buf.build/go/app v0.2.1-0.20260824172350-b0e76892c61a // indirect
25+ buf.build/go/bufplugin v0.10.0 // indirect
26+ buf.build/go/bufprivateusage v0.1.0 // indirect
27+ buf.build/go/interrupt v1.1.0 // indirect
28+ buf.build/go/protovalidate v1.4.0 // indirect
29+ buf.build/go/protoyaml v0.7.0 // indirect
30+ buf.build/go/spdx v0.2.0 // indirect
31+ buf.build/go/standard v0.1.1-0.20260325175353-2b287e071df5 // indirect
32+ cel.dev/cel-go v0.32.0 // indirect
33+ cel.dev/expr v0.25.3 // indirect
34+ connectrpc.com/connect v1.20.0 // indirect
35+ connectrpc.com/otelconnect v0.9.0 // indirect
36+ github.com/Microsoft/go-winio v0.6.2 // indirect
37+ github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
838 github.com/bnema/hexcheck v0.3.1 // indirect
39+ github.com/brunoga/deep v1.3.1 // indirect
40+ github.com/bufbuild/buf v1.73.0 // indirect
41+ github.com/bufbuild/protocompile v0.14.2-0.20260910151042-7436f7c76201 // indirect
42+ github.com/bufbuild/protoplugin v0.0.0-20260414125817-25d1d281b46b // indirect
43+ github.com/cespare/xxhash/v2 v2.3.0 // indirect
44+ github.com/cli/browser v1.3.0 // indirect
45+ github.com/clipperhouse/uax29/v2 v2.2.0 // indirect
46+ github.com/containerd/errdefs v1.0.0 // indirect
47+ github.com/containerd/errdefs/pkg v0.3.0 // indirect
48+ github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
49+ github.com/distribution/reference v0.6.0 // indirect
50+ github.com/docker/cli v29.8.0+incompatible // indirect
51+ github.com/docker/docker-credential-helpers v0.9.9 // indirect
52+ github.com/docker/go-connections v0.8.1 // indirect
53+ github.com/docker/go-units v0.5.0 // indirect
54+ github.com/fatih/structs v1.1.0 // indirect
55+ github.com/felixge/httpsnoop v1.1.0 // indirect
56+ github.com/fsnotify/fsnotify v1.9.0 // indirect
57+ github.com/go-logr/logr v1.4.4 // indirect
58+ github.com/go-logr/stdr v1.2.2 // indirect
59+ github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
60+ github.com/gofrs/flock v0.13.1 // indirect
61+ github.com/google/go-containerregistry v0.22.1 // indirect
62+ github.com/google/uuid v1.6.0 // indirect
63+ github.com/huandu/xstrings v1.5.0 // indirect
64+ github.com/inconshreveable/mousetrap v1.1.0 // indirect
65+ github.com/jdx/go-netrc v1.0.0 // indirect
66+ github.com/jedib0t/go-pretty/v6 v6.7.8 // indirect
67+ github.com/klauspost/compress v1.20.0 // indirect
68+ github.com/klauspost/pgzip v1.2.6 // indirect
69+ github.com/knadh/koanf/maps v0.1.2 // indirect
70+ github.com/knadh/koanf/parsers/yaml v1.1.0 // indirect
71+ github.com/knadh/koanf/providers/env v1.1.0 // indirect
72+ github.com/knadh/koanf/providers/file v1.2.1 // indirect
73+ github.com/knadh/koanf/providers/posflag v1.0.1 // indirect
74+ github.com/knadh/koanf/providers/structs v1.0.0 // indirect
75+ github.com/knadh/koanf/v2 v2.3.2 // indirect
76+ github.com/mattn/go-colorable v0.1.15 // indirect
77+ github.com/mattn/go-isatty v0.0.24 // indirect
78+ github.com/mattn/go-runewidth v0.0.19 // indirect
79+ github.com/mitchellh/copystructure v1.2.0 // indirect
80+ github.com/mitchellh/reflectwalk v1.0.2 // indirect
81+ github.com/moby/docker-image-spec v1.3.1 // indirect
82+ github.com/moby/moby/api v1.56.0 // indirect
83+ github.com/moby/moby/client v0.6.0 // indirect
84+ github.com/opencontainers/go-digest v1.0.0 // indirect
85+ github.com/opencontainers/image-spec v1.1.1 // indirect
86+ github.com/petermattis/goid v0.0.0-20260820044319-269ab09b5261 // indirect
87+ github.com/quic-go/qpack v0.6.0 // indirect
88+ github.com/quic-go/quic-go v0.62.0 // indirect
89+ github.com/rivo/uniseg v0.4.7 // indirect
90+ github.com/rs/cors v1.11.1 // indirect
91+ github.com/rs/zerolog v1.35.1 // indirect
92+ github.com/russross/blackfriday/v2 v2.1.0 // indirect
93+ github.com/segmentio/asm v1.2.1 // indirect
94+ github.com/segmentio/encoding v0.5.4 // indirect
95+ github.com/sirupsen/logrus v1.10.2 // indirect
96+ github.com/spf13/cobra v1.10.2 // indirect
97+ github.com/spf13/pflag v1.0.10 // indirect
98+ github.com/stretchr/objx v0.5.3 // indirect
99+ github.com/tetratelabs/wazero v1.12.0 // indirect
100+ github.com/tidwall/btree v1.8.1 // indirect
101+ github.com/vektra/mockery/v3 v3.8.0 // indirect
102+ github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
103+ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
104+ github.com/xeipuuv/gojsonschema v1.2.0 // indirect
105+ go.lsp.dev/jsonrpc2 v0.10.0 // indirect
106+ go.lsp.dev/pkg v0.0.0-20210717090340-384b27a52fb2 // indirect
107+ go.lsp.dev/protocol v0.12.0 // indirect
108+ go.lsp.dev/uri v0.3.0 // indirect
109+ go.opentelemetry.io/auto/sdk v1.2.1 // indirect
110+ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.71.0 // indirect
111+ go.opentelemetry.io/otel v1.46.0 // indirect
112+ go.opentelemetry.io/otel/metric v1.46.0 // indirect
113+ go.opentelemetry.io/otel/trace v1.46.0 // indirect
114+ go.uber.org/multierr v1.11.0 // indirect
115+ go.uber.org/zap v1.28.0 // indirect
116+ go.yaml.in/yaml/v3 v3.0.5 // indirect
117+ golang.org/x/crypto v0.57.0 // indirect
118+ golang.org/x/exp v0.0.0-20260824195058-e88cd73687aa // indirect
9119 golang.org/x/mod v0.41.0 // indirect
120+ golang.org/x/net v0.59.0 // indirect
10121 golang.org/x/sync v0.23.0 // indirect
122+ golang.org/x/sys v0.48.0 // indirect
123+ golang.org/x/term v0.46.0 // indirect
124+ golang.org/x/text v0.42.0 // indirect
11125 golang.org/x/tools v0.51.0 // indirect
126+ google.golang.org/genproto/googleapis/api v0.0.0-20260904194346-d0f1323225a4 // indirect
127+ google.golang.org/genproto/googleapis/rpc v0.0.0-20260904194346-d0f1323225a4 // indirect
128+ google.golang.org/protobuf v1.36.12 // indirect
129+ gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
12130 gopkg.in/yaml.v3 v3.0.1 // indirect
131+ mvdan.cc/xurls/v2 v2.6.0 // indirect
132+ pluginrpc.com/pluginrpc v0.5.0 // indirect
13133 )
@@ -2,12 +2,132 @@ module bnema.dev/ermite
2 2
3 go 1.27.13 go 1.27.1
4 4
5-tool github.com/bnema/hexcheck/cmd/hexcheck5+tool (
6+ github.com/bnema/hexcheck/cmd/hexcheck
7+ github.com/bufbuild/buf/cmd/buf
8+ github.com/vektra/mockery/v3
9+ google.golang.org/protobuf/cmd/protoc-gen-go
10+)
11+
12+require (
13+ github.com/bnema/zerowrap v1.4.1
14+ github.com/stretchr/testify v1.12.1
15+)
6 16
7 require (17 require (
18+ buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.36.12-20260722160903-4d94f3df3a7b.2 // indirect
19+ buf.build/gen/go/bufbuild/protodescriptor/protocolbuffers/go v1.36.12-20250109164928-1da0de137947.2 // indirect
20+ buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.12-20260825204119-511051f7f437.2 // indirect
21+ buf.build/gen/go/bufbuild/registry/connectrpc/go v1.20.0-20260831211851-b4432e12a6e7.1 // indirect
22+ buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.36.12-20260831211851-b4432e12a6e7.2 // indirect
23+ buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.36.12-20241007202033-cf42259fcbfc.2 // indirect
24+ buf.build/go/app v0.2.1-0.20260824172350-b0e76892c61a // indirect
25+ buf.build/go/bufplugin v0.10.0 // indirect
26+ buf.build/go/bufprivateusage v0.1.0 // indirect
27+ buf.build/go/interrupt v1.1.0 // indirect
28+ buf.build/go/protovalidate v1.4.0 // indirect
29+ buf.build/go/protoyaml v0.7.0 // indirect
30+ buf.build/go/spdx v0.2.0 // indirect
31+ buf.build/go/standard v0.1.1-0.20260325175353-2b287e071df5 // indirect
32+ cel.dev/cel-go v0.32.0 // indirect
33+ cel.dev/expr v0.25.3 // indirect
34+ connectrpc.com/connect v1.20.0 // indirect
35+ connectrpc.com/otelconnect v0.9.0 // indirect
36+ github.com/Microsoft/go-winio v0.6.2 // indirect
37+ github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
8 github.com/bnema/hexcheck v0.3.1 // indirect38 github.com/bnema/hexcheck v0.3.1 // indirect
39+ github.com/brunoga/deep v1.3.1 // indirect
40+ github.com/bufbuild/buf v1.73.0 // indirect
41+ github.com/bufbuild/protocompile v0.14.2-0.20260910151042-7436f7c76201 // indirect
42+ github.com/bufbuild/protoplugin v0.0.0-20260414125817-25d1d281b46b // indirect
43+ github.com/cespare/xxhash/v2 v2.3.0 // indirect
44+ github.com/cli/browser v1.3.0 // indirect
45+ github.com/clipperhouse/uax29/v2 v2.2.0 // indirect
46+ github.com/containerd/errdefs v1.0.0 // indirect
47+ github.com/containerd/errdefs/pkg v0.3.0 // indirect
48+ github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
49+ github.com/distribution/reference v0.6.0 // indirect
50+ github.com/docker/cli v29.8.0+incompatible // indirect
51+ github.com/docker/docker-credential-helpers v0.9.9 // indirect
52+ github.com/docker/go-connections v0.8.1 // indirect
53+ github.com/docker/go-units v0.5.0 // indirect
54+ github.com/fatih/structs v1.1.0 // indirect
55+ github.com/felixge/httpsnoop v1.1.0 // indirect
56+ github.com/fsnotify/fsnotify v1.9.0 // indirect
57+ github.com/go-logr/logr v1.4.4 // indirect
58+ github.com/go-logr/stdr v1.2.2 // indirect
59+ github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
60+ github.com/gofrs/flock v0.13.1 // indirect
61+ github.com/google/go-containerregistry v0.22.1 // indirect
62+ github.com/google/uuid v1.6.0 // indirect
63+ github.com/huandu/xstrings v1.5.0 // indirect
64+ github.com/inconshreveable/mousetrap v1.1.0 // indirect
65+ github.com/jdx/go-netrc v1.0.0 // indirect
66+ github.com/jedib0t/go-pretty/v6 v6.7.8 // indirect
67+ github.com/klauspost/compress v1.20.0 // indirect
68+ github.com/klauspost/pgzip v1.2.6 // indirect
69+ github.com/knadh/koanf/maps v0.1.2 // indirect
70+ github.com/knadh/koanf/parsers/yaml v1.1.0 // indirect
71+ github.com/knadh/koanf/providers/env v1.1.0 // indirect
72+ github.com/knadh/koanf/providers/file v1.2.1 // indirect
73+ github.com/knadh/koanf/providers/posflag v1.0.1 // indirect
74+ github.com/knadh/koanf/providers/structs v1.0.0 // indirect
75+ github.com/knadh/koanf/v2 v2.3.2 // indirect
76+ github.com/mattn/go-colorable v0.1.15 // indirect
77+ github.com/mattn/go-isatty v0.0.24 // indirect
78+ github.com/mattn/go-runewidth v0.0.19 // indirect
79+ github.com/mitchellh/copystructure v1.2.0 // indirect
80+ github.com/mitchellh/reflectwalk v1.0.2 // indirect
81+ github.com/moby/docker-image-spec v1.3.1 // indirect
82+ github.com/moby/moby/api v1.56.0 // indirect
83+ github.com/moby/moby/client v0.6.0 // indirect
84+ github.com/opencontainers/go-digest v1.0.0 // indirect
85+ github.com/opencontainers/image-spec v1.1.1 // indirect
86+ github.com/petermattis/goid v0.0.0-20260820044319-269ab09b5261 // indirect
87+ github.com/quic-go/qpack v0.6.0 // indirect
88+ github.com/quic-go/quic-go v0.62.0 // indirect
89+ github.com/rivo/uniseg v0.4.7 // indirect
90+ github.com/rs/cors v1.11.1 // indirect
91+ github.com/rs/zerolog v1.35.1 // indirect
92+ github.com/russross/blackfriday/v2 v2.1.0 // indirect
93+ github.com/segmentio/asm v1.2.1 // indirect
94+ github.com/segmentio/encoding v0.5.4 // indirect
95+ github.com/sirupsen/logrus v1.10.2 // indirect
96+ github.com/spf13/cobra v1.10.2 // indirect
97+ github.com/spf13/pflag v1.0.10 // indirect
98+ github.com/stretchr/objx v0.5.3 // indirect
99+ github.com/tetratelabs/wazero v1.12.0 // indirect
100+ github.com/tidwall/btree v1.8.1 // indirect
101+ github.com/vektra/mockery/v3 v3.8.0 // indirect
102+ github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
103+ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
104+ github.com/xeipuuv/gojsonschema v1.2.0 // indirect
105+ go.lsp.dev/jsonrpc2 v0.10.0 // indirect
106+ go.lsp.dev/pkg v0.0.0-20210717090340-384b27a52fb2 // indirect
107+ go.lsp.dev/protocol v0.12.0 // indirect
108+ go.lsp.dev/uri v0.3.0 // indirect
109+ go.opentelemetry.io/auto/sdk v1.2.1 // indirect
110+ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.71.0 // indirect
111+ go.opentelemetry.io/otel v1.46.0 // indirect
112+ go.opentelemetry.io/otel/metric v1.46.0 // indirect
113+ go.opentelemetry.io/otel/trace v1.46.0 // indirect
114+ go.uber.org/multierr v1.11.0 // indirect
115+ go.uber.org/zap v1.28.0 // indirect
116+ go.yaml.in/yaml/v3 v3.0.5 // indirect
117+ golang.org/x/crypto v0.57.0 // indirect
118+ golang.org/x/exp v0.0.0-20260824195058-e88cd73687aa // indirect
9 golang.org/x/mod v0.41.0 // indirect119 golang.org/x/mod v0.41.0 // indirect
120+ golang.org/x/net v0.59.0 // indirect
10 golang.org/x/sync v0.23.0 // indirect121 golang.org/x/sync v0.23.0 // indirect
122+ golang.org/x/sys v0.48.0 // indirect
123+ golang.org/x/term v0.46.0 // indirect
124+ golang.org/x/text v0.42.0 // indirect
11 golang.org/x/tools v0.51.0 // indirect125 golang.org/x/tools v0.51.0 // indirect
126+ google.golang.org/genproto/googleapis/api v0.0.0-20260904194346-d0f1323225a4 // indirect
127+ google.golang.org/genproto/googleapis/rpc v0.0.0-20260904194346-d0f1323225a4 // indirect
128+ google.golang.org/protobuf v1.36.12 // indirect
129+ gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
12 gopkg.in/yaml.v3 v3.0.1 // indirect130 gopkg.in/yaml.v3 v3.0.1 // indirect
131+ mvdan.cc/xurls/v2 v2.6.0 // indirect
132+ pluginrpc.com/pluginrpc v0.5.0 // indirect
13 )133 )
M go.sum +273 -3 generated file: collapsed
A internal/ports/mocks/Clock.go +91 -0
@@ -0,0 +1,91 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "time"
9+
10+ mock "github.com/stretchr/testify/mock"
11+)
12+
13+// NewClock creates a new instance of Clock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
14+// The first argument is typically a *testing.T value.
15+func NewClock(t interface {
16+ mock.TestingT
17+ Cleanup(func())
18+}) *Clock {
19+ if helper, ok := t.(interface{ Helper() }); ok {
20+ helper.Helper()
21+ }
22+
23+ mock := &Clock{}
24+ mock.Mock.Test(t)
25+
26+ t.Cleanup(func() {
27+ if helper, ok := t.(interface{ Helper() }); ok {
28+ helper.Helper()
29+ }
30+ mock.AssertExpectations(t)
31+ })
32+
33+ return mock
34+}
35+
36+// Clock is an autogenerated mock type for the Clock type
37+type Clock struct {
38+ mock.Mock
39+}
40+
41+type Clock_Expecter struct {
42+ mock *mock.Mock
43+}
44+
45+func (_m *Clock) EXPECT() *Clock_Expecter {
46+ return &Clock_Expecter{mock: &_m.Mock}
47+}
48+
49+// Now provides a mock function for the type Clock
50+func (_mock *Clock) Now() time.Time {
51+ ret := _mock.Called()
52+
53+ if len(ret) == 0 {
54+ panic("no return value specified for Now")
55+ }
56+
57+ var r0 time.Time
58+ if returnFunc, ok := ret.Get(0).(func() time.Time); ok {
59+ r0 = returnFunc()
60+ } else {
61+ r0 = ret.Get(0).(time.Time)
62+ }
63+ return r0
64+}
65+
66+// Clock_Now_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Now'
67+type Clock_Now_Call struct {
68+ *mock.Call
69+}
70+
71+// Now is a helper method to define mock.On call
72+func (_e *Clock_Expecter) Now() *Clock_Now_Call {
73+ return &Clock_Now_Call{Call: _e.mock.On("Now")}
74+}
75+
76+func (_c *Clock_Now_Call) Run(run func()) *Clock_Now_Call {
77+ _c.Call.Run(func(args mock.Arguments) {
78+ run()
79+ })
80+ return _c
81+}
82+
83+func (_c *Clock_Now_Call) Return(time1 time.Time) *Clock_Now_Call {
84+ _c.Call.Return(time1)
85+ return _c
86+}
87+
88+func (_c *Clock_Now_Call) RunAndReturn(run func() time.Time) *Clock_Now_Call {
89+ _c.Call.Return(run)
90+ return _c
91+}
@@ -0,0 +1,91 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "time"
9+
10+ mock "github.com/stretchr/testify/mock"
11+)
12+
13+// NewClock creates a new instance of Clock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
14+// The first argument is typically a *testing.T value.
15+func NewClock(t interface {
16+ mock.TestingT
17+ Cleanup(func())
18+}) *Clock {
19+ if helper, ok := t.(interface{ Helper() }); ok {
20+ helper.Helper()
21+ }
22+
23+ mock := &Clock{}
24+ mock.Mock.Test(t)
25+
26+ t.Cleanup(func() {
27+ if helper, ok := t.(interface{ Helper() }); ok {
28+ helper.Helper()
29+ }
30+ mock.AssertExpectations(t)
31+ })
32+
33+ return mock
34+}
35+
36+// Clock is an autogenerated mock type for the Clock type
37+type Clock struct {
38+ mock.Mock
39+}
40+
41+type Clock_Expecter struct {
42+ mock *mock.Mock
43+}
44+
45+func (_m *Clock) EXPECT() *Clock_Expecter {
46+ return &Clock_Expecter{mock: &_m.Mock}
47+}
48+
49+// Now provides a mock function for the type Clock
50+func (_mock *Clock) Now() time.Time {
51+ ret := _mock.Called()
52+
53+ if len(ret) == 0 {
54+ panic("no return value specified for Now")
55+ }
56+
57+ var r0 time.Time
58+ if returnFunc, ok := ret.Get(0).(func() time.Time); ok {
59+ r0 = returnFunc()
60+ } else {
61+ r0 = ret.Get(0).(time.Time)
62+ }
63+ return r0
64+}
65+
66+// Clock_Now_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Now'
67+type Clock_Now_Call struct {
68+ *mock.Call
69+}
70+
71+// Now is a helper method to define mock.On call
72+func (_e *Clock_Expecter) Now() *Clock_Now_Call {
73+ return &Clock_Now_Call{Call: _e.mock.On("Now")}
74+}
75+
76+func (_c *Clock_Now_Call) Run(run func()) *Clock_Now_Call {
77+ _c.Call.Run(func(args mock.Arguments) {
78+ run()
79+ })
80+ return _c
81+}
82+
83+func (_c *Clock_Now_Call) Return(time1 time.Time) *Clock_Now_Call {
84+ _c.Call.Return(time1)
85+ return _c
86+}
87+
88+func (_c *Clock_Now_Call) RunAndReturn(run func() time.Time) *Clock_Now_Call {
89+ _c.Call.Return(run)
90+ return _c
91+}
A internal/ports/mocks/GitRepos.go +397 -0
@@ -0,0 +1,397 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "bnema.dev/ermite/internal/domain"
11+ "bnema.dev/ermite/internal/ports"
12+ mock "github.com/stretchr/testify/mock"
13+)
14+
15+// NewGitRepos creates a new instance of GitRepos. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
16+// The first argument is typically a *testing.T value.
17+func NewGitRepos(t interface {
18+ mock.TestingT
19+ Cleanup(func())
20+}) *GitRepos {
21+ if helper, ok := t.(interface{ Helper() }); ok {
22+ helper.Helper()
23+ }
24+
25+ mock := &GitRepos{}
26+ mock.Mock.Test(t)
27+
28+ t.Cleanup(func() {
29+ if helper, ok := t.(interface{ Helper() }); ok {
30+ helper.Helper()
31+ }
32+ mock.AssertExpectations(t)
33+ })
34+
35+ return mock
36+}
37+
38+// GitRepos is an autogenerated mock type for the GitRepos type
39+type GitRepos struct {
40+ mock.Mock
41+}
42+
43+type GitRepos_Expecter struct {
44+ mock *mock.Mock
45+}
46+
47+func (_m *GitRepos) EXPECT() *GitRepos_Expecter {
48+ return &GitRepos_Expecter{mock: &_m.Mock}
49+}
50+
51+// Discard provides a mock function for the type GitRepos
52+func (_mock *GitRepos) Discard(ctx context.Context, id ports.StagedID) error {
53+ ret := _mock.Called(ctx, id)
54+
55+ if len(ret) == 0 {
56+ panic("no return value specified for Discard")
57+ }
58+
59+ var r0 error
60+ if returnFunc, ok := ret.Get(0).(func(context.Context, ports.StagedID) error); ok {
61+ r0 = returnFunc(ctx, id)
62+ } else {
63+ r0 = ret.Error(0)
64+ }
65+ return r0
66+}
67+
68+// GitRepos_Discard_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Discard'
69+type GitRepos_Discard_Call struct {
70+ *mock.Call
71+}
72+
73+// Discard is a helper method to define mock.On call
74+// - ctx context.Context
75+// - id ports.StagedID
76+func (_e *GitRepos_Expecter) Discard(ctx any, id any) *GitRepos_Discard_Call {
77+ return &GitRepos_Discard_Call{Call: _e.mock.On("Discard", ctx, id)}
78+}
79+
80+func (_c *GitRepos_Discard_Call) Run(run func(ctx context.Context, id ports.StagedID)) *GitRepos_Discard_Call {
81+ _c.Call.Run(func(args mock.Arguments) {
82+ var arg0 context.Context
83+ if args[0] != nil {
84+ arg0 = args[0].(context.Context)
85+ }
86+ var arg1 ports.StagedID
87+ if args[1] != nil {
88+ arg1 = args[1].(ports.StagedID)
89+ }
90+ run(
91+ arg0,
92+ arg1,
93+ )
94+ })
95+ return _c
96+}
97+
98+func (_c *GitRepos_Discard_Call) Return(err error) *GitRepos_Discard_Call {
99+ _c.Call.Return(err)
100+ return _c
101+}
102+
103+func (_c *GitRepos_Discard_Call) RunAndReturn(run func(ctx context.Context, id ports.StagedID) error) *GitRepos_Discard_Call {
104+ _c.Call.Return(run)
105+ return _c
106+}
107+
108+// List provides a mock function for the type GitRepos
109+func (_mock *GitRepos) List(ctx context.Context) (ports.RepoDirs, error) {
110+ ret := _mock.Called(ctx)
111+
112+ if len(ret) == 0 {
113+ panic("no return value specified for List")
114+ }
115+
116+ var r0 ports.RepoDirs
117+ var r1 error
118+ if returnFunc, ok := ret.Get(0).(func(context.Context) (ports.RepoDirs, error)); ok {
119+ return returnFunc(ctx)
120+ }
121+ if returnFunc, ok := ret.Get(0).(func(context.Context) ports.RepoDirs); ok {
122+ r0 = returnFunc(ctx)
123+ } else {
124+ r0 = ret.Get(0).(ports.RepoDirs)
125+ }
126+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
127+ r1 = returnFunc(ctx)
128+ } else {
129+ r1 = ret.Error(1)
130+ }
131+ return r0, r1
132+}
133+
134+// GitRepos_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List'
135+type GitRepos_List_Call struct {
136+ *mock.Call
137+}
138+
139+// List is a helper method to define mock.On call
140+// - ctx context.Context
141+func (_e *GitRepos_Expecter) List(ctx any) *GitRepos_List_Call {
142+ return &GitRepos_List_Call{Call: _e.mock.On("List", ctx)}
143+}
144+
145+func (_c *GitRepos_List_Call) Run(run func(ctx context.Context)) *GitRepos_List_Call {
146+ _c.Call.Run(func(args mock.Arguments) {
147+ var arg0 context.Context
148+ if args[0] != nil {
149+ arg0 = args[0].(context.Context)
150+ }
151+ run(
152+ arg0,
153+ )
154+ })
155+ return _c
156+}
157+
158+func (_c *GitRepos_List_Call) Return(repoDirs ports.RepoDirs, err error) *GitRepos_List_Call {
159+ _c.Call.Return(repoDirs, err)
160+ return _c
161+}
162+
163+func (_c *GitRepos_List_Call) RunAndReturn(run func(ctx context.Context) (ports.RepoDirs, error)) *GitRepos_List_Call {
164+ _c.Call.Return(run)
165+ return _c
166+}
167+
168+// Publish provides a mock function for the type GitRepos
169+func (_mock *GitRepos) Publish(ctx context.Context, id ports.StagedID, name domain.RepoName) error {
170+ ret := _mock.Called(ctx, id, name)
171+
172+ if len(ret) == 0 {
173+ panic("no return value specified for Publish")
174+ }
175+
176+ var r0 error
177+ if returnFunc, ok := ret.Get(0).(func(context.Context, ports.StagedID, domain.RepoName) error); ok {
178+ r0 = returnFunc(ctx, id, name)
179+ } else {
180+ r0 = ret.Error(0)
181+ }
182+ return r0
183+}
184+
185+// GitRepos_Publish_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Publish'
186+type GitRepos_Publish_Call struct {
187+ *mock.Call
188+}
189+
190+// Publish is a helper method to define mock.On call
191+// - ctx context.Context
192+// - id ports.StagedID
193+// - name domain.RepoName
194+func (_e *GitRepos_Expecter) Publish(ctx any, id any, name any) *GitRepos_Publish_Call {
195+ return &GitRepos_Publish_Call{Call: _e.mock.On("Publish", ctx, id, name)}
196+}
197+
198+func (_c *GitRepos_Publish_Call) Run(run func(ctx context.Context, id ports.StagedID, name domain.RepoName)) *GitRepos_Publish_Call {
199+ _c.Call.Run(func(args mock.Arguments) {
200+ var arg0 context.Context
201+ if args[0] != nil {
202+ arg0 = args[0].(context.Context)
203+ }
204+ var arg1 ports.StagedID
205+ if args[1] != nil {
206+ arg1 = args[1].(ports.StagedID)
207+ }
208+ var arg2 domain.RepoName
209+ if args[2] != nil {
210+ arg2 = args[2].(domain.RepoName)
211+ }
212+ run(
213+ arg0,
214+ arg1,
215+ arg2,
216+ )
217+ })
218+ return _c
219+}
220+
221+func (_c *GitRepos_Publish_Call) Return(err error) *GitRepos_Publish_Call {
222+ _c.Call.Return(err)
223+ return _c
224+}
225+
226+func (_c *GitRepos_Publish_Call) RunAndReturn(run func(ctx context.Context, id ports.StagedID, name domain.RepoName) error) *GitRepos_Publish_Call {
227+ _c.Call.Return(run)
228+ return _c
229+}
230+
231+// PurgeStaging provides a mock function for the type GitRepos
232+func (_mock *GitRepos) PurgeStaging(ctx context.Context) error {
233+ ret := _mock.Called(ctx)
234+
235+ if len(ret) == 0 {
236+ panic("no return value specified for PurgeStaging")
237+ }
238+
239+ var r0 error
240+ if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok {
241+ r0 = returnFunc(ctx)
242+ } else {
243+ r0 = ret.Error(0)
244+ }
245+ return r0
246+}
247+
248+// GitRepos_PurgeStaging_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PurgeStaging'
249+type GitRepos_PurgeStaging_Call struct {
250+ *mock.Call
251+}
252+
253+// PurgeStaging is a helper method to define mock.On call
254+// - ctx context.Context
255+func (_e *GitRepos_Expecter) PurgeStaging(ctx any) *GitRepos_PurgeStaging_Call {
256+ return &GitRepos_PurgeStaging_Call{Call: _e.mock.On("PurgeStaging", ctx)}
257+}
258+
259+func (_c *GitRepos_PurgeStaging_Call) Run(run func(ctx context.Context)) *GitRepos_PurgeStaging_Call {
260+ _c.Call.Run(func(args mock.Arguments) {
261+ var arg0 context.Context
262+ if args[0] != nil {
263+ arg0 = args[0].(context.Context)
264+ }
265+ run(
266+ arg0,
267+ )
268+ })
269+ return _c
270+}
271+
272+func (_c *GitRepos_PurgeStaging_Call) Return(err error) *GitRepos_PurgeStaging_Call {
273+ _c.Call.Return(err)
274+ return _c
275+}
276+
277+func (_c *GitRepos_PurgeStaging_Call) RunAndReturn(run func(ctx context.Context) error) *GitRepos_PurgeStaging_Call {
278+ _c.Call.Return(run)
279+ return _c
280+}
281+
282+// Stage provides a mock function for the type GitRepos
283+func (_mock *GitRepos) Stage(ctx context.Context) (ports.StagedID, error) {
284+ ret := _mock.Called(ctx)
285+
286+ if len(ret) == 0 {
287+ panic("no return value specified for Stage")
288+ }
289+
290+ var r0 ports.StagedID
291+ var r1 error
292+ if returnFunc, ok := ret.Get(0).(func(context.Context) (ports.StagedID, error)); ok {
293+ return returnFunc(ctx)
294+ }
295+ if returnFunc, ok := ret.Get(0).(func(context.Context) ports.StagedID); ok {
296+ r0 = returnFunc(ctx)
297+ } else {
298+ r0 = ret.Get(0).(ports.StagedID)
299+ }
300+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
301+ r1 = returnFunc(ctx)
302+ } else {
303+ r1 = ret.Error(1)
304+ }
305+ return r0, r1
306+}
307+
308+// GitRepos_Stage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stage'
309+type GitRepos_Stage_Call struct {
310+ *mock.Call
311+}
312+
313+// Stage is a helper method to define mock.On call
314+// - ctx context.Context
315+func (_e *GitRepos_Expecter) Stage(ctx any) *GitRepos_Stage_Call {
316+ return &GitRepos_Stage_Call{Call: _e.mock.On("Stage", ctx)}
317+}
318+
319+func (_c *GitRepos_Stage_Call) Run(run func(ctx context.Context)) *GitRepos_Stage_Call {
320+ _c.Call.Run(func(args mock.Arguments) {
321+ var arg0 context.Context
322+ if args[0] != nil {
323+ arg0 = args[0].(context.Context)
324+ }
325+ run(
326+ arg0,
327+ )
328+ })
329+ return _c
330+}
331+
332+func (_c *GitRepos_Stage_Call) Return(stagedID ports.StagedID, err error) *GitRepos_Stage_Call {
333+ _c.Call.Return(stagedID, err)
334+ return _c
335+}
336+
337+func (_c *GitRepos_Stage_Call) RunAndReturn(run func(ctx context.Context) (ports.StagedID, error)) *GitRepos_Stage_Call {
338+ _c.Call.Return(run)
339+ return _c
340+}
341+
342+// Trash provides a mock function for the type GitRepos
343+func (_mock *GitRepos) Trash(ctx context.Context, name domain.RepoName) error {
344+ ret := _mock.Called(ctx, name)
345+
346+ if len(ret) == 0 {
347+ panic("no return value specified for Trash")
348+ }
349+
350+ var r0 error
351+ if returnFunc, ok := ret.Get(0).(func(context.Context, domain.RepoName) error); ok {
352+ r0 = returnFunc(ctx, name)
353+ } else {
354+ r0 = ret.Error(0)
355+ }
356+ return r0
357+}
358+
359+// GitRepos_Trash_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Trash'
360+type GitRepos_Trash_Call struct {
361+ *mock.Call
362+}
363+
364+// Trash is a helper method to define mock.On call
365+// - ctx context.Context
366+// - name domain.RepoName
367+func (_e *GitRepos_Expecter) Trash(ctx any, name any) *GitRepos_Trash_Call {
368+ return &GitRepos_Trash_Call{Call: _e.mock.On("Trash", ctx, name)}
369+}
370+
371+func (_c *GitRepos_Trash_Call) Run(run func(ctx context.Context, name domain.RepoName)) *GitRepos_Trash_Call {
372+ _c.Call.Run(func(args mock.Arguments) {
373+ var arg0 context.Context
374+ if args[0] != nil {
375+ arg0 = args[0].(context.Context)
376+ }
377+ var arg1 domain.RepoName
378+ if args[1] != nil {
379+ arg1 = args[1].(domain.RepoName)
380+ }
381+ run(
382+ arg0,
383+ arg1,
384+ )
385+ })
386+ return _c
387+}
388+
389+func (_c *GitRepos_Trash_Call) Return(err error) *GitRepos_Trash_Call {
390+ _c.Call.Return(err)
391+ return _c
392+}
393+
394+func (_c *GitRepos_Trash_Call) RunAndReturn(run func(ctx context.Context, name domain.RepoName) error) *GitRepos_Trash_Call {
395+ _c.Call.Return(run)
396+ return _c
397+}
@@ -0,0 +1,397 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "bnema.dev/ermite/internal/domain"
11+ "bnema.dev/ermite/internal/ports"
12+ mock "github.com/stretchr/testify/mock"
13+)
14+
15+// NewGitRepos creates a new instance of GitRepos. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
16+// The first argument is typically a *testing.T value.
17+func NewGitRepos(t interface {
18+ mock.TestingT
19+ Cleanup(func())
20+}) *GitRepos {
21+ if helper, ok := t.(interface{ Helper() }); ok {
22+ helper.Helper()
23+ }
24+
25+ mock := &GitRepos{}
26+ mock.Mock.Test(t)
27+
28+ t.Cleanup(func() {
29+ if helper, ok := t.(interface{ Helper() }); ok {
30+ helper.Helper()
31+ }
32+ mock.AssertExpectations(t)
33+ })
34+
35+ return mock
36+}
37+
38+// GitRepos is an autogenerated mock type for the GitRepos type
39+type GitRepos struct {
40+ mock.Mock
41+}
42+
43+type GitRepos_Expecter struct {
44+ mock *mock.Mock
45+}
46+
47+func (_m *GitRepos) EXPECT() *GitRepos_Expecter {
48+ return &GitRepos_Expecter{mock: &_m.Mock}
49+}
50+
51+// Discard provides a mock function for the type GitRepos
52+func (_mock *GitRepos) Discard(ctx context.Context, id ports.StagedID) error {
53+ ret := _mock.Called(ctx, id)
54+
55+ if len(ret) == 0 {
56+ panic("no return value specified for Discard")
57+ }
58+
59+ var r0 error
60+ if returnFunc, ok := ret.Get(0).(func(context.Context, ports.StagedID) error); ok {
61+ r0 = returnFunc(ctx, id)
62+ } else {
63+ r0 = ret.Error(0)
64+ }
65+ return r0
66+}
67+
68+// GitRepos_Discard_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Discard'
69+type GitRepos_Discard_Call struct {
70+ *mock.Call
71+}
72+
73+// Discard is a helper method to define mock.On call
74+// - ctx context.Context
75+// - id ports.StagedID
76+func (_e *GitRepos_Expecter) Discard(ctx any, id any) *GitRepos_Discard_Call {
77+ return &GitRepos_Discard_Call{Call: _e.mock.On("Discard", ctx, id)}
78+}
79+
80+func (_c *GitRepos_Discard_Call) Run(run func(ctx context.Context, id ports.StagedID)) *GitRepos_Discard_Call {
81+ _c.Call.Run(func(args mock.Arguments) {
82+ var arg0 context.Context
83+ if args[0] != nil {
84+ arg0 = args[0].(context.Context)
85+ }
86+ var arg1 ports.StagedID
87+ if args[1] != nil {
88+ arg1 = args[1].(ports.StagedID)
89+ }
90+ run(
91+ arg0,
92+ arg1,
93+ )
94+ })
95+ return _c
96+}
97+
98+func (_c *GitRepos_Discard_Call) Return(err error) *GitRepos_Discard_Call {
99+ _c.Call.Return(err)
100+ return _c
101+}
102+
103+func (_c *GitRepos_Discard_Call) RunAndReturn(run func(ctx context.Context, id ports.StagedID) error) *GitRepos_Discard_Call {
104+ _c.Call.Return(run)
105+ return _c
106+}
107+
108+// List provides a mock function for the type GitRepos
109+func (_mock *GitRepos) List(ctx context.Context) (ports.RepoDirs, error) {
110+ ret := _mock.Called(ctx)
111+
112+ if len(ret) == 0 {
113+ panic("no return value specified for List")
114+ }
115+
116+ var r0 ports.RepoDirs
117+ var r1 error
118+ if returnFunc, ok := ret.Get(0).(func(context.Context) (ports.RepoDirs, error)); ok {
119+ return returnFunc(ctx)
120+ }
121+ if returnFunc, ok := ret.Get(0).(func(context.Context) ports.RepoDirs); ok {
122+ r0 = returnFunc(ctx)
123+ } else {
124+ r0 = ret.Get(0).(ports.RepoDirs)
125+ }
126+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
127+ r1 = returnFunc(ctx)
128+ } else {
129+ r1 = ret.Error(1)
130+ }
131+ return r0, r1
132+}
133+
134+// GitRepos_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List'
135+type GitRepos_List_Call struct {
136+ *mock.Call
137+}
138+
139+// List is a helper method to define mock.On call
140+// - ctx context.Context
141+func (_e *GitRepos_Expecter) List(ctx any) *GitRepos_List_Call {
142+ return &GitRepos_List_Call{Call: _e.mock.On("List", ctx)}
143+}
144+
145+func (_c *GitRepos_List_Call) Run(run func(ctx context.Context)) *GitRepos_List_Call {
146+ _c.Call.Run(func(args mock.Arguments) {
147+ var arg0 context.Context
148+ if args[0] != nil {
149+ arg0 = args[0].(context.Context)
150+ }
151+ run(
152+ arg0,
153+ )
154+ })
155+ return _c
156+}
157+
158+func (_c *GitRepos_List_Call) Return(repoDirs ports.RepoDirs, err error) *GitRepos_List_Call {
159+ _c.Call.Return(repoDirs, err)
160+ return _c
161+}
162+
163+func (_c *GitRepos_List_Call) RunAndReturn(run func(ctx context.Context) (ports.RepoDirs, error)) *GitRepos_List_Call {
164+ _c.Call.Return(run)
165+ return _c
166+}
167+
168+// Publish provides a mock function for the type GitRepos
169+func (_mock *GitRepos) Publish(ctx context.Context, id ports.StagedID, name domain.RepoName) error {
170+ ret := _mock.Called(ctx, id, name)
171+
172+ if len(ret) == 0 {
173+ panic("no return value specified for Publish")
174+ }
175+
176+ var r0 error
177+ if returnFunc, ok := ret.Get(0).(func(context.Context, ports.StagedID, domain.RepoName) error); ok {
178+ r0 = returnFunc(ctx, id, name)
179+ } else {
180+ r0 = ret.Error(0)
181+ }
182+ return r0
183+}
184+
185+// GitRepos_Publish_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Publish'
186+type GitRepos_Publish_Call struct {
187+ *mock.Call
188+}
189+
190+// Publish is a helper method to define mock.On call
191+// - ctx context.Context
192+// - id ports.StagedID
193+// - name domain.RepoName
194+func (_e *GitRepos_Expecter) Publish(ctx any, id any, name any) *GitRepos_Publish_Call {
195+ return &GitRepos_Publish_Call{Call: _e.mock.On("Publish", ctx, id, name)}
196+}
197+
198+func (_c *GitRepos_Publish_Call) Run(run func(ctx context.Context, id ports.StagedID, name domain.RepoName)) *GitRepos_Publish_Call {
199+ _c.Call.Run(func(args mock.Arguments) {
200+ var arg0 context.Context
201+ if args[0] != nil {
202+ arg0 = args[0].(context.Context)
203+ }
204+ var arg1 ports.StagedID
205+ if args[1] != nil {
206+ arg1 = args[1].(ports.StagedID)
207+ }
208+ var arg2 domain.RepoName
209+ if args[2] != nil {
210+ arg2 = args[2].(domain.RepoName)
211+ }
212+ run(
213+ arg0,
214+ arg1,
215+ arg2,
216+ )
217+ })
218+ return _c
219+}
220+
221+func (_c *GitRepos_Publish_Call) Return(err error) *GitRepos_Publish_Call {
222+ _c.Call.Return(err)
223+ return _c
224+}
225+
226+func (_c *GitRepos_Publish_Call) RunAndReturn(run func(ctx context.Context, id ports.StagedID, name domain.RepoName) error) *GitRepos_Publish_Call {
227+ _c.Call.Return(run)
228+ return _c
229+}
230+
231+// PurgeStaging provides a mock function for the type GitRepos
232+func (_mock *GitRepos) PurgeStaging(ctx context.Context) error {
233+ ret := _mock.Called(ctx)
234+
235+ if len(ret) == 0 {
236+ panic("no return value specified for PurgeStaging")
237+ }
238+
239+ var r0 error
240+ if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok {
241+ r0 = returnFunc(ctx)
242+ } else {
243+ r0 = ret.Error(0)
244+ }
245+ return r0
246+}
247+
248+// GitRepos_PurgeStaging_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PurgeStaging'
249+type GitRepos_PurgeStaging_Call struct {
250+ *mock.Call
251+}
252+
253+// PurgeStaging is a helper method to define mock.On call
254+// - ctx context.Context
255+func (_e *GitRepos_Expecter) PurgeStaging(ctx any) *GitRepos_PurgeStaging_Call {
256+ return &GitRepos_PurgeStaging_Call{Call: _e.mock.On("PurgeStaging", ctx)}
257+}
258+
259+func (_c *GitRepos_PurgeStaging_Call) Run(run func(ctx context.Context)) *GitRepos_PurgeStaging_Call {
260+ _c.Call.Run(func(args mock.Arguments) {
261+ var arg0 context.Context
262+ if args[0] != nil {
263+ arg0 = args[0].(context.Context)
264+ }
265+ run(
266+ arg0,
267+ )
268+ })
269+ return _c
270+}
271+
272+func (_c *GitRepos_PurgeStaging_Call) Return(err error) *GitRepos_PurgeStaging_Call {
273+ _c.Call.Return(err)
274+ return _c
275+}
276+
277+func (_c *GitRepos_PurgeStaging_Call) RunAndReturn(run func(ctx context.Context) error) *GitRepos_PurgeStaging_Call {
278+ _c.Call.Return(run)
279+ return _c
280+}
281+
282+// Stage provides a mock function for the type GitRepos
283+func (_mock *GitRepos) Stage(ctx context.Context) (ports.StagedID, error) {
284+ ret := _mock.Called(ctx)
285+
286+ if len(ret) == 0 {
287+ panic("no return value specified for Stage")
288+ }
289+
290+ var r0 ports.StagedID
291+ var r1 error
292+ if returnFunc, ok := ret.Get(0).(func(context.Context) (ports.StagedID, error)); ok {
293+ return returnFunc(ctx)
294+ }
295+ if returnFunc, ok := ret.Get(0).(func(context.Context) ports.StagedID); ok {
296+ r0 = returnFunc(ctx)
297+ } else {
298+ r0 = ret.Get(0).(ports.StagedID)
299+ }
300+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
301+ r1 = returnFunc(ctx)
302+ } else {
303+ r1 = ret.Error(1)
304+ }
305+ return r0, r1
306+}
307+
308+// GitRepos_Stage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stage'
309+type GitRepos_Stage_Call struct {
310+ *mock.Call
311+}
312+
313+// Stage is a helper method to define mock.On call
314+// - ctx context.Context
315+func (_e *GitRepos_Expecter) Stage(ctx any) *GitRepos_Stage_Call {
316+ return &GitRepos_Stage_Call{Call: _e.mock.On("Stage", ctx)}
317+}
318+
319+func (_c *GitRepos_Stage_Call) Run(run func(ctx context.Context)) *GitRepos_Stage_Call {
320+ _c.Call.Run(func(args mock.Arguments) {
321+ var arg0 context.Context
322+ if args[0] != nil {
323+ arg0 = args[0].(context.Context)
324+ }
325+ run(
326+ arg0,
327+ )
328+ })
329+ return _c
330+}
331+
332+func (_c *GitRepos_Stage_Call) Return(stagedID ports.StagedID, err error) *GitRepos_Stage_Call {
333+ _c.Call.Return(stagedID, err)
334+ return _c
335+}
336+
337+func (_c *GitRepos_Stage_Call) RunAndReturn(run func(ctx context.Context) (ports.StagedID, error)) *GitRepos_Stage_Call {
338+ _c.Call.Return(run)
339+ return _c
340+}
341+
342+// Trash provides a mock function for the type GitRepos
343+func (_mock *GitRepos) Trash(ctx context.Context, name domain.RepoName) error {
344+ ret := _mock.Called(ctx, name)
345+
346+ if len(ret) == 0 {
347+ panic("no return value specified for Trash")
348+ }
349+
350+ var r0 error
351+ if returnFunc, ok := ret.Get(0).(func(context.Context, domain.RepoName) error); ok {
352+ r0 = returnFunc(ctx, name)
353+ } else {
354+ r0 = ret.Error(0)
355+ }
356+ return r0
357+}
358+
359+// GitRepos_Trash_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Trash'
360+type GitRepos_Trash_Call struct {
361+ *mock.Call
362+}
363+
364+// Trash is a helper method to define mock.On call
365+// - ctx context.Context
366+// - name domain.RepoName
367+func (_e *GitRepos_Expecter) Trash(ctx any, name any) *GitRepos_Trash_Call {
368+ return &GitRepos_Trash_Call{Call: _e.mock.On("Trash", ctx, name)}
369+}
370+
371+func (_c *GitRepos_Trash_Call) Run(run func(ctx context.Context, name domain.RepoName)) *GitRepos_Trash_Call {
372+ _c.Call.Run(func(args mock.Arguments) {
373+ var arg0 context.Context
374+ if args[0] != nil {
375+ arg0 = args[0].(context.Context)
376+ }
377+ var arg1 domain.RepoName
378+ if args[1] != nil {
379+ arg1 = args[1].(domain.RepoName)
380+ }
381+ run(
382+ arg0,
383+ arg1,
384+ )
385+ })
386+ return _c
387+}
388+
389+func (_c *GitRepos_Trash_Call) Return(err error) *GitRepos_Trash_Call {
390+ _c.Call.Return(err)
391+ return _c
392+}
393+
394+func (_c *GitRepos_Trash_Call) RunAndReturn(run func(ctx context.Context, name domain.RepoName) error) *GitRepos_Trash_Call {
395+ _c.Call.Return(run)
396+ return _c
397+}
A internal/ports/mocks/RepoMetaStore.go +347 -0
@@ -0,0 +1,347 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "bnema.dev/ermite/internal/domain"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewRepoMetaStore creates a new instance of RepoMetaStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewRepoMetaStore(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *RepoMetaStore {
20+ if helper, ok := t.(interface{ Helper() }); ok {
21+ helper.Helper()
22+ }
23+
24+ mock := &RepoMetaStore{}
25+ mock.Mock.Test(t)
26+
27+ t.Cleanup(func() {
28+ if helper, ok := t.(interface{ Helper() }); ok {
29+ helper.Helper()
30+ }
31+ mock.AssertExpectations(t)
32+ })
33+
34+ return mock
35+}
36+
37+// RepoMetaStore is an autogenerated mock type for the RepoMetaStore type
38+type RepoMetaStore struct {
39+ mock.Mock
40+}
41+
42+type RepoMetaStore_Expecter struct {
43+ mock *mock.Mock
44+}
45+
46+func (_m *RepoMetaStore) EXPECT() *RepoMetaStore_Expecter {
47+ return &RepoMetaStore_Expecter{mock: &_m.Mock}
48+}
49+
50+// Create provides a mock function for the type RepoMetaStore
51+func (_mock *RepoMetaStore) Create(ctx context.Context, repo domain.Repo) error {
52+ ret := _mock.Called(ctx, repo)
53+
54+ if len(ret) == 0 {
55+ panic("no return value specified for Create")
56+ }
57+
58+ var r0 error
59+ if returnFunc, ok := ret.Get(0).(func(context.Context, domain.Repo) error); ok {
60+ r0 = returnFunc(ctx, repo)
61+ } else {
62+ r0 = ret.Error(0)
63+ }
64+ return r0
65+}
66+
67+// RepoMetaStore_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create'
68+type RepoMetaStore_Create_Call struct {
69+ *mock.Call
70+}
71+
72+// Create is a helper method to define mock.On call
73+// - ctx context.Context
74+// - repo domain.Repo
75+func (_e *RepoMetaStore_Expecter) Create(ctx any, repo any) *RepoMetaStore_Create_Call {
76+ return &RepoMetaStore_Create_Call{Call: _e.mock.On("Create", ctx, repo)}
77+}
78+
79+func (_c *RepoMetaStore_Create_Call) Run(run func(ctx context.Context, repo domain.Repo)) *RepoMetaStore_Create_Call {
80+ _c.Call.Run(func(args mock.Arguments) {
81+ var arg0 context.Context
82+ if args[0] != nil {
83+ arg0 = args[0].(context.Context)
84+ }
85+ var arg1 domain.Repo
86+ if args[1] != nil {
87+ arg1 = args[1].(domain.Repo)
88+ }
89+ run(
90+ arg0,
91+ arg1,
92+ )
93+ })
94+ return _c
95+}
96+
97+func (_c *RepoMetaStore_Create_Call) Return(err error) *RepoMetaStore_Create_Call {
98+ _c.Call.Return(err)
99+ return _c
100+}
101+
102+func (_c *RepoMetaStore_Create_Call) RunAndReturn(run func(ctx context.Context, repo domain.Repo) error) *RepoMetaStore_Create_Call {
103+ _c.Call.Return(run)
104+ return _c
105+}
106+
107+// Delete provides a mock function for the type RepoMetaStore
108+func (_mock *RepoMetaStore) Delete(ctx context.Context, name domain.RepoName) error {
109+ ret := _mock.Called(ctx, name)
110+
111+ if len(ret) == 0 {
112+ panic("no return value specified for Delete")
113+ }
114+
115+ var r0 error
116+ if returnFunc, ok := ret.Get(0).(func(context.Context, domain.RepoName) error); ok {
117+ r0 = returnFunc(ctx, name)
118+ } else {
119+ r0 = ret.Error(0)
120+ }
121+ return r0
122+}
123+
124+// RepoMetaStore_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
125+type RepoMetaStore_Delete_Call struct {
126+ *mock.Call
127+}
128+
129+// Delete is a helper method to define mock.On call
130+// - ctx context.Context
131+// - name domain.RepoName
132+func (_e *RepoMetaStore_Expecter) Delete(ctx any, name any) *RepoMetaStore_Delete_Call {
133+ return &RepoMetaStore_Delete_Call{Call: _e.mock.On("Delete", ctx, name)}
134+}
135+
136+func (_c *RepoMetaStore_Delete_Call) Run(run func(ctx context.Context, name domain.RepoName)) *RepoMetaStore_Delete_Call {
137+ _c.Call.Run(func(args mock.Arguments) {
138+ var arg0 context.Context
139+ if args[0] != nil {
140+ arg0 = args[0].(context.Context)
141+ }
142+ var arg1 domain.RepoName
143+ if args[1] != nil {
144+ arg1 = args[1].(domain.RepoName)
145+ }
146+ run(
147+ arg0,
148+ arg1,
149+ )
150+ })
151+ return _c
152+}
153+
154+func (_c *RepoMetaStore_Delete_Call) Return(err error) *RepoMetaStore_Delete_Call {
155+ _c.Call.Return(err)
156+ return _c
157+}
158+
159+func (_c *RepoMetaStore_Delete_Call) RunAndReturn(run func(ctx context.Context, name domain.RepoName) error) *RepoMetaStore_Delete_Call {
160+ _c.Call.Return(run)
161+ return _c
162+}
163+
164+// Get provides a mock function for the type RepoMetaStore
165+func (_mock *RepoMetaStore) Get(ctx context.Context, name domain.RepoName) (domain.Repo, error) {
166+ ret := _mock.Called(ctx, name)
167+
168+ if len(ret) == 0 {
169+ panic("no return value specified for Get")
170+ }
171+
172+ var r0 domain.Repo
173+ var r1 error
174+ if returnFunc, ok := ret.Get(0).(func(context.Context, domain.RepoName) (domain.Repo, error)); ok {
175+ return returnFunc(ctx, name)
176+ }
177+ if returnFunc, ok := ret.Get(0).(func(context.Context, domain.RepoName) domain.Repo); ok {
178+ r0 = returnFunc(ctx, name)
179+ } else {
180+ r0 = ret.Get(0).(domain.Repo)
181+ }
182+ if returnFunc, ok := ret.Get(1).(func(context.Context, domain.RepoName) error); ok {
183+ r1 = returnFunc(ctx, name)
184+ } else {
185+ r1 = ret.Error(1)
186+ }
187+ return r0, r1
188+}
189+
190+// RepoMetaStore_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
191+type RepoMetaStore_Get_Call struct {
192+ *mock.Call
193+}
194+
195+// Get is a helper method to define mock.On call
196+// - ctx context.Context
197+// - name domain.RepoName
198+func (_e *RepoMetaStore_Expecter) Get(ctx any, name any) *RepoMetaStore_Get_Call {
199+ return &RepoMetaStore_Get_Call{Call: _e.mock.On("Get", ctx, name)}
200+}
201+
202+func (_c *RepoMetaStore_Get_Call) Run(run func(ctx context.Context, name domain.RepoName)) *RepoMetaStore_Get_Call {
203+ _c.Call.Run(func(args mock.Arguments) {
204+ var arg0 context.Context
205+ if args[0] != nil {
206+ arg0 = args[0].(context.Context)
207+ }
208+ var arg1 domain.RepoName
209+ if args[1] != nil {
210+ arg1 = args[1].(domain.RepoName)
211+ }
212+ run(
213+ arg0,
214+ arg1,
215+ )
216+ })
217+ return _c
218+}
219+
220+func (_c *RepoMetaStore_Get_Call) Return(repo domain.Repo, err error) *RepoMetaStore_Get_Call {
221+ _c.Call.Return(repo, err)
222+ return _c
223+}
224+
225+func (_c *RepoMetaStore_Get_Call) RunAndReturn(run func(ctx context.Context, name domain.RepoName) (domain.Repo, error)) *RepoMetaStore_Get_Call {
226+ _c.Call.Return(run)
227+ return _c
228+}
229+
230+// List provides a mock function for the type RepoMetaStore
231+func (_mock *RepoMetaStore) List(ctx context.Context) ([]domain.Repo, error) {
232+ ret := _mock.Called(ctx)
233+
234+ if len(ret) == 0 {
235+ panic("no return value specified for List")
236+ }
237+
238+ var r0 []domain.Repo
239+ var r1 error
240+ if returnFunc, ok := ret.Get(0).(func(context.Context) ([]domain.Repo, error)); ok {
241+ return returnFunc(ctx)
242+ }
243+ if returnFunc, ok := ret.Get(0).(func(context.Context) []domain.Repo); ok {
244+ r0 = returnFunc(ctx)
245+ } else {
246+ if ret.Get(0) != nil {
247+ r0 = ret.Get(0).([]domain.Repo)
248+ }
249+ }
250+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
251+ r1 = returnFunc(ctx)
252+ } else {
253+ r1 = ret.Error(1)
254+ }
255+ return r0, r1
256+}
257+
258+// RepoMetaStore_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List'
259+type RepoMetaStore_List_Call struct {
260+ *mock.Call
261+}
262+
263+// List is a helper method to define mock.On call
264+// - ctx context.Context
265+func (_e *RepoMetaStore_Expecter) List(ctx any) *RepoMetaStore_List_Call {
266+ return &RepoMetaStore_List_Call{Call: _e.mock.On("List", ctx)}
267+}
268+
269+func (_c *RepoMetaStore_List_Call) Run(run func(ctx context.Context)) *RepoMetaStore_List_Call {
270+ _c.Call.Run(func(args mock.Arguments) {
271+ var arg0 context.Context
272+ if args[0] != nil {
273+ arg0 = args[0].(context.Context)
274+ }
275+ run(
276+ arg0,
277+ )
278+ })
279+ return _c
280+}
281+
282+func (_c *RepoMetaStore_List_Call) Return(repos []domain.Repo, err error) *RepoMetaStore_List_Call {
283+ _c.Call.Return(repos, err)
284+ return _c
285+}
286+
287+func (_c *RepoMetaStore_List_Call) RunAndReturn(run func(ctx context.Context) ([]domain.Repo, error)) *RepoMetaStore_List_Call {
288+ _c.Call.Return(run)
289+ return _c
290+}
291+
292+// Update provides a mock function for the type RepoMetaStore
293+func (_mock *RepoMetaStore) Update(ctx context.Context, repo domain.Repo) error {
294+ ret := _mock.Called(ctx, repo)
295+
296+ if len(ret) == 0 {
297+ panic("no return value specified for Update")
298+ }
299+
300+ var r0 error
301+ if returnFunc, ok := ret.Get(0).(func(context.Context, domain.Repo) error); ok {
302+ r0 = returnFunc(ctx, repo)
303+ } else {
304+ r0 = ret.Error(0)
305+ }
306+ return r0
307+}
308+
309+// RepoMetaStore_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update'
310+type RepoMetaStore_Update_Call struct {
311+ *mock.Call
312+}
313+
314+// Update is a helper method to define mock.On call
315+// - ctx context.Context
316+// - repo domain.Repo
317+func (_e *RepoMetaStore_Expecter) Update(ctx any, repo any) *RepoMetaStore_Update_Call {
318+ return &RepoMetaStore_Update_Call{Call: _e.mock.On("Update", ctx, repo)}
319+}
320+
321+func (_c *RepoMetaStore_Update_Call) Run(run func(ctx context.Context, repo domain.Repo)) *RepoMetaStore_Update_Call {
322+ _c.Call.Run(func(args mock.Arguments) {
323+ var arg0 context.Context
324+ if args[0] != nil {
325+ arg0 = args[0].(context.Context)
326+ }
327+ var arg1 domain.Repo
328+ if args[1] != nil {
329+ arg1 = args[1].(domain.Repo)
330+ }
331+ run(
332+ arg0,
333+ arg1,
334+ )
335+ })
336+ return _c
337+}
338+
339+func (_c *RepoMetaStore_Update_Call) Return(err error) *RepoMetaStore_Update_Call {
340+ _c.Call.Return(err)
341+ return _c
342+}
343+
344+func (_c *RepoMetaStore_Update_Call) RunAndReturn(run func(ctx context.Context, repo domain.Repo) error) *RepoMetaStore_Update_Call {
345+ _c.Call.Return(run)
346+ return _c
347+}
@@ -0,0 +1,347 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "bnema.dev/ermite/internal/domain"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewRepoMetaStore creates a new instance of RepoMetaStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewRepoMetaStore(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *RepoMetaStore {
20+ if helper, ok := t.(interface{ Helper() }); ok {
21+ helper.Helper()
22+ }
23+
24+ mock := &RepoMetaStore{}
25+ mock.Mock.Test(t)
26+
27+ t.Cleanup(func() {
28+ if helper, ok := t.(interface{ Helper() }); ok {
29+ helper.Helper()
30+ }
31+ mock.AssertExpectations(t)
32+ })
33+
34+ return mock
35+}
36+
37+// RepoMetaStore is an autogenerated mock type for the RepoMetaStore type
38+type RepoMetaStore struct {
39+ mock.Mock
40+}
41+
42+type RepoMetaStore_Expecter struct {
43+ mock *mock.Mock
44+}
45+
46+func (_m *RepoMetaStore) EXPECT() *RepoMetaStore_Expecter {
47+ return &RepoMetaStore_Expecter{mock: &_m.Mock}
48+}
49+
50+// Create provides a mock function for the type RepoMetaStore
51+func (_mock *RepoMetaStore) Create(ctx context.Context, repo domain.Repo) error {
52+ ret := _mock.Called(ctx, repo)
53+
54+ if len(ret) == 0 {
55+ panic("no return value specified for Create")
56+ }
57+
58+ var r0 error
59+ if returnFunc, ok := ret.Get(0).(func(context.Context, domain.Repo) error); ok {
60+ r0 = returnFunc(ctx, repo)
61+ } else {
62+ r0 = ret.Error(0)
63+ }
64+ return r0
65+}
66+
67+// RepoMetaStore_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create'
68+type RepoMetaStore_Create_Call struct {
69+ *mock.Call
70+}
71+
72+// Create is a helper method to define mock.On call
73+// - ctx context.Context
74+// - repo domain.Repo
75+func (_e *RepoMetaStore_Expecter) Create(ctx any, repo any) *RepoMetaStore_Create_Call {
76+ return &RepoMetaStore_Create_Call{Call: _e.mock.On("Create", ctx, repo)}
77+}
78+
79+func (_c *RepoMetaStore_Create_Call) Run(run func(ctx context.Context, repo domain.Repo)) *RepoMetaStore_Create_Call {
80+ _c.Call.Run(func(args mock.Arguments) {
81+ var arg0 context.Context
82+ if args[0] != nil {
83+ arg0 = args[0].(context.Context)
84+ }
85+ var arg1 domain.Repo
86+ if args[1] != nil {
87+ arg1 = args[1].(domain.Repo)
88+ }
89+ run(
90+ arg0,
91+ arg1,
92+ )
93+ })
94+ return _c
95+}
96+
97+func (_c *RepoMetaStore_Create_Call) Return(err error) *RepoMetaStore_Create_Call {
98+ _c.Call.Return(err)
99+ return _c
100+}
101+
102+func (_c *RepoMetaStore_Create_Call) RunAndReturn(run func(ctx context.Context, repo domain.Repo) error) *RepoMetaStore_Create_Call {
103+ _c.Call.Return(run)
104+ return _c
105+}
106+
107+// Delete provides a mock function for the type RepoMetaStore
108+func (_mock *RepoMetaStore) Delete(ctx context.Context, name domain.RepoName) error {
109+ ret := _mock.Called(ctx, name)
110+
111+ if len(ret) == 0 {
112+ panic("no return value specified for Delete")
113+ }
114+
115+ var r0 error
116+ if returnFunc, ok := ret.Get(0).(func(context.Context, domain.RepoName) error); ok {
117+ r0 = returnFunc(ctx, name)
118+ } else {
119+ r0 = ret.Error(0)
120+ }
121+ return r0
122+}
123+
124+// RepoMetaStore_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
125+type RepoMetaStore_Delete_Call struct {
126+ *mock.Call
127+}
128+
129+// Delete is a helper method to define mock.On call
130+// - ctx context.Context
131+// - name domain.RepoName
132+func (_e *RepoMetaStore_Expecter) Delete(ctx any, name any) *RepoMetaStore_Delete_Call {
133+ return &RepoMetaStore_Delete_Call{Call: _e.mock.On("Delete", ctx, name)}
134+}
135+
136+func (_c *RepoMetaStore_Delete_Call) Run(run func(ctx context.Context, name domain.RepoName)) *RepoMetaStore_Delete_Call {
137+ _c.Call.Run(func(args mock.Arguments) {
138+ var arg0 context.Context
139+ if args[0] != nil {
140+ arg0 = args[0].(context.Context)
141+ }
142+ var arg1 domain.RepoName
143+ if args[1] != nil {
144+ arg1 = args[1].(domain.RepoName)
145+ }
146+ run(
147+ arg0,
148+ arg1,
149+ )
150+ })
151+ return _c
152+}
153+
154+func (_c *RepoMetaStore_Delete_Call) Return(err error) *RepoMetaStore_Delete_Call {
155+ _c.Call.Return(err)
156+ return _c
157+}
158+
159+func (_c *RepoMetaStore_Delete_Call) RunAndReturn(run func(ctx context.Context, name domain.RepoName) error) *RepoMetaStore_Delete_Call {
160+ _c.Call.Return(run)
161+ return _c
162+}
163+
164+// Get provides a mock function for the type RepoMetaStore
165+func (_mock *RepoMetaStore) Get(ctx context.Context, name domain.RepoName) (domain.Repo, error) {
166+ ret := _mock.Called(ctx, name)
167+
168+ if len(ret) == 0 {
169+ panic("no return value specified for Get")
170+ }
171+
172+ var r0 domain.Repo
173+ var r1 error
174+ if returnFunc, ok := ret.Get(0).(func(context.Context, domain.RepoName) (domain.Repo, error)); ok {
175+ return returnFunc(ctx, name)
176+ }
177+ if returnFunc, ok := ret.Get(0).(func(context.Context, domain.RepoName) domain.Repo); ok {
178+ r0 = returnFunc(ctx, name)
179+ } else {
180+ r0 = ret.Get(0).(domain.Repo)
181+ }
182+ if returnFunc, ok := ret.Get(1).(func(context.Context, domain.RepoName) error); ok {
183+ r1 = returnFunc(ctx, name)
184+ } else {
185+ r1 = ret.Error(1)
186+ }
187+ return r0, r1
188+}
189+
190+// RepoMetaStore_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
191+type RepoMetaStore_Get_Call struct {
192+ *mock.Call
193+}
194+
195+// Get is a helper method to define mock.On call
196+// - ctx context.Context
197+// - name domain.RepoName
198+func (_e *RepoMetaStore_Expecter) Get(ctx any, name any) *RepoMetaStore_Get_Call {
199+ return &RepoMetaStore_Get_Call{Call: _e.mock.On("Get", ctx, name)}
200+}
201+
202+func (_c *RepoMetaStore_Get_Call) Run(run func(ctx context.Context, name domain.RepoName)) *RepoMetaStore_Get_Call {
203+ _c.Call.Run(func(args mock.Arguments) {
204+ var arg0 context.Context
205+ if args[0] != nil {
206+ arg0 = args[0].(context.Context)
207+ }
208+ var arg1 domain.RepoName
209+ if args[1] != nil {
210+ arg1 = args[1].(domain.RepoName)
211+ }
212+ run(
213+ arg0,
214+ arg1,
215+ )
216+ })
217+ return _c
218+}
219+
220+func (_c *RepoMetaStore_Get_Call) Return(repo domain.Repo, err error) *RepoMetaStore_Get_Call {
221+ _c.Call.Return(repo, err)
222+ return _c
223+}
224+
225+func (_c *RepoMetaStore_Get_Call) RunAndReturn(run func(ctx context.Context, name domain.RepoName) (domain.Repo, error)) *RepoMetaStore_Get_Call {
226+ _c.Call.Return(run)
227+ return _c
228+}
229+
230+// List provides a mock function for the type RepoMetaStore
231+func (_mock *RepoMetaStore) List(ctx context.Context) ([]domain.Repo, error) {
232+ ret := _mock.Called(ctx)
233+
234+ if len(ret) == 0 {
235+ panic("no return value specified for List")
236+ }
237+
238+ var r0 []domain.Repo
239+ var r1 error
240+ if returnFunc, ok := ret.Get(0).(func(context.Context) ([]domain.Repo, error)); ok {
241+ return returnFunc(ctx)
242+ }
243+ if returnFunc, ok := ret.Get(0).(func(context.Context) []domain.Repo); ok {
244+ r0 = returnFunc(ctx)
245+ } else {
246+ if ret.Get(0) != nil {
247+ r0 = ret.Get(0).([]domain.Repo)
248+ }
249+ }
250+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
251+ r1 = returnFunc(ctx)
252+ } else {
253+ r1 = ret.Error(1)
254+ }
255+ return r0, r1
256+}
257+
258+// RepoMetaStore_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List'
259+type RepoMetaStore_List_Call struct {
260+ *mock.Call
261+}
262+
263+// List is a helper method to define mock.On call
264+// - ctx context.Context
265+func (_e *RepoMetaStore_Expecter) List(ctx any) *RepoMetaStore_List_Call {
266+ return &RepoMetaStore_List_Call{Call: _e.mock.On("List", ctx)}
267+}
268+
269+func (_c *RepoMetaStore_List_Call) Run(run func(ctx context.Context)) *RepoMetaStore_List_Call {
270+ _c.Call.Run(func(args mock.Arguments) {
271+ var arg0 context.Context
272+ if args[0] != nil {
273+ arg0 = args[0].(context.Context)
274+ }
275+ run(
276+ arg0,
277+ )
278+ })
279+ return _c
280+}
281+
282+func (_c *RepoMetaStore_List_Call) Return(repos []domain.Repo, err error) *RepoMetaStore_List_Call {
283+ _c.Call.Return(repos, err)
284+ return _c
285+}
286+
287+func (_c *RepoMetaStore_List_Call) RunAndReturn(run func(ctx context.Context) ([]domain.Repo, error)) *RepoMetaStore_List_Call {
288+ _c.Call.Return(run)
289+ return _c
290+}
291+
292+// Update provides a mock function for the type RepoMetaStore
293+func (_mock *RepoMetaStore) Update(ctx context.Context, repo domain.Repo) error {
294+ ret := _mock.Called(ctx, repo)
295+
296+ if len(ret) == 0 {
297+ panic("no return value specified for Update")
298+ }
299+
300+ var r0 error
301+ if returnFunc, ok := ret.Get(0).(func(context.Context, domain.Repo) error); ok {
302+ r0 = returnFunc(ctx, repo)
303+ } else {
304+ r0 = ret.Error(0)
305+ }
306+ return r0
307+}
308+
309+// RepoMetaStore_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update'
310+type RepoMetaStore_Update_Call struct {
311+ *mock.Call
312+}
313+
314+// Update is a helper method to define mock.On call
315+// - ctx context.Context
316+// - repo domain.Repo
317+func (_e *RepoMetaStore_Expecter) Update(ctx any, repo any) *RepoMetaStore_Update_Call {
318+ return &RepoMetaStore_Update_Call{Call: _e.mock.On("Update", ctx, repo)}
319+}
320+
321+func (_c *RepoMetaStore_Update_Call) Run(run func(ctx context.Context, repo domain.Repo)) *RepoMetaStore_Update_Call {
322+ _c.Call.Run(func(args mock.Arguments) {
323+ var arg0 context.Context
324+ if args[0] != nil {
325+ arg0 = args[0].(context.Context)
326+ }
327+ var arg1 domain.Repo
328+ if args[1] != nil {
329+ arg1 = args[1].(domain.Repo)
330+ }
331+ run(
332+ arg0,
333+ arg1,
334+ )
335+ })
336+ return _c
337+}
338+
339+func (_c *RepoMetaStore_Update_Call) Return(err error) *RepoMetaStore_Update_Call {
340+ _c.Call.Return(err)
341+ return _c
342+}
343+
344+func (_c *RepoMetaStore_Update_Call) RunAndReturn(run func(ctx context.Context, repo domain.Repo) error) *RepoMetaStore_Update_Call {
345+ _c.Call.Return(run)
346+ return _c
347+}
A internal/ports/ports.go +66 -0
@@ -0,0 +1,66 @@
1+// SPDX-License-Identifier: AGPL-3.0-or-later
2+
3+// Package ports declares the interfaces the use cases need from the outside
4+// world. Adapters implement them; cmd wires them.
5+package ports
6+
7+import (
8+ "context"
9+ "time"
10+
11+ "bnema.dev/ermite/internal/domain"
12+)
13+
14+//go:generate go tool mockery
15+
16+// RepoMetaStore keeps repository metadata. It is the source of truth for
17+// everything ermite owns about a repository except its Git data.
18+type RepoMetaStore interface {
19+ // Create stores repo. It returns domain.ErrAlreadyExists if a repository
20+ // with that name exists, including when a concurrent Create wins.
21+ Create(ctx context.Context, repo domain.Repo) error
22+ // Get returns the repository, or domain.ErrNotFound.
23+ Get(ctx context.Context, name domain.RepoName) (domain.Repo, error)
24+ // List returns every repository ordered by name.
25+ List(ctx context.Context) ([]domain.Repo, error)
26+ // Update replaces the stored repository, or returns domain.ErrNotFound.
27+ Update(ctx context.Context, repo domain.Repo) error
28+ // Delete removes the repository. Deleting a missing one is not an error.
29+ Delete(ctx context.Context, name domain.RepoName) error
30+}
31+
32+// StagedID identifies a repository being created. It is opaque to callers.
33+type StagedID string
34+
35+// RepoDirs is the result of listing the repository directories.
36+type RepoDirs struct {
37+ // Names are the directories that hold a valid repository name.
38+ Names []domain.RepoName
39+ // Invalid are the entries that cannot be a repository directory.
40+ Invalid []string
41+}
42+
43+// GitRepos manages bare repository directories.
44+type GitRepos interface {
45+ // Stage creates an empty bare repository outside the public directory
46+ // and returns its identifier.
47+ Stage(ctx context.Context) (StagedID, error)
48+ // Publish moves a staged repository to its final place under name. It
49+ // returns domain.ErrAlreadyExists if a directory for name exists; the
50+ // staged repository is left in place for Discard.
51+ Publish(ctx context.Context, id StagedID, name domain.RepoName) error
52+ // Discard removes a staged repository. A missing one is not an error.
53+ Discard(ctx context.Context, id StagedID) error
54+ // PurgeStaging removes every staged repository left by a previous run.
55+ PurgeStaging(ctx context.Context) error
56+ // List returns the repository directories.
57+ List(ctx context.Context) (RepoDirs, error)
58+ // Trash moves the repository directory to the trash, where it can be
59+ // recovered by hand. It returns domain.ErrNotFound if there is none.
60+ Trash(ctx context.Context, name domain.RepoName) error
61+}
62+
63+// Clock tells the time.
64+type Clock interface {
65+ Now() time.Time
66+}
@@ -0,0 +1,66 @@
1+// SPDX-License-Identifier: AGPL-3.0-or-later
2+
3+// Package ports declares the interfaces the use cases need from the outside
4+// world. Adapters implement them; cmd wires them.
5+package ports
6+
7+import (
8+ "context"
9+ "time"
10+
11+ "bnema.dev/ermite/internal/domain"
12+)
13+
14+//go:generate go tool mockery
15+
16+// RepoMetaStore keeps repository metadata. It is the source of truth for
17+// everything ermite owns about a repository except its Git data.
18+type RepoMetaStore interface {
19+ // Create stores repo. It returns domain.ErrAlreadyExists if a repository
20+ // with that name exists, including when a concurrent Create wins.
21+ Create(ctx context.Context, repo domain.Repo) error
22+ // Get returns the repository, or domain.ErrNotFound.
23+ Get(ctx context.Context, name domain.RepoName) (domain.Repo, error)
24+ // List returns every repository ordered by name.
25+ List(ctx context.Context) ([]domain.Repo, error)
26+ // Update replaces the stored repository, or returns domain.ErrNotFound.
27+ Update(ctx context.Context, repo domain.Repo) error
28+ // Delete removes the repository. Deleting a missing one is not an error.
29+ Delete(ctx context.Context, name domain.RepoName) error
30+}
31+
32+// StagedID identifies a repository being created. It is opaque to callers.
33+type StagedID string
34+
35+// RepoDirs is the result of listing the repository directories.
36+type RepoDirs struct {
37+ // Names are the directories that hold a valid repository name.
38+ Names []domain.RepoName
39+ // Invalid are the entries that cannot be a repository directory.
40+ Invalid []string
41+}
42+
43+// GitRepos manages bare repository directories.
44+type GitRepos interface {
45+ // Stage creates an empty bare repository outside the public directory
46+ // and returns its identifier.
47+ Stage(ctx context.Context) (StagedID, error)
48+ // Publish moves a staged repository to its final place under name. It
49+ // returns domain.ErrAlreadyExists if a directory for name exists; the
50+ // staged repository is left in place for Discard.
51+ Publish(ctx context.Context, id StagedID, name domain.RepoName) error
52+ // Discard removes a staged repository. A missing one is not an error.
53+ Discard(ctx context.Context, id StagedID) error
54+ // PurgeStaging removes every staged repository left by a previous run.
55+ PurgeStaging(ctx context.Context) error
56+ // List returns the repository directories.
57+ List(ctx context.Context) (RepoDirs, error)
58+ // Trash moves the repository directory to the trash, where it can be
59+ // recovered by hand. It returns domain.ErrNotFound if there is none.
60+ Trash(ctx context.Context, name domain.RepoName) error
61+}
62+
63+// Clock tells the time.
64+type Clock interface {
65+ Now() time.Time
66+}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 2

Tags 42

↑↓ moveenter openesc close