forges

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FixtureGitLabFactory  = FixtureForgeFactory{Fun: FixtureNewGitLabForge, AdminRequired: true}
	FixtureForgejoFactory = FixtureForgeFactory{Fun: FixtureNewForgejoForge, AdminRequired: true}
	FixtureF3Factory      = FixtureForgeFactory{Fun: FixtureNewF3Forge, AdminRequired: false}
)
View Source
var FixtureAdminUser *format.User = &format.User{
	UserName: "root",
	Password: "Wrobyak4",
}
View Source
var FixtureForgeFactories = map[string]FixtureForgeFactory{
	"gitlab":  FixtureGitLabFactory,
	"forgejo": FixtureForgejoFactory,
	"f3":      FixtureF3Factory,
}

Functions

func AssertF3Equals

func AssertF3Equals(t tests.TestingT, a, b *ForgeRoot, dir string)

func NewForgeContainer

func NewForgeContainer[
	ForgeContainer any,
	Parent any,
	ForgeContainerPtr NewForgeContainerConstraint[ForgeContainer, ParentPtr],
	ParentPtr NewParentConstraint[Parent],
](
	root *ForgeRoot,
	parent ParentPtr,
	providerName string,
) ForgeContainerPtr

func NewForgeElement

func NewForgeElement[
	ForgeElement any,
	Parent any,
	ForgeElementPtr NewForgeElementConstraint[ForgeElement, ParentPtr],
	ParentPtr NewParentConstraint[Parent],
](
	root *ForgeRoot,
	parent ParentPtr,
	provider common.ProviderInterface,
) ForgeElementPtr

Types

type Fixture

type Fixture struct {
	ForgeRoot *ForgeRoot
	Forge     *Forge

	Asset       *ForgeAsset
	AssetFormat *format.ReleaseAsset

	PullRequestComment       *ForgePullRequestComment
	PullRequestCommentFormat *format.Comment

	IssueComment       *ForgeIssueComment
	IssueCommentFormat *format.Comment

	CommentReaction       *ForgeCommentReaction
	CommentReactionFormat *format.Reaction

	IssueReaction       *ForgeIssueReaction
	IssueReactionFormat *format.Reaction

	Issue       *ForgeIssue
	IssueFormat *format.Issue

	Label       *ForgeLabel
	LabelFormat *format.Label

	Milestone       *ForgeMilestone
	MilestoneFormat *format.Milestone

	Project       *ForgeProject
	ProjectFormat *format.Project

	PullRequest       *ForgePullRequest
	PullRequestFormat *format.PullRequest

	Release       *ForgeRelease
	ReleaseFormat *format.Release

	Repository              *ForgeRepository
	RepositoryFormat        *format.Repository
	FixtureRepositoryFormat *format.Repository
	RepositoryHelper        *tests.RepositoryTestHelper

	Review       *ForgeReview
	ReviewFormat *format.Review

	Topic       *ForgeTopic
	TopicFormat *format.Topic

	UserIsAdmin bool
	User        *ForgeUser
	UserFormat  *format.User
	// contains filtered or unexported fields
}

func NewFixture

func NewFixture(t tests.TestingT, forgeFactory FixtureForgeFactory) *Fixture

func (*Fixture) Assign

func (o *Fixture) Assign(ctx context.Context, path format.ForgePath)

func (*Fixture) DeleteAppend

func (o *Fixture) DeleteAppend(fun func())

func (*Fixture) NewAdminForge

func (o *Fixture) NewAdminForge()

func (*Fixture) NewAsset

func (o *Fixture) NewAsset()

func (*Fixture) NewCommentReaction

func (o *Fixture) NewCommentReaction()

func (*Fixture) NewIssue

func (o *Fixture) NewIssue()

func (*Fixture) NewIssueComment

func (o *Fixture) NewIssueComment(exemplar *format.Comment)

func (*Fixture) NewIssueReaction

func (o *Fixture) NewIssueReaction()

func (*Fixture) NewLabel

func (o *Fixture) NewLabel()

func (*Fixture) NewMilestone

func (o *Fixture) NewMilestone()

func (*Fixture) NewProject

func (o *Fixture) NewProject()

func (*Fixture) NewPullRequest

func (o *Fixture) NewPullRequest()

func (*Fixture) NewPullRequestComment

func (o *Fixture) NewPullRequestComment()

