manifest

package
v2.13.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2019 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const Filename = "manifest.toml"

Variables

This section is empty.

Functions

func CurrentSDKMajor

func CurrentSDKMajor() int

CurrentSDKMajor returns a major version of this SDK package.

func SDKVersion

func SDKVersion(open OpenFunc) (string, error)

SDKVersion detects a Babelfish SDK version of a driver. Returned format is "x[.y[.z]]".

Types

type DevelopmentStatus

type DevelopmentStatus string
const (
	Planning DevelopmentStatus = "planning"
	PreAlpha DevelopmentStatus = "pre-alpha"
	Alpha    DevelopmentStatus = "alpha"
	Beta     DevelopmentStatus = "beta"
	Stable   DevelopmentStatus = "stable"
	Mature   DevelopmentStatus = "mature"
	Inactive DevelopmentStatus = "inactive"
)

func (DevelopmentStatus) Rank

func (s DevelopmentStatus) Rank() int

Rank is an integer indicating driver stability. Higher is better.

type Documentation

type Documentation struct {
	Description string `toml:"description,omitempty" json:",omitempty"`
	Caveats     string `toml:"caveats,omitempty" json:",omitempty"`
}

type Feature

type Feature string

Feature describes which level of information driver can produce.

const (
	// AST is a basic feature required for the driver. Driver can parse files and return native language AST.
	AST Feature = "ast"
	// UAST feature indicates that driver properly converts AST to UAST without further annotating it.
	UAST Feature = "uast"
	// Roles feature indicates that driver annotates UAST with roles. All node types are annotated.
	Roles Feature = "roles"
)

type InformationLoss

type InformationLoss string

InformationLoss in terms of which kind of code generation would they allow.

const (
	// Lossless no information loss converting code to AST and then back to code
	// would. code == codegen(AST(code)).
	Lossless InformationLoss = "lossless"
	// FormatingLoss only superfluous formatting information is lost (e.g.
	// whitespace, indentation). Code generated from the AST could be the same
	// as the original code after passing a code formatter.
	// fmt(code) == codegen(AST(code)).
	FormatingLoss InformationLoss = "formating-loss"
	// SyntacticSugarLoss there is information loss about syntactic sugar. Code
	// generated from the AST could be the same as the original code after
	// desugaring it. desugar(code) == codegen(AST(code)).
	SyntacticSugarLoss InformationLoss = "syntactic-sugar-loss"
	// CommentLoss comments are not present in the AST.
	CommentLoss InformationLoss = "formating-loss"
)

type Maintainer

type Maintainer struct {
	Name   string `json:",omitempty"`
	Email  string `json:",omitempty"`
	Github string `json:",omitempty"` // github handle
}

Maintainer is an information about project maintainer.

func Maintainers

func Maintainers(open OpenFunc) ([]Maintainer, error)

Maintainers reads and parses the MAINTAINERS file using the provided function.

func (Maintainer) GithubURL

func (m Maintainer) GithubURL() string

GithubURL returns github profile URL.

func (Maintainer) URL

func (m Maintainer) URL() string

URL returns a contact of the maintainer (either Github profile or email link).

type Manifest

type Manifest struct {
	Name            string            `toml:"name"` // human-readable name
	Language        string            `toml:"language"`
	Version         string            `toml:"version,omitempty" json:",omitempty"`
	Build           *time.Time        `toml:"build,omitempty" json:",omitempty"`
	Status          DevelopmentStatus `toml:"status"`
	InformationLoss []InformationLoss `toml:"loss" json:",omitempty"`
	SDKVersion      string            `toml:"-"` // do not read it from manifest.toml
	Documentation   *Documentation    `toml:"documentation,omitempty" json:",omitempty"`
	Runtime         struct {
		OS             OS       `toml:"os" json:",omitempty"`
		NativeVersion  Versions `toml:"native_version" json:",omitempty"`
		NativeEncoding string   `toml:"native_encoding" json:",omitempty"`
		GoVersion      string   `toml:"go_version" json:",omitempty"`
	} `toml:"runtime"`
	Features    []Feature    `toml:"features" json:",omitempty"`
	Maintainers []Maintainer `toml:"-" json:",omitempty"`
}

func Load

func Load(path string) (*Manifest, error)

Load reads a manifest and decode the content into a new Manifest struct

func (*Manifest) Decode

func (m *Manifest) Decode(r io.Reader) error

Decode decodes reads r and decodes it into m

func (*Manifest) Encode

func (m *Manifest) Encode(w io.Writer) error

Encode encodes m in toml format and writes the restult to w

func (Manifest) ForCurrentSDK

func (m Manifest) ForCurrentSDK() bool

ForCurrentSDK indicates that driver is built for the same major version of SDK.

func (Manifest) InDevelopment

func (m Manifest) InDevelopment() bool

InDevelopment indicates that driver is incomplete and should only be used for development purposes.

func (Manifest) IsRecommended

func (m Manifest) IsRecommended() bool

IsRecommended indicates that driver is stable enough to be used in production.

func (Manifest) SDKMajor

func (m Manifest) SDKMajor() int

SDKMajor returns a major version of SDK this driver was built for.

func (Manifest) Supports

func (m Manifest) Supports(f Feature) bool

Supports checks if driver supports specified feature.

type OS

type OS string
const (
	Alpine OS = "alpine"
	Debian OS = "debian"
)

func (OS) AsImage

func (os OS) AsImage() string

type OpenFunc

type OpenFunc func(path string) (io.ReadCloser, error)

OpenFunc is a function for fetching a file using a relative file path. It returns an empty error an nil reader in case file does not exist.

func InDir

func InDir(dir string) OpenFunc

InDir returns a function that read files in the specified directory.

type Versions

type Versions []string

func (Versions) String

func (v Versions) String() string

Directories

Path Synopsis
Package discovery package implements helpers for clients to discover language drivers supported by Babelfish.
Package discovery package implements helpers for clients to discover language drivers supported by Babelfish.

Jump to

Keyboard shortcuts

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