libbuildpack

package module
v0.0.0-...-814db2d Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

README

libbuildpack

A library for writing buildpacks

Development

If you want to change mocks and thus run go:generate you will need

go get github.com/golang/mock/gomock
go get github.com/golang/mock/mockgen

Documentation

Index

Constants

View Source
const (
	CFLINUXFS2              = "cflinuxfs2"
	WINDOWS2016             = "windows2016"
	ATTENTION_MSG           = "!! !!"
	WARNING_MSG_CFLINUXFS2  = "" /* 253-byte string literal not displayed */
	WARNING_MSG_WINDOWS2016 = "" /* 356-byte string literal not displayed */
)
View Source
const SENTINEL = "sentinel"

Variables

This section is empty.

Functions

func AddHook

func AddHook(hook Hook)

func CheckSha256

func CheckSha256(filePath, expectedSha256 string) error

func ClearHooks

func ClearHooks()

func CopyDirectory

func CopyDirectory(srcDir, destDir string) error

CopyDirectory copies srcDir to destDir

func CopyFile

func CopyFile(source, destFile string) error

CopyFile copies source file to destFile, creating all intermediate directories in destFile

func ExtractTarGz

func ExtractTarGz(tarfile, destDir string) error

ExtractTarGz extracts tar.gz to destDir

func ExtractTarXz

func ExtractTarXz(tarfile, destDir string) error

func ExtractZip

func ExtractZip(zipfile, destDir string) error

ExtractZip extracts zipfile to destDir

func FileExists

func FileExists(file string) (bool, error)

func FindMatchingVersion

func FindMatchingVersion(constraint string, versions []string) (string, error)

func FindMatchingVersions

func FindMatchingVersions(constraint string, versions []string) ([]string, error)

func GetBuildpackDir

func GetBuildpackDir() (string, error)

Gets the buildpack directory

func MoveDirectory

func MoveDirectory(srcDir, destDir string) error

func RandString

func RandString(n int) string

func RunAfterCompile

func RunAfterCompile(stager *Stager) error

func RunBeforeCompile

func RunBeforeCompile(stager *Stager) error

Types

type BuildpackMetadata

type BuildpackMetadata struct {
	Language string `yaml:"language"`
	Version  string `yaml:"version"`
}

type Command

type Command struct {
}

func (*Command) Execute

func (c *Command) Execute(dir string, stdout io.Writer, stderr io.Writer, program string, args ...string) error

func (*Command) Output

func (c *Command) Output(dir string, program string, args ...string) (string, error)

func (*Command) Run

func (c *Command) Run(cmd *exec.Cmd) error

func (*Command) RunWithOutput

func (c *Command) RunWithOutput(cmd *exec.Cmd) ([]byte, error)

type DefaultHook

type DefaultHook struct{}

func (DefaultHook) AfterCompile

func (d DefaultHook) AfterCompile(stager *Stager) error

func (DefaultHook) BeforeCompile

func (d DefaultHook) BeforeCompile(stager *Stager) error

type Dependency

type Dependency struct {
	Name    string `yaml:"name"`
	Version string `yaml:"version"`
}

type DeprecationDate

type DeprecationDate struct {
	Name        string `yaml:"name"`
	VersionLine string `yaml:"version_line"`
	Date        string `yaml:"date"`
	Link        string `yaml:"link"`
}

type Hook

type Hook interface {
	BeforeCompile(*Stager) error
	AfterCompile(*Stager) error
}

type Installer

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

func NewInstaller

func NewInstaller(manifest *Manifest) *Installer

func (*Installer) CleanupAppCache

func (i *Installer) CleanupAppCache() error

func (*Installer) FetchDependency

func (i *Installer) FetchDependency(dep Dependency, outputFile string) error

func (*Installer) GetVersionLine

func (i *Installer) GetVersionLine() *map[string]string

func (*Installer) InstallDependency

func (i *Installer) InstallDependency(dep Dependency, outputDir string) error

func (*Installer) InstallOnlyVersion

func (i *Installer) InstallOnlyVersion(depName string, installDir string) error

func (*Installer) SetAppCacheDir

func (i *Installer) SetAppCacheDir(appCacheDir string) (err error)

func (*Installer) SetVersionLine

func (i *Installer) SetVersionLine(depName string, line string)

type JSON

type JSON struct {
}

func NewJSON

func NewJSON() *JSON

func (*JSON) Load

func (j *JSON) Load(file string, obj interface{}) error

func (*JSON) Write

func (j *JSON) Write(dest string, obj interface{}) error

type Logger

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

func NewLogger

func NewLogger(w io.Writer) *Logger

func (*Logger) BeginStep

func (l *Logger) BeginStep(format string, args ...interface{})

func (*Logger) Debug

