raw

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package raw implements raw access to Oyafiles, allowing for access without actually parsing the files. This allows for working with incorrect Oyafiles (e.g. with invalid imports) as long as they are well-formed YAML files.

Index

Constants

View Source
const DefaultName = "Oyafile"
View Source
const ValueFileExt = ".oya"

Variables

This section is empty.

Functions

func InitDir

func InitDir(dirPath, projectName string) error

Types

type DecodedOyafile

type DecodedOyafile template.Scope

DecodedOyafile is an Oyafile that has been loaded from YAML but hasn't been parsed yet.

func (DecodedOyafile) Merge

type ErrNotRootOyafile

type ErrNotRootOyafile struct {
	Path string
}

func (ErrNotRootOyafile) Error

func (e ErrNotRootOyafile) Error() string

type Oyafile

type Oyafile struct {
	Path    string // Path contains normalized absolute path to the Oyafile.
	Dir     string // Dir contains normalized absolute path to the containing directory.
	RootDir string // RootDir is the absolute, normalized path to the project root directory.
	// contains filtered or unexported fields
}

Oyafile represents an unparsed Oyafile.

func Load

func Load(oyafilePath, rootDir string) (*Oyafile, bool, error)

func LoadFromDir

func LoadFromDir(dirPath, rootDir string) (*Oyafile, bool, error)

func New

func New(oyafilePath, rootDir string) (*Oyafile, error)

func (*Oyafile) AddImport

func (raw *Oyafile) AddImport(alias, uri string) error

func (*Oyafile) AddRequire

func (raw *Oyafile) AddRequire(pack Pack) error

AddRequire adds a Require: entry for the pack.

func (*Oyafile) Decode

func (raw *Oyafile) Decode() (DecodedOyafile, error)

func (*Oyafile) IsRoot

func (raw *Oyafile) IsRoot() (bool, error)

func (*Oyafile) Project added in v0.0.9

func (raw *Oyafile) Project() (interface{}, bool, error)

type Pack

type Pack interface {
	ImportPath() types.ImportPath
	Version() semver.Version
}

Notes

Bugs

  • This is slightly brittle because it will match any line that ends with the uri. It might be a good idea to add a raw.(*Oyafile).matchesWithin function along the lines of how insertBeforeWithin is written.

  • Use raw access.

Jump to

Keyboard shortcuts

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