[F3] driver stub
This commit is contained in:
parent
b11c68b734
commit
ed609d0248
8 changed files with 129 additions and 0 deletions
2
go.mod
2
go.mod
|
@ -117,6 +117,7 @@ require (
|
||||||
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
|
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
|
||||||
gopkg.in/ini.v1 v1.67.0
|
gopkg.in/ini.v1 v1.67.0
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
|
lab.forgefriends.org/friendlyforgeformat/gof3 v1.0.1-0.20240122075607-5d314b108abb
|
||||||
mvdan.cc/xurls/v2 v2.5.0
|
mvdan.cc/xurls/v2 v2.5.0
|
||||||
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251
|
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251
|
||||||
xorm.io/builder v0.3.13
|
xorm.io/builder v0.3.13
|
||||||
|
@ -204,6 +205,7 @@ require (
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||||
github.com/golang/protobuf v1.5.3 // indirect
|
github.com/golang/protobuf v1.5.3 // indirect
|
||||||
github.com/golang/snappy v0.0.4 // indirect
|
github.com/golang/snappy v0.0.4 // indirect
|
||||||
|
github.com/google/go-cmp v0.6.0 // indirect
|
||||||
github.com/google/go-querystring v1.1.0 // indirect
|
github.com/google/go-querystring v1.1.0 // indirect
|
||||||
github.com/google/go-tpm v0.9.0 // indirect
|
github.com/google/go-tpm v0.9.0 // indirect
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99 // indirect
|
github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99 // indirect
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -1291,6 +1291,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
||||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||||
|
lab.forgefriends.org/friendlyforgeformat/gof3 v1.0.1-0.20240122075607-5d314b108abb h1:kS8Jkycu2kggyVggjxC7I24iyDLOB2WqAJ8DlV21Fis=
|
||||||
|
lab.forgefriends.org/friendlyforgeformat/gof3 v1.0.1-0.20240122075607-5d314b108abb/go.mod h1:LxfG8cikPNzmy77CCYM4b9t/NbFefGJ1rUZujqDNa8Y=
|
||||||
lukechampine.com/uint128 v1.2.0 h1:mBi/5l91vocEN8otkC5bDLhi2KdCticRiwbdB0O+rjI=
|
lukechampine.com/uint128 v1.2.0 h1:mBi/5l91vocEN8otkC5bDLhi2KdCticRiwbdB0O+rjI=
|
||||||
lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
|
lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
|
||||||
modernc.org/cc/v3 v3.40.0 h1:P3g79IUS/93SYhtoeaHW+kRCIrYaxJ27MFPv+7kaTOw=
|
modernc.org/cc/v3 v3.40.0 h1:P3g79IUS/93SYhtoeaHW+kRCIrYaxJ27MFPv+7kaTOw=
|
||||||
|
|
15
services/f3/driver/main.go
Normal file
15
services/f3/driver/main.go
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
// Copyright Earl Warren <contact@earl-warren.org>
|
||||||
|
// Copyright Loïc Dachary <loic@dachary.org>
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package driver
|
||||||
|
|
||||||
|
import (
|
||||||
|
"lab.forgefriends.org/friendlyforgeformat/gof3/options"
|
||||||
|
f3_tree "lab.forgefriends.org/friendlyforgeformat/gof3/tree/f3"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
f3_tree.RegisterForgeFactory(Name, newTreeDriver)
|
||||||
|
options.RegisterFactory(Name, newOptions)
|
||||||
|
}
|
26
services/f3/driver/main_test.go
Normal file
26
services/f3/driver/main_test.go
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// Copyright Earl Warren <contact@earl-warren.org>
|
||||||
|
// Copyright Loïc Dachary <loic@dachary.org>
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package driver
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
_ "code.gitea.io/gitea/models"
|
||||||
|
_ "code.gitea.io/gitea/models/actions"
|
||||||
|
_ "code.gitea.io/gitea/models/activities"
|
||||||
|
_ "code.gitea.io/gitea/models/perm/access"
|
||||||
|
|
||||||
|
"code.gitea.io/gitea/models/unittest"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestF3(t *testing.T) {
|
||||||
|
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestMain(m *testing.M) {
|
||||||
|
unittest.MainTest(m)
|
||||||
|
}
|
7
services/f3/driver/name.go
Normal file
7
services/f3/driver/name.go
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
// Copyright Earl Warren <contact@earl-warren.org>
|
||||||
|
// Copyright Loïc Dachary <loic@dachary.org>
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package driver
|
||||||
|
|
||||||
|
const Name = "internal_forgejo"
|
19
services/f3/driver/options.go
Normal file
19
services/f3/driver/options.go
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// Copyright Earl Warren <contact@earl-warren.org>
|
||||||
|
// Copyright Loïc Dachary <loic@dachary.org>
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package driver
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
forgejo_options "code.gitea.io/gitea/services/f3/driver/options"
|
||||||
|
"lab.forgefriends.org/friendlyforgeformat/gof3/options"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newOptions() options.Interface {
|
||||||
|
o := &forgejo_options.Options{}
|
||||||
|
o.SetName(Name)
|
||||||
|
o.SetNewMigrationHTTPClient(func() *http.Client { return &http.Client{} })
|
||||||
|
return o
|
||||||
|
}
|
29
services/f3/driver/options/options.go
Normal file
29
services/f3/driver/options/options.go
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
// Copyright Earl Warren <contact@earl-warren.org>
|
||||||
|
// Copyright Loïc Dachary <loic@dachary.org>
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package options
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"lab.forgefriends.org/friendlyforgeformat/gof3/options"
|
||||||
|
"lab.forgefriends.org/friendlyforgeformat/gof3/options/logger"
|
||||||
|
)
|
||||||
|
|
||||||
|
type NewMigrationHTTPClientFun func() *http.Client
|
||||||
|
|
||||||
|
type Options struct {
|
||||||
|
options.Options
|
||||||
|
logger.OptionsLogger
|
||||||
|
|
||||||
|
NewMigrationHTTPClient NewMigrationHTTPClientFun
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *Options) GetNewMigrationHTTPClient() NewMigrationHTTPClientFun {
|
||||||
|
return o.NewMigrationHTTPClient
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *Options) SetNewMigrationHTTPClient(fun NewMigrationHTTPClientFun) {
|
||||||
|
o.NewMigrationHTTPClient = fun
|
||||||
|
}
|
29
services/f3/driver/tree.go
Normal file
29
services/f3/driver/tree.go
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
// Copyright Earl Warren <contact@earl-warren.org>
|
||||||
|
// Copyright Loïc Dachary <loic@dachary.org>
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package driver
|
||||||
|
|
||||||
|
import (
|
||||||
|
forgejo_options "code.gitea.io/gitea/services/f3/driver/options"
|
||||||
|
"lab.forgefriends.org/friendlyforgeformat/gof3/tree/generic"
|
||||||
|
)
|
||||||
|
|
||||||
|
type treeDriver struct {
|
||||||
|
generic.NullTreeDriver
|
||||||
|
|
||||||
|
options *forgejo_options.Options
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *treeDriver) Init() {
|
||||||
|
o.NullTreeDriver.Init()
|
||||||
|
}
|
||||||
|
|
||||||
|
func newTreeDriver(tree generic.TreeInterface, anyOptions any) generic.TreeDriverInterface {
|
||||||
|
driver := &treeDriver{
|
||||||
|
options: anyOptions.(*forgejo_options.Options),
|
||||||
|
}
|
||||||
|
driver.SetTree(tree)
|
||||||
|
driver.Init()
|
||||||
|
return driver
|
||||||
|
}
|
Loading…
Reference in a new issue