tiltextension

package
v0.17.10 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package extension implements Tilt extensions. This is not the internal Starkit abstraction, but the user-visible feature. In a Tiltfile, you can write `load("ext://foo", "bar")` to load the function bar from the extension foo.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Downloader added in v0.17.5

type Downloader interface {
	RootDir() string
	Download(pkg string) (string, error)
}

type Extension

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

func NewExtension

func NewExtension(fetcher Fetcher, store Store) *Extension

func (*Extension) LocalPath

func (e *Extension) LocalPath(t *starlark.Thread, arg string) (string, error)

func (*Extension) OnStart

func (e *Extension) OnStart(env *starkit.Environment) error

type Fetcher

type Fetcher interface {
	Fetch(ctx context.Context, moduleName string) (ModuleContents, error)
	CleanUp() error
}

type GithubFetcher

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

func NewGithubFetcher

func NewGithubFetcher(dlr Downloader) *GithubFetcher

func (*GithubFetcher) CleanUp added in v0.17.5

func (f *GithubFetcher) CleanUp() error

func (*GithubFetcher) Fetch

func (f *GithubFetcher) Fetch(ctx context.Context, moduleName string) (ModuleContents, error)

type LocalStore

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

func NewLocalStore

func NewLocalStore(baseDir string) *LocalStore

func (*LocalStore) ModulePath

func (s *LocalStore) ModulePath(ctx context.Context, moduleName string) (string, error)

func (*LocalStore) Write

func (s *LocalStore) Write(ctx context.Context, contents ModuleContents) (string, error)

TODO(dmiller): should this error if we try to write an extension with the same name as one that already exists?

type Metadata

type Metadata struct {
	Name              string
	ExtensionRegistry string
	TimeFetched       time.Time
}

type MetadataFile

type MetadataFile struct {
	Extensions []Metadata
}

type ModuleContents

type ModuleContents struct {
	Name              string
	Dir               string
	ExtensionRegistry string
	TimeFetched       time.Time
}

type Store

type Store interface {
	// ModulePath is used to check if an extension exists before fetching it
	// Returns ErrNotExist if module doesn't exist
	ModulePath(ctx context.Context, moduleName string) (string, error)
	Write(ctx context.Context, contents ModuleContents) (string, error)
}

type TempDirDownloader added in v0.17.5

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

func NewTempDirDownloader added in v0.17.5

func NewTempDirDownloader() (*TempDirDownloader, error)

func (*TempDirDownloader) Download added in v0.17.5

func (d *TempDirDownloader) Download(pkg string) (string, error)

func (*TempDirDownloader) RootDir added in v0.17.5

func (d *TempDirDownloader) RootDir() string

Jump to

Keyboard shortcuts

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