model

package
v0.0.0-...-22f80c9 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2016 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const AnyOSDirectoryName = "any-os"

Variables

View Source
var (
	ErrArtifactNotFound = errors.New("artifact not found in repository")
)
View Source
var ErrNoSuchRepository = errors.New("no configuration for this repository name")
View Source
var Fatalf = log.Fatalf
View Source
var Printf = log.Printf
View Source
var Verbose = false

Functions

func HasLocalRepository

func HasLocalRepository(settings *Settings) bool

TODO refactor

Types

type Artifact

type Artifact struct {
	// Descriptor api version. 1 is the default.
	Api int `json:"api" yaml:"api"`

	// Name of the group of artifacts. Cannot contain "/" or whitespace characters.
	Group string
	// Name of the artifact. Cannot contain "/" or whitespace characters.
	Name string `yaml:"artifact"`
	// Use semantic versioning or include the "SNAPSHOT" keyword for non-fixed versions.
	Version string
	// Represents the file extension.
	Type string
	// If true then use "any" for the operating system name when archiving/fetching.
	AnyOS bool `yaml:"any-os"`
	// if not empty use this value for the actual storage file
	OverrideStorageBase string
	// optionally specify the repository to archive/fetch this artifact
	RepositoryName string `yaml:"repository"`
}

func LoadArtifact

func LoadArtifact(src string) (a Artifact, e error)

LoadArtifact parses an Artifact by reading the src file.

func (Artifact) IsSnapshot

func (a Artifact) IsSnapshot() bool

IsSnapshot returns true if the version has the substring "SNAPSHOT".

func (Artifact) PluginParameters

func (a Artifact) PluginParameters() (params []string)

func (Artifact) StorageBase

func (a Artifact) StorageBase() string

StorageBase returns the file name to which the artifact is stored.

func (Artifact) StorageLocation

func (a Artifact) StorageLocation(osname string, isAnyOS bool) string

StorageLocation returns the relative resource path to store the artifact.

func (*Artifact) UseStorageBase

func (a *Artifact) UseStorageBase(actualFilename string)

UseStorageBase is used to override the default format of the actual file to archive/fetch.

func (Artifact) Validate

func (a Artifact) Validate() error

Validate will inspect all required fields.

type Assembly

type Assembly struct {
	Artifact `yaml:",inline"`
	Parts    []Artifact `json:"parts" yaml:"parts"`
}

func LoadAssembly

func LoadAssembly(src string) (a Assembly, e error)

LoadAssembly parses an Assembly by reading the src file.

func (Assembly) Validate

func (a Assembly) Validate() error

Validate will inspect all required fields and that of its parts. Fail on the first error detected.

type CachingRepository

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

func (CachingRepository) Exists

func (c CachingRepository) Exists(a Artifact) bool

func (CachingRepository) Fetch

func (c CachingRepository) Fetch(a Artifact, destination string) error

func (CachingRepository) ID

func (r CachingRepository) ID() string

func (CachingRepository) Store

func (c CachingRepository) Store(a Artifact, source string) error

type Config

type Config struct {
	Api          int
	Repositories []RepositoryConfig
	// contains filtered or unexported fields
}

func LoadConfig

func LoadConfig(source string) (c Config, err error)

func (Config) Named

func (c Config) Named(name string) (RepositoryConfig, error)

type EmptyRepository

type EmptyRepository struct{}

func (EmptyRepository) Exists

func (r EmptyRepository) Exists(a Artifact) bool

func (EmptyRepository) Fetch

func (r EmptyRepository) Fetch(a Artifact, destination string) error

func (EmptyRepository) Store

func (r EmptyRepository) Store(a Artifact, source string) error

type Repository

type Repository interface {
	ID() string
	Exists(a Artifact) bool
	// destination cannot be a directory
	Fetch(a Artifact, destination string) error
	// source cannot be a directory
	Store(a Artifact, source string) error
}

func NewCachingRepository

func NewCachingRepository(main, cache Repository) Repository

type RepositoryConfig

type RepositoryConfig struct {
	Name       string
	Plugin     string
	URL        string
	Path       string
	User       string
	Password   string
	Snapshots  bool
	Bucket     string
	AccessFile string `yaml":access-file"`
	SecretFile string `yaml":secret-file"`
}

func RepositoryConfigNamed

func RepositoryConfigNamed(settings *Settings, name string) RepositoryConfig

type Settings

type Settings struct {
	Verbose                bool
	OS                     string
	MainConfigLocation     string
	ArtifactConfigLocation string
	TargetRepository       string
}

func (Settings) PluginParameters

func (s Settings) PluginParameters() (params []string)

func (Settings) WithRepositoryNamed

func (a Settings) WithRepositoryNamed(r string) Settings

Jump to

Keyboard shortcuts

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