func (*Fixture) NewRelease

func (o *Fixture) NewRelease()

func (*Fixture) NewRepository

func (o *Fixture) NewRepository()

func (*Fixture) NewReview

func (o *Fixture) NewReview()

func (*Fixture) NewTopic

func (o *Fixture) NewTopic()

func (*Fixture) NewUser

func (o *Fixture) NewUser(id int64)

type FixtureForgeFactory

type FixtureForgeFactory struct {
	Fun           FixtureForgeFactoryFun
	AdminRequired bool
}

type FixtureForgeFactoryFun

type FixtureForgeFactoryFun func(t tests.TestingT, logger *config_types.Logger, user *format.User, tmpDir string) *ForgeRoot

type Forge

func NewForge

func NewForge(root *ForgeRoot) *Forge

func (*Forge) Apply

func (o *Forge) Apply(ctx context.Context, opts *common.ApplyOptions)

func (*Forge) GetParentObjects

func (o *Forge) GetParentObjects() []common.ContainerObjectInterface

func (*Forge) Init

func (o *Forge) Init(root *ForgeRoot)

func (*Forge) Mirror

func (o *Forge) Mirror(ctx context.Context, origin common.ContainerElementInterface, options *common.MirrorOptions)

func (*Forge) Walk

func (o *Forge) Walk(ctx context.Context, opts *common.WalkOptions)

type ForgeAsset

type ForgeAsset struct {
	ForgeElement[ForgeRelease, *ForgeRelease]
}

type ForgeAssets

func (*ForgeAssets) Mirror

func (o *ForgeAssets) Mirror(ctx context.Context, other common.ContainerInterface, options *common.MirrorOptions)

type ForgeCommentReaction

type ForgeCommentReaction struct {
	ForgeElement[ForgeIssueComment, *ForgeIssueComment]
}

type ForgeContainer

type ForgeContainer[
	ForgeElement any,
	Parent any,
	Format any,
	ForgeElementPtr ForgeElementConstraint[ForgeElement, ParentPtr],
	ParentPtr ParentConstraint[Parent],
	FormatPtr FormatConstraint[Format],
] struct {
	common.Container
}

func (*ForgeContainer[ForgeElement, Parent, Format, ForgeElementPtr, ParentPtr, FormatPtr]) FromFormat

func (o *ForgeContainer[ForgeElement, Parent, Format, ForgeElementPtr, ParentPtr, FormatPtr]) FromFormat(ctx context.Context, format FormatPtr) common.ContainerElementInterface

func (*ForgeContainer[ForgeElement, Parent, Format, ForgeElementPtr, ParentPtr, FormatPtr]) GetFromFormat

func (o *ForgeContainer[ForgeElement, Parent, Format, ForgeElementPtr, ParentPtr, FormatPtr]) GetFromFormat(ctx context.Context, format format.Interface) ForgeElementPtr

func (*ForgeContainer[ForgeElement, Parent, Format, ForgeElementPtr, ParentPtr, FormatPtr]) GetWithType

func (o *ForgeContainer[ForgeElement, Parent, Format, ForgeElementPtr, ParentPtr, FormatPtr]) GetWithType(ctx context.Context, exemplar common.ContainerElementInterface) ForgeElementPtr

func (*ForgeContainer[ForgeElement, Parent, Format, ForgeElementPtr, ParentPtr, FormatPtr]) Init

func (o *ForgeContainer[ForgeElement, Parent, Format, ForgeElementPtr, ParentPtr, FormatPtr]) Init(self common.NodeInterface, root *ForgeRoot, parent ParentPtr, providerName string)

func (*ForgeContainer[ForgeElement, Parent, Format, ForgeElementPtr, ParentPtr, FormatPtr]) NewFormat

func (o *ForgeContainer[ForgeElement, Parent, Format, ForgeElementPtr, ParentPtr, FormatPtr]) NewFormat(id int64) format.Interface

func (*ForgeContainer[ForgeElement, Parent, Format, ForgeElementPtr, ParentPtr, FormatPtr]) ToFormatWithType

func (o *ForgeContainer[ForgeElement, Parent, Format, ForgeElementPtr, ParentPtr, FormatPtr]) ToFormatWithType(ctx context.Context, element common.ContainerElementInterface) FormatPtr