func (l *Logger) Debug(format string, args ...interface{})

func (*Logger) Error

func (l *Logger) Error(format string, args ...interface{})

func (*Logger) Info

func (l *Logger) Info(format string, args ...interface{})

func (*Logger) Output

func (l *Logger) Output() io.Writer

func (*Logger) Protip

func (l *Logger) Protip(tip string, helpURL string)

func (*Logger) Warning

func (l *Logger) Warning(format string, args ...interface{})

type Manifest

type Manifest struct {
	LanguageString  string            `yaml:"language"`
	DefaultVersions []Dependency      `yaml:"default_versions"`
	ManifestEntries []ManifestEntry   `yaml:"dependencies"`
	Deprecations    []DeprecationDate `yaml:"dependency_deprecation_dates"`
	Stack           string            `yaml:"stack"`
	// contains filtered or unexported fields
}

func NewManifest

func NewManifest(bpDir string, logger *Logger, currentTime time.Time) (*Manifest, error)

func (*Manifest) AllDependencyVersions

func (m *Manifest) AllDependencyVersions(depName string) []string

func (*Manifest) ApplyOverride

func (m *Manifest) ApplyOverride(depsDir string) error

func (*Manifest) CheckBuildpackVersion

func (m *Manifest) CheckBuildpackVersion(cacheDir string)

func (*Manifest) CheckStackSupport

func (m *Manifest) CheckStackSupport() error

func (*Manifest) DefaultVersion

func (m *Manifest) DefaultVersion(depName string) (Dependency, error)

func (*Manifest) GetEntry

func (m *Manifest) GetEntry(dep Dependency) (*ManifestEntry, error)

func (*Manifest) IsCached

func (m *Manifest) IsCached() bool

func (*Manifest) Language

func (m *Manifest) Language() string

func (*Manifest) RootDir

func (m *Manifest) RootDir() string

func (*Manifest) StoreBuildpackMetadata

func (m *Manifest) StoreBuildpackMetadata(cacheDir string) error

func (*Manifest) Version

func (m *Manifest) Version() (string, error)

type ManifestEntry

type ManifestEntry struct {
	Dependency Dependency `yaml:",inline"`
	URI        string     `yaml:"uri"`
	File       string     `yaml:"file"`
	SHA256     string     `yaml:"sha256"`
	CFStacks   []string   `yaml:"cf_stacks"`
}

type Stager

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

func NewStager

func NewStager(args []string, logger *Logger, manifest *Manifest) *Stager
func (s *Stager) AddBinDependencyLink(destPath, sourceName string) error

func (*Stager) BuildDir

func (s *Stager) BuildDir() string

func (*Stager) BuildpackLanguage

func (s *Stager) BuildpackLanguage() string

func (*Stager) BuildpackVersion

func (s *Stager) BuildpackVersion() (string, error)

func (*Stager) CacheDir

func (s *Stager) CacheDir() string

func (*Stager) CheckBuildpackValid

func (s *Stager) CheckBuildpackValid() error

func (*Stager) ClearCache

func (s *Stager) ClearCache() error

func (*Stager) ClearDepDir

func (s *Stager) ClearDepDir() error

func (*Stager) DepDir

func (s *Stager) DepDir() string

func (*Stager) DepsDir

func (s *Stager) DepsDir() string

func (*Stager) DepsIdx

func (s *Stager) DepsIdx() string

func (*Stager) LinkDirectoryInDepDir

func (s *Stager) LinkDirectoryInDepDir(destDir, depSubDir string) error

func (*Stager) Logger

func (s *Stager) Logger() *Logger

func (*Stager) ProfileDir

func (s *Stager) ProfileDir() string

func (*Stager) SetLaunchEnvironment

func (s *Stager) SetLaunchEnvironment() error

func (*Stager) SetStagingEnvironment

func (s *Stager) SetStagingEnvironment() error

func (*Stager) StagingComplete

func (s *Stager) StagingComplete()

func (*Stager) WriteConfigYml

func (s *Stager) WriteConfigYml(config interface{}) error

func (*Stager) WriteEnvFile

func (s *Stager) WriteEnvFile(envVar, envVal string) error

func (*Stager) WriteProfileD

func (s *Stager) WriteProfileD(scriptName, scriptContents string) error

type YAML

type YAML struct {
}

func NewYAML

func NewYAML() *YAML

func (*YAML) Load

func (y *YAML) Load(file string, obj interface{}) error

func (*YAML) Write

func (y *YAML) Write(dest string, obj interface{}) error

Directories

Path Synopsis
v7
Code generated for package packager by go-bindata DO NOT EDIT.
Code generated for package packager by go-bindata DO NOT EDIT.

Jump to

Keyboard shortcuts

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