Documentation ¶
Index ¶
- func AppendToEnvVar(name string, delimiter string, values ...string) string
- func CopyDir(source string, destination string) error
- func CopyFile(source *os.File, destination string) error
- func DirExists(path string) (bool, error)
- func Execute(f ExecuteFunc, options ...Option)
- func Exists(path string) (bool, error)
- func FileExists(path string) (bool, error)
- func GetEnvRequired(name string) (string, error)
- func GetEnvWithDefault(name string, def string) string
- func Helpers(helpers map[string]ExecD, options ...Option) error
- func NewFileListingHash(roots ...string) (string, error)
- func NodeJSMainModule(path string) (string, error)
- func ResolveBool(name string) bool
- func ResolveBoolErr(name string) (bool, error)
- func SymlinkExists(path string) (bool, error)
- type Config
- type ExecD
- type ExecuteFunc
- type FileEntry
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendToEnvVar ¶ added in v1.54.0
AppendToEnvVar appends a collection of values to an env var separated by a delimiter. If the env var does not already exist, joins the values with the delimiter and returns the result.
func CopyDir ¶ added in v1.63.0
CopyDir copies the source directory to the destination. It ensures that the source and destination permissions match.
func CopyFile ¶
CopyFile copies a file from the source to the destination. It ensures that the parent directory is created and matches the source and destination permissions.
func Execute ¶
func Execute(f ExecuteFunc, options ...Option)
Execute is called by the main function of a buildpack helper application, for execution.
func FileExists ¶ added in v1.60.0
FileExists returns true if the path exists and is a regular file.
func GetEnvRequired ¶ added in v1.54.0
GetEnvRequired returns the value of an environment variable if it exists, otherwise returns an error with a predictable message.
func GetEnvWithDefault ¶ added in v1.54.0
GetEnvWithWithDefault returns the value of an environment variable if it exists, otherwise returns the default.
func Helpers ¶ added in v1.41.0
Helpers is called by the main function of a buildpack's helper application, for execution.
func NewFileListingHash ¶ added in v1.52.0
NewFileListingHash generates a sha256 hash from the listing of all entries under the roots
func NodeJSMainModule ¶ added in v1.17.0
NodeJSMainModule returns the name of the main module as defined in <path>/package.json. If no package.json exists, or the package.json does not include a main entry, value defaults to server.js in line with the behavior of the Paketo NodeJS buildpack.
func ResolveBool ¶ added in v1.55.0
ResolveBool resolves a boolean value for a configuration option. Returns true for 1, t, T, TRUE, true, True. Returns false for all other values or unset.
func ResolveBoolErr ¶ added in v1.64.0
ResolveBoolErr resolves a boolean value for a configuration option. Returns true, nil for 1, t, T, TRUE, true, True. Returns false, nil for all other values or unset. Returns false, error is the value could not be parsed into a bool
func SymlinkExists ¶ added in v1.60.0
SymlinkExists returns true if the path exists and is a symlink.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is an object that contains configurable properties for execution.
type ExecuteFunc ¶
type ExecuteFunc func() error
ExecuteFunc is the callback function for buildpack helper application implementations.
type FileEntry ¶
type FileEntry struct { // Path is the path of a file. Path string `toml:"path"` // Mode is the mode of the source file. Mode string `toml:"mode"` // SHA256 is the SHA256 hash of the source file. SHA256 string `toml:"sha256,omitempty"` }
FileEntry is metadata about a file.
func NewFileListing ¶
NewFileListing generates a listing of all entries under the roots.
type Option ¶
Option is a function for configuring a Config instance.
func WithArguments ¶ added in v1.41.0
WithArguments creates an Option that sets a collection of arguments.
func WithExecdWriter ¶ added in v1.41.0
WithExecdWriter creates an Option that sets an exec.d Writer implementation.
func WithExitHandler ¶
func WithExitHandler(exitHandler libcnb.ExitHandler) Option
WithExitHandler creates an Option that sets an ExitHandler implementation.