scripts

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2016 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertEnvironment added in v0.3.3

func ConvertEnvironment(env []Environment) (result []string)

ConvertEnvironment converts the []Environment to "key=val" strings

func ConvertEnvironmentToDocker added in v0.3.3

func ConvertEnvironmentToDocker(env []Environment) (result string)

ConvertEnvironmentToDocker converts the []Environment into Dockerfile format

func NewHTTPReader

func NewHTTPReader() schemeReader

NewHTTPReader creates an instance of the HttpURLReader

Types

type DefaultScriptSourceManager added in v1.1.2

type DefaultScriptSourceManager struct {
	Image      string
	ScriptsURL string
	// contains filtered or unexported fields
}

DefaultScriptSourceManager manages the default script lookup and installation for source-to-image.

func (*DefaultScriptSourceManager) Add added in v1.1.2

Add registers a new script source handler.

func (*DefaultScriptSourceManager) InstallOptional added in v1.1.2

func (i *DefaultScriptSourceManager) InstallOptional(scripts []string, dstDir string) []api.InstallResult

InstallOptional downloads and installs a set of scripts into dstDir, the result is a map of scripts with detailed information about each of the scripts install process

func (*DefaultScriptSourceManager) InstallRequired added in v1.1.2

func (i *DefaultScriptSourceManager) InstallRequired(scripts []string, dstDir string) ([]api.InstallResult, error)

InstallRequired Downloads and installs required scripts into dstDir, the result is a map of scripts with detailed information about each of the scripts install process with error if installing some of them failed

type Downloader

type Downloader interface {
	Download(url *url.URL, target string) (*api.SourceInfo, 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 Environment added in v0.3.3

type Environment struct {
	Name  string
	Value string
}

Environment represents a single environment variable definition

func GetEnvironment added in v0.3.3

func GetEnvironment(config *api.Config) ([]Environment, error)

GetEnvironment gets the .sti/environment file located in the sources and parse it into []environment

type FileURLReader

type FileURLReader struct{}

FileURLReader opens a specified file and returns its stream

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 {
	Get func(url string) (*http.Response, error)
}

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

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) Read

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

Read throws Not implemented error

type Installer

type Installer interface {
	InstallRequired(scripts []string, dstDir string) ([]api.InstallResult, error)
	InstallOptional(scripts []string, dstDir string) []api.InstallResult
}

Installer interface is responsible for installing scripts needed to run the build.

func NewInstaller

func NewInstaller(image string, scriptsURL string, docker docker.Docker, auth dockerClient.AuthConfiguration) Installer

NewInstaller returns a new instance of the default Installer implementation

type ScriptHandler added in v1.1.2

type ScriptHandler interface {
	Get(script string) *api.InstallResult
	Install(*api.InstallResult) error
	SetDestinationDir(string)
	String() string
}

ScriptHandler provides an interface for various scripts source handlers.

type ScriptSourceManager added in v1.1.2

type ScriptSourceManager interface {
	Add(ScriptHandler)
	SetDownloader(Downloader)
	Installer
}

ScriptSourceManager manages various script handlers.

type SourceScriptHandler added in v1.1.2

type SourceScriptHandler struct {
	DestinationDir string
	// contains filtered or unexported fields
}

SourceScriptHandler handles the case when the scripts are contained in the source code directory.

func (*SourceScriptHandler) Get added in v1.1.2

func (s *SourceScriptHandler) Get(script string) *api.InstallResult

Get verifies if the script is present in the source directory and get the installation result.

func (*SourceScriptHandler) Install added in v1.1.2

func (s *SourceScriptHandler) Install(r *api.InstallResult) error

Install copies the script into upload directory and fix its permissions.

func (*SourceScriptHandler) SetDestinationDir added in v1.1.2

func (s *SourceScriptHandler) SetDestinationDir(baseDir string)

SetDestinationDir sets the directory where the scripts should be uploaded. In case of SourceScriptHandler this is a source directory root.

func (*SourceScriptHandler) String added in v1.1.2

func (s *SourceScriptHandler) String() string

String implements the String() function.

type UrlScriptHandler added in v1.1.2

type UrlScriptHandler struct {
	URL            string
	DestinationDir string
	// contains filtered or unexported fields
}

UrlScriptHandler handles script download using URL.

func (*UrlScriptHandler) Get added in v1.1.2

func (s *UrlScriptHandler) Get(script string) *api.InstallResult

Get parses the provided URL and the script name.

func (*UrlScriptHandler) Install added in v1.1.2

func (s *UrlScriptHandler) Install(r *api.InstallResult) error

Install downloads the script and fix its permissions.

func (*UrlScriptHandler) SetDestinationDir added in v1.1.2

func (s *UrlScriptHandler) SetDestinationDir(baseDir string)

SetDestinationDir sets the destination where the scripts should be downloaded.

func (*UrlScriptHandler) String added in v1.1.2

func (s *UrlScriptHandler) String() string

String implements the String() function.

Jump to

Keyboard shortcuts

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