func (*ForgeContainer[ForgeElement, Parent, Format, ForgeElementPtr, ParentPtr, FormatPtr]) Upsert

func (o *ForgeContainer[ForgeElement, Parent, Format, ForgeElementPtr, ParentPtr, FormatPtr]) Upsert(ctx context.Context, format FormatPtr) ForgeElementPtr

type ForgeElement

type ForgeElement[
	Parent any,
	ParentPtr ParentConstraint[Parent],
] struct {
	common.ContainerElement
}

func (*ForgeElement[Parent, ParentPtr]) Init

func (o *ForgeElement[Parent, ParentPtr]) Init(self common.NodeInterface, root *ForgeRoot, parent ParentPtr, provider common.ProviderInterface)

func (*ForgeElement[Parent, ParentPtr]) Mirror

func (o *ForgeElement[Parent, ParentPtr]) Mirror(ctx context.Context, other common.ContainerElementInterface, options *common.MirrorOptions)

func (*ForgeElement[Parent, ParentPtr]) NewFormat

func (o *ForgeElement[Parent, ParentPtr]) NewFormat(int64) format.Interface

type ForgeElementConstraint

type ForgeElementConstraint[ForgeElement any, ParentPtr any] interface {
	*ForgeElement
	common.ContainerElementInterface
	Init(common.NodeInterface, *ForgeRoot, ParentPtr, common.ProviderInterface)
}

type ForgeIssue

type ForgeIssue struct {
	ForgeElement[ForgeProject, *ForgeProject]
	Comments  *ForgeIssueComments
	Reactions *ForgeIssueReactions
}

func (*ForgeIssue) Init

func (o *ForgeIssue) Init(self common.NodeInterface, root *ForgeRoot, project *ForgeProject, provider common.ProviderInterface)

func (*ForgeIssue) Mirror

type ForgeIssueComment

type ForgeIssueComment struct {
	ForgeElement[ForgeIssue, *ForgeIssue]
	Reactions *ForgeCommentReactions
}

func (*ForgeIssueComment) Init

func (o *ForgeIssueComment) Init(self common.NodeInterface, root *ForgeRoot, issue *ForgeIssue, provider common.ProviderInterface)

func (*ForgeIssueComment) Mirror

type ForgeIssueComments

func (*ForgeIssueComments) Mirror

type ForgeIssueReaction

type ForgeIssueReaction struct {
	ForgeElement[ForgeIssue, *ForgeIssue]
}

type ForgeIssueReactions

func (*ForgeIssueReactions) Mirror

type ForgeIssues

func (*ForgeIssues) Mirror

func (o *ForgeIssues) Mirror(ctx context.Context, other common.ContainerInterface, options *common.MirrorOptions)

type ForgeLabel

type ForgeLabel struct {
	ForgeElement[ForgeProject, *ForgeProject]
}

type ForgeLabels

func (*ForgeLabels) Mirror

func (o *ForgeLabels) Mirror(ctx context.Context, other common.ContainerInterface, options *common.MirrorOptions)

type ForgeMilestone

type ForgeMilestone struct {
	ForgeElement[ForgeProject, *ForgeProject]
}

type ForgeMilestones

func (*ForgeMilestones) Mirror

type ForgeProject

type ForgeProject struct {
	ForgeElement[ForgeUser, *ForgeUser]
	Issues       *ForgeIssues
	PullRequests *ForgePullRequests
	Milestones   *ForgeMilestones
	Repositories *ForgeRepositories
	Releases     *ForgeReleases
	Topics       *ForgeTopics
	Labels       *ForgeLabels
}

func (*ForgeProject) Init

func (o *ForgeProject) Init(self common.NodeInterface, root *ForgeRoot, user *ForgeUser, provider common.ProviderInterface)

func (*ForgeProject) Mirror

type ForgePullRequest

type ForgePullRequest struct {
	ForgeElement[ForgeProject, *ForgeProject]
	Comments *ForgePullRequestComments
	Reviews  *ForgeReviews
}

func (*ForgePullRequest) Init

func (o *ForgePullRequest) Init(self common.NodeInterface, root *ForgeRoot, project *ForgeProject, provider common.ProviderInterface)

func (*ForgePullRequest) Mirror

type ForgePullRequestComment

type ForgePullRequestComment struct {
	ForgeElement[ForgePullRequest, *ForgePullRequest]
}

