provider

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package provider provides the interfaces for implementing providers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetProviders

func GetProviders() map[string]Provider

GetProviders will return the registered providers.

Types

type BunProvider

type BunProvider struct {
}

BunProvider is the provider implementation a generic Bun project.

func (*BunProvider) ConfigureDeploymentConfig

func (p *BunProvider) ConfigureDeploymentConfig(config *project.DeploymentConfig) error

func (*BunProvider) Detect

func (p *BunProvider) Detect(logger logger.Logger, dir string, state map[string]any) (*Detection, error)

func (*BunProvider) Identifier

func (p *BunProvider) Identifier() string

func (*BunProvider) Name

func (p *BunProvider) Name() string

func (*BunProvider) NewProject

func (p *BunProvider) NewProject(logger logger.Logger, dir string, name string) error

func (*BunProvider) ProjectIgnoreRules

func (p *BunProvider) ProjectIgnoreRules() []string

func (*BunProvider) RunDev

func (p *BunProvider) RunDev(logger logger.Logger, dir string, env []string, args []string) (Runner, error)

type CrewAIProvider

type CrewAIProvider struct {
}

CrewAIProvider is the provider implementation for the CrewAI framework.

func (*CrewAIProvider) ConfigureDeploymentConfig

func (p *CrewAIProvider) ConfigureDeploymentConfig(config *project.DeploymentConfig) error

func (*CrewAIProvider) Detect

func (p *CrewAIProvider) Detect(logger logger.Logger, dir string, state map[string]any) (*Detection, error)

func (*CrewAIProvider) Identifier

func (p *CrewAIProvider) Identifier() string

func (*CrewAIProvider) Name

func (p *CrewAIProvider) Name() string

func (*CrewAIProvider) NewProject

func (p *CrewAIProvider) NewProject(logger logger.Logger, dir string, name string) error

func (*CrewAIProvider) ProjectIgnoreRules

func (p *CrewAIProvider) ProjectIgnoreRules() []string

func (*CrewAIProvider) RunDev

func (p *CrewAIProvider) RunDev(logger logger.Logger, dir string, env []string, args []string) (Runner, error)

type Detection

type Detection struct {
	Provider    string `json:"provider"`              // the name of the provider
	Name        string `json:"name,omitempty"`        // the optional name of the project
	Description string `json:"description,omitempty"` // the optional name of the description
	Version     string `json:"version,omitempty"`     // the optional version of the project
}

Detection is the structure that is returned by the Detect function.

func Detect

func Detect(logger logger.Logger, dir string) (*Detection, error)

Detect will detect the provider for the given directory. It will return the detection if it is found, otherwise it will return nil.

type Provider

type Provider interface {
	// Name will return the name of the provider in a format that is easy to use in a CLI.
	Name() string

	// Identifier will return the identifier of the provider in a format that is easy to use in a CLI.
	Identifier() string

	// Detect will detect the provider for the given directory.
	// It will return the detection if it is found, otherwise it will return nil.
	Detect(logger logger.Logger, dir string, state map[string]any) (*Detection, error)

	// NewProject will create a new project for the given provider.
	NewProject(logger logger.Logger, dir string, name string) error

	// RunDev will run the development mode for the given provider.
	// It will return the runner if it is found, otherwise it will return nil.
	RunDev(logger logger.Logger, dir string, env []string, args []string) (Runner, error)

	// ProjectIgnoreRules should return any additional project specific deployment ignore rules.
	ProjectIgnoreRules() []string

	// ConfigureDeploymentConfig will configure the deployment config for the given provider.
	ConfigureDeploymentConfig(config *project.DeploymentConfig) error
}

Provider is the interface that is implemented by the provider to perform implementation specific logic.

func GetProviderForName

func GetProviderForName(name string) (Provider, error)

GetProviderForName returns a provider registered as name or returns an error

type PyProject

type PyProject struct {
	Name           string   `toml:"name"`
	Description    string   `toml:"description"`
	Version        string   `toml:"version"`
	RequiresPython string   `toml:"requires-python"`
	Dependencies   []string `toml:"dependencies"`
}

PyProject is the structure that is used to parse the pyproject.toml file.

type PythonRunner

type PythonRunner struct {
	// contains filtered or unexported fields
}

PythonRunner is the runner implementation for python projects.

func (*PythonRunner) Done

func (p *PythonRunner) Done() chan struct{}

func (*PythonRunner) Restart

func (p *PythonRunner) Restart() chan struct{}

func (*PythonRunner) Start

func (p *PythonRunner) Start() error

func (*PythonRunner) Stop

func (p *PythonRunner) Stop() error

type Runner

type Runner interface {
	// Start will start the runner.
	Start() error
	// Stop will stop the runner.
	Stop() error
	// Restart will restart the runner.
	Restart() chan struct{}
	// Done will return a channel that is closed when the runner is done.
	Done() chan struct{}
}

Runner is the interface that is implemented by the provider for running the project.

func NewRunner

func NewRunner(logger logger.Logger, dir string, apiUrl string, eventLogFile string, args []string) (Runner, error)

NewRunner will create a new runner for the given provider. It will return the runner if it is found, otherwise it will return nil.

Jump to

Keyboard shortcuts

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