app

package
v0.8.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidApp = fmt.Errorf("invalid app")
View Source
var ErrInvalidID = errors.New("not a valid id")

Functions

func ValidateBricks added in v0.6.8

func ValidateBricks(a AppDescriptor, index *bricksindex.BricksIndex) error

ValidateBricks checks that all bricks referenced in the given AppDescriptor exist in the provided BricksIndex, It collects and returns all validation errors as a single joined error, allowing the caller to see all issues at once rather than stopping at the first error.

Types

type AppDescriptor

type AppDescriptor struct {
	Name            string   `yaml:"name"`
	Description     string   `yaml:"description"`
	Ports           []int    `yaml:"ports"`
	Bricks          []Brick  `yaml:"bricks"`
	Icon            string   `yaml:"icon,omitempty"`
	RequiredDevices []string `yaml:"required_devices,omitempty"`
}

func ParseDescriptorFile

func ParseDescriptorFile(file *paths.Path) (AppDescriptor, error)

ParseAppFile reads an app file

func (*AppDescriptor) IsValid

func (a *AppDescriptor) IsValid() error

func (AppDescriptor) MarshalYAML

func (d AppDescriptor) MarshalYAML() (any, error)

type ArduinoApp

type ArduinoApp struct {
	Name           string
	MainPythonFile *paths.Path

	FullPath   *paths.Path // FullPath is the path to the App folder
	Descriptor AppDescriptor
	// contains filtered or unexported fields
}

ArduinoApp holds all the files composing an app

func Load

func Load(appPath *paths.Path) (ArduinoApp, error)

Load creates an App instance by reading all the files composing an app and grouping them by file type.

func (*ArduinoApp) AppComposeFilePath

func (a *ArduinoApp) AppComposeFilePath() *paths.Path

func (*ArduinoApp) AppComposeOverrideFilePath

func (a *ArduinoApp) AppComposeOverrideFilePath() *paths.Path

func (*ArduinoApp) GetDescriptorPath

func (a *ArduinoApp) GetDescriptorPath() *paths.Path

GetDescriptorPath returns the path to the app descriptor file (app.yaml or app.yml)

func (*ArduinoApp) GetSketchPath added in v0.8.0

func (a *ArduinoApp) GetSketchPath() (*paths.Path, bool)

func (*ArduinoApp) ProvisioningStateDir

func (a *ArduinoApp) ProvisioningStateDir() *paths.Path

func (*ArduinoApp) Save

func (a *ArduinoApp) Save() error

func (*ArduinoApp) SketchBuildPath

func (a *ArduinoApp) SketchBuildPath() *paths.Path

type Brick

type Brick struct {
	ID        string            `yaml:"-"` // Ignores this field, to be handled manually
	Model     string            `yaml:"model,omitempty"`
	Variables map[string]string `yaml:"variables,omitempty"`
}

func (*Brick) UnmarshalYAML

func (md *Brick) UnmarshalYAML(node ast.Node) error

type ID

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

func (ID) Equal

func (id ID) Equal(other ID) bool

Equal implements the go-cmp equality interface.

func (ID) IsApp

func (id ID) IsApp() bool

func (ID) IsExample

func (id ID) IsExample() bool

func (ID) MarshalJSON

func (id ID) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for ID.

func (ID) String

func (id ID) String() string

func (ID) ToPath

func (id ID) ToPath() *paths.Path

type IDProvider

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

func NewAppIDProvider

func NewAppIDProvider(cfg config.Configuration) *IDProvider

func (*IDProvider) IDFromBase64

func (p *IDProvider) IDFromBase64(id string) (ID, error)

func (*IDProvider) IDFromPath

func (p *IDProvider) IDFromPath(path *paths.Path) (ID, error)

func (*IDProvider) ParseID

func (p *IDProvider) ParseID(id string) (ID, error)

ParseID parses a string into an ID. It accepts both absolute paths and relative paths.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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