util

package
Version: v0.0.0-...-6079644 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2015 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPReader

func NewHTTPReader() schemeReader

NewHTTPReader creates an instance of the HttpURLReader

Types

type CallbackInvoker

type CallbackInvoker interface {
	ExecuteCallback(callbackURL string, success bool, messages []string) []string
}

CallbackInvoker posts results to a callback URL when a STI build is done.

func NewCallbackInvoker

func NewCallbackInvoker() CallbackInvoker

NewCallbackInvoker creates an instance of the default CallbackInvoker implementation

type CommandOpts

type CommandOpts struct {
	Stdout io.Writer
	Stderr io.Writer
	Dir    string
}

CommandOpts contains options to attach Stdout/err to a command to run or set its initial directory

type CommandRunner

type CommandRunner interface {
	RunWithOptions(opts CommandOpts, name string, arg ...string) error
	Run(name string, arg ...string) error
}

CommandRunner executes OS commands with the given parameters and options

func NewCommandRunner

func NewCommandRunner() CommandRunner

NewCommandRunner creates a new instance of the default implementation of CommandRunner

type Downloader

type Downloader interface {
	DownloadFile(url *url.URL, targetFile string) (bool, error)
}

Downloader downloads the specified URL to the target file location

func NewDownloader

func NewDownloader() Downloader

NewDownloader creates an instance of the default Downloader implementation

type FileSystem

type FileSystem interface {
	Chmod(file string, mode os.FileMode) error
	Rename(from, to string) error
	MkdirAll(dirname string) error
	Mkdir(dirname string) error
	Exists(file string) bool
	Copy(sourcePath, targetPath string) error
	RemoveDirectory(dir string) error
	CreateWorkingDirectory() (string, error)
	Open(file string) (io.ReadCloser, error)
	WriteFile(file string, data []byte) error
}

FileSystem allows STI to work with the file system and perform tasks such as creating and deleting directories

func NewFileSystem

func NewFileSystem() FileSystem

NewFileSystem creates a new instance of the default FileSystem implementation

type FileURLReader

type FileURLReader struct{}

FileURLReader opens a specified file and returns its stream

func (*FileURLReader) IsFromImage

func (*FileURLReader) IsFromImage() bool

IsFromImage returns information whether URL is from inside the image

func (*FileURLReader) Read

func (*FileURLReader) Read(url *url.URL) (io.ReadCloser, error)

Read produces an io.Reader from a file URL

type HttpURLReader

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

HttpURLReader retrieves a response from a given http(s) URL

func (*HttpURLReader) IsFromImage

func (h *HttpURLReader) IsFromImage() bool

IsFromImage returns information whether URL is from inside the image

func (*HttpURLReader) Read

func (h *HttpURLReader) Read(url *url.URL) (io.ReadCloser, error)

Read produces an io.Reader from an http(s) URL.

type ImageReader

type ImageReader struct{}

ImageReader just returns information the URL is from inside the image

func (*ImageReader) IsFromImage

func (*ImageReader) IsFromImage() bool

IsFromImage returns information whether URL is from inside the image

func (*ImageReader) Read

func (*ImageReader) Read(url *url.URL) (io.ReadCloser, error)

Read throws Not implemented error

Jump to

Keyboard shortcuts

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