type ForgeRelease

type ForgeRelease struct {
	ForgeElement[ForgeProject, *ForgeProject]
	Assets *ForgeAssets
}

func (*ForgeRelease) Init

func (o *ForgeRelease) Init(self common.NodeInterface, root *ForgeRoot, project *ForgeProject, provider common.ProviderInterface)

func (*ForgeRelease) Mirror

type ForgeReleases

func (*ForgeReleases) Mirror

func (o *ForgeReleases) Mirror(ctx context.Context, other common.ContainerInterface, options *common.MirrorOptions)

type ForgeRepositories

func (*ForgeRepositories) Mirror

type ForgeRepository

type ForgeRepository struct {
	ForgeElement[ForgeProject, *ForgeProject]
}

type ForgeReview

type ForgeReview struct {
	ForgeElement[ForgePullRequest, *ForgePullRequest]
}

type ForgeRoot

type ForgeRoot struct {
	Forge *Forge
	// contains filtered or unexported fields
}

func FixtureNewF3Forge

func FixtureNewF3Forge(t tests.TestingT, logger *config_types.Logger, user *format.User, tmpDir string) *ForgeRoot

func FixtureNewForgejoForge

func FixtureNewForgejoForge(t tests.TestingT, logger *config_types.Logger, user *format.User, tmpDir string) *ForgeRoot

func FixtureNewGitLabForge

func FixtureNewGitLabForge(t tests.TestingT, logger *config_types.Logger, user *format.User, tmpDir string) *ForgeRoot

func NewForgeRoot

func NewForgeRoot(driver common.DriverInterface, options config_types.OptionsInterface) *ForgeRoot

func (*ForgeRoot) Apply

func (o *ForgeRoot) Apply(ctx context.Context, opts *common.ApplyOptions)

func (*ForgeRoot) GetDirectory

func (o *ForgeRoot) GetDirectory() string

func (*ForgeRoot) GetDriver

func (o *ForgeRoot) GetDriver() common.DriverInterface

func (*ForgeRoot) GetFeatures

func (o *ForgeRoot) GetFeatures() config_types.Features

func (*ForgeRoot) GetLogger

func (o *ForgeRoot) GetLogger() *config_types.Logger

func (*ForgeRoot) GetPerPage

func (o *ForgeRoot) GetPerPage() int

func (*ForgeRoot) Init

func (o *ForgeRoot) Init()

func (*ForgeRoot) Rollback

func (o *ForgeRoot) Rollback()

func (*ForgeRoot) SetLogger

func (o *ForgeRoot) SetLogger(logger *config_types.Logger)

func (*ForgeRoot) Walk

func (o *ForgeRoot) Walk(ctx context.Context, opts *common.WalkOptions)

type ForgeTopic

type ForgeTopic struct {
	ForgeElement[ForgeProject, *ForgeProject]
}

type ForgeUser

type ForgeUser struct {
	ForgeElement[Forge, *Forge]
	Projects *ForgeProjects
}

func (*ForgeUser) Init

func (o *ForgeUser) Init(self common.NodeInterface, root *ForgeRoot, parent *Forge, provider common.ProviderInterface)

func (*ForgeUser) Mirror

type ForgeUsers

type ForgeUsers struct {
	ForgeContainer[ForgeUser, Forge, format.User, *ForgeUser, *Forge, *format.User]
}

type FormatConstraint

type FormatConstraint[Format any] interface {
	*Format
	format.Interface
}

type NewForgeContainerConstraint

type NewForgeContainerConstraint[ForgeContainer any, ParentPtr any] interface {
	*ForgeContainer
	common.NodeInterface
	Init(common.NodeInterface, *ForgeRoot, ParentPtr, string)
}

type NewForgeElementConstraint

type NewForgeElementConstraint[ForgeElement any, ParentPtr any] interface {
	*ForgeElement
	common.NodeInterface
	Init(common.NodeInterface, *ForgeRoot, ParentPtr, common.ProviderInterface)
}

type NewParentConstraint

type NewParentConstraint[Parent any] interface {
	*Parent
	common.NodeInterface
}

type ParentConstraint

type ParentConstraint[Parent any] interface {
	*Parent
	common.NodeInterface
}

Directories

Path Synopsis
SPDX-License-Identifier: MIT
SPDX-License-Identifier: MIT